Jump to content


  • Content Count

  • Joined

  • Last visited

Reputation Activity

  1. Like
    Speedbug78 got a reaction from Fmilburn in File Changes to Support MSP430G2452 and SPI   
    I downloaded Energia 1.6.10e18
    I am programming an msp430g2452
    I am using LanchPad MSP-EXP430G2 to program my part (on a custom board via spi-by-wire)
    I am running Energia on Windows 7
    I ran update on Energia MSP430 boards via Boards Manager to version 1.0.2
    When compiling I get the following errors:
    In usi_spi.cpp I had to change a couple of instances of spi_tx to spi_send (fixed code below):
    void spi_transmit16(const uint16_t data) { spi_send(data & 0xFF); spi_send((data>>8) & 0xFF); } void spi_transmit(void *buf, uint16_t count) { uint8_t *p = (uint8_t *)buf; if (count == 0) return; while(count){ spi_send(*p++); count--; } }  
    Code then compiles, but doesn't run properly.  The warnings are:
    To fix the clock problem, in msp430g2452.h I had to add a section defining the TLV data (added at line 760):
    /************************************************************ * Offest Indexed TLV Data in Mem ************************************************************/ /* TLV Calibration Data Structure, Datasheet Table 9 */ #define TAG_DCO_30 (0x01) /* Tag for DCO30 Calibration Data */ #define TAG_ADC10_1 (0x10) /* Tag for ADC10_1 Calibration Data */ #define TAG_EMPTY (0xFE) /* Tag for Empty Data Field in Calibration Data */ #ifndef __DisableCalData #define TLV_CHECKSUM_ 0x10C0 /* TLV CHECK SUM */ const_sfrw(TLV_CHECKSUM, TLV_CHECKSUM_); #define TLV_DCO_30_TAG_ 0x10F6 /* TLV TAG_DCO30 TAG */ const_sfrb(TLV_DCO_30_TAG, TLV_DCO_30_TAG_); #define TLV_DCO_30_LEN_ 0x10F7 /* TLV TAG_DCO30 LEN */ const_sfrb(TLV_DCO_30_LEN, TLV_DCO_30_LEN_); #define TLV_ADC10_1_TAG_ 0x10DA /* TLV ADC10_1 TAG */ const_sfrb(TLV_ADC10_1_TAG, TLV_ADC10_1_TAG_); #define TLV_ADC10_1_LEN_ 0x10DB /* TLV ADC10_1 LEN */ const_sfrb(TLV_ADC10_1_LEN, TLV_ADC10_1_LEN_); #endif /************************************************************ * ADC Calibration Data Mem Offsets (offset from 0x10DA) ************************************************************/ /* Datasheet Table 10 */ #define CAL_ADC_25T85 (0x0010) /* Index for 2.5V/85Deg Cal. Value */ #define CAL_ADC_25T30 (0x000E) /* Index for 2.5V/30Deg Cal. Value */ #define CAL_ADC_25VREF_FACTOR (0x000C) /* Index for 2.5V Ref. Factor */ #define CAL_ADC_15T85 (0x000A) /* Index for 1.5V/85Deg Cal. Value */ #define CAL_ADC_15T30 (0x0008) /* Index for 1.5V/30Deg Cal. Value */ #define CAL_ADC_15VREF_FACTOR (0x0006) /* Index for ADC 1.5V Ref. Factor */ #define CAL_ADC_OFFSET (0x0004) /* Index for ADC Offset */ #define CAL_ADC_GAIN_FACTOR (0x0002) /* Index for ADC Gain Factor */ /************************************************************ * DCO Calibration Data Mem Offsets (offset from 0x10F6), Datasheet Table 10 ************************************************************/ /* Datasheet Table 10 */ #define CAL_DCO_16MHZ (0x0002) /* Index for DCOCTL Calibration Data for 16MHz */ #define CAL_BC1_16MHZ (0x0003) /* Index for BCSCTL1 Calibration Data for 16MHz */ #define CAL_DCO_12MHZ (0x0004) /* Index for DCOCTL Calibration Data for 12MHz */ #define CAL_BC1_12MHZ (0x0005) /* Index for BCSCTL1 Calibration Data for 12MHz */ #define CAL_DCO_8MHZ (0x0006) /* Index for DCOCTL Calibration Data for 8MHz */ #define CAL_BC1_8MHZ (0x0007) /* Index for BCSCTL1 Calibration Data for 8MHz */ #define CAL_DCO_1MHZ (0x0008) /* Index for DCOCTL Calibration Data for 1MHz */ #define CAL_BC1_1MHZ (0x0009) /* Index for BCSCTL1 Calibration Data for 1MHz */  
    Now code compiles and runs properly on the processor.  I have not tested out SPI data yet, so I'm not 100% that it works.
    Just thought people might like to know, thanks!
  • Create New...