Other Parts Discussed in Thread: C2000WARE
Tool/software:
Hello,
I need to store a large array in FLASH memory but I am finding that the debugger never reaches the initialized state where you hit the "Continue" blue button. Same story with directly programming the FLASH, it doesn't go through.
For example, this works:
GOOD!
~~~~~~~~~~~~~
This does not work:
BAD!
Left hanging, I never hit the "Resume" button and the code does not run. I know that the flash did not get written properly because I have a GPIO pin to set high as a test.
You can see in the picture there is plenty of space in FLASH memory, no build errors either.
Is there something improper in my .cmd file? Something else wrong?
.cmd file:
https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/171/2860.2837xD_5F00_FLASH_5F00_lnk_5F00_cpu1.cmd
.c file:
// ############################################################################# // // FILE: spi_ex1_loopback.c // // TITLE: SPI Digital Loopback // [___ADC__] // Master out | GPIO63 | H55 - yellow // Master in | GPIO64 | H54 - green // CLK | GPIO65 | H47 - red // CS | GPIO131 | H58 - orange // TMR_SCP_OUT | GPIO32 | H2 - scope // TIMER_IN | GPIO40 | H50 - from LMK5B // START | GPIO27 | H52 - purple // RESET | GPIO25 | H51 - blue // nDRDY_IN | GPIO15 | H73 - unused // [__am64/ni spi__] // Master out | GPIO58 | H15 - // Master in | GPIO59 | H14 - // CLK | GPIO60 | H7 - // CS | GPIO61 | H19 - leave floating // Fake CS | GPIO125 | H12 - Use for 4-byte SPI // [__i2c ni__] // Master out | GPIO104 | H9 - SCL // Master in | GPIO105 | H10 - SDA //! \addtogroup driver_example_list //! <h1>SPI Digital Loopback</h1> //! //! This program uses the internal loopback test mode of the SPI module. This //! is a very basic loopback that does not use the FIFOs or interrupts. A //! stream of data is sent and then compared to the received stream. //! The pinmux and SPI modules are configure through the sysconfig file. //! //! The sent data looks like this: \n //! 0000 0001 0002 0003 0004 0005 0006 0007 .... FFFE FFFF 0000 //! //! This pattern is repeated forever. //! //! \b External \b Connections \n //! - None //! //! \b Watch \b Variables \n //! - \b sData - Data to send //! - \b rData - Received data //! // // ############################################################################# // // Included Files // #include "ads127l21.h" #include "board.h" #include "device.h" #include <math.h> #include <stdio.h> //#include "i2cLib_ex6_FIFO_master_interrupt.h" //******************************************************* //****************** FOR I2C **************************** //******************************************************* __interrupt void INT_ni_I2C_ISR(void){} __interrupt void INT_ni_I2C_FIFO_ISR(void){} //******************************************************* //********* FOR TRIG from 5B **************************** //******************************************************* __interrupt void INT_TRIG_5B_IN_GPIO_XINT_ISR(void); //******************************************************* //****************** FOR ADC **************************** //******************************************************* const uint8_t g_adcDataBuffSize = 8; // data to average, set to powers of 2 for bitshift int32_t g_adcDataBuff[g_adcDataBuffSize]; //raw data to be averaged, sampled as fast as possible const uint32_t g_adcDataStoreSize = 100e3;//232e3; #pragma DATA_SECTION(g_adcDataStore,"g_adcDataStore_DATA_SECT") uint16_t g_adcDataStore[g_adcDataStoreSize] = {0}; //averaged data, one every 10 kHz uint8_t g_adcDataDiv; int32_t g_adcDataSum; int32_t g_adcDataAvg; uint8_t g_adcCntBuff; uint32_t g_adcCntStore; bool g_endOfCapture; uint8_t g_cnt = 0; // // Main // void main(void) { // Initialize device clock and peripherals Device_init(); // Disable pin locks and enable internal pullups. Device_initGPIO(); // Initialize PIE and clear PIE registers. Disables CPU interrupts. Interrupt_initModule(); // Initialize the PIE vector table with pointers to the shell Interrupt // Service Routines (ISR). Interrupt_initVectorTable(); // IMPORTANT: Make sure device is powered before setting GPIOs pins to HIGH // state. Initialize GPIOs pins used by ADS127L11 Initialize SPI peripheral // used by ADS127L11 Board_init(); ADS127_startUp(); volatile uint16_t count = 0; g_adcCntBuff = 0; g_adcCntStore = 0; g_adcDataDiv = log2(g_adcDataBuffSize); g_adcDataSum = 0; g_adcDataAvg = 0; g_endOfCapture = FALSE; uint8_t i; for (i = 0; i < g_adcDataBuffSize; i++) { g_adcDataBuff[i] = 0; } // Enable Global Interrupt (INTM) and realtime interrupt (DBGM) EINT; ERTM; uint16_t tempData = 0; /* Enable interrupt for LMK5B trigger to send avg data */ Interrupt_clearACKGroup(INT_TRIG_5B_IN_GPIO_XINT_INTERRUPT_ACK_GROUP); GPIO_setQualificationPeriod(TRIG_5B_IN_GPIO, 1); Interrupt_enable(INT_TRIG_5B_IN_GPIO_XINT); GPIO_writePin(timer_scp_GPIO, 0); while (1) { /**/ if (g_adcCntBuff == g_adcDataBuffSize) g_adcCntBuff=0; g_adcDataBuff[g_adcCntBuff++] = ADS127_readData(); tempData++; } } //***************************************************************** //****************** ISR Trigger to send average ADC ************** //****************** data to NI device through I2C **************** //***************************************************************** __interrupt void INT_TRIG_5B_IN_GPIO_XINT_ISR(void) { g_adcDataSum = 0; uint8_t i; for (i = 0; i < g_adcDataBuffSize; i++) { g_adcDataSum += g_adcDataBuff[i]; } g_adcDataAvg = g_adcDataSum >> g_adcDataDiv; g_adcDataStore[g_adcCntStore++] = g_adcDataAvg; if(g_adcCntStore >= g_adcDataStoreSize){ g_endOfCapture = TRUE; Interrupt_disable(INT_TRIG_5B_IN_GPIO_XINT); GPIO_writePin(timer_scp_GPIO, 1); } //g_adcDataAvg+=3; // added this line instead of the above as a quick check to see if receiver gets all data Interrupt_clearACKGroup(INT_TRIG_5B_IN_GPIO_XINT_INTERRUPT_ACK_GROUP); }
I look forward to your support.
Kindly,
Jennifer
Applications Engineer
Clocks and Timing Solutions