Tool/software: Code Composer Studio
Hi, I really need help with this problem, because we have been trying to get it to work for the last couple of months without any success. The MCU is supposed to gather data from an LVDT and a Temperature sensor, and send it back to the master using SPI. We created firmware that will manage all the necessary tasks, including placing the data in the COMBUF register. However, sometimes the MCU will not detect that a request from the master has arrived (COM_RX_STATUS), and we get duplicated data. I stripped most of the code, and made a basic code to check if I was doing something wrong, but still I have the same behavior. The code that I am attaching is the one that I am using to test the functionality of the board. It basically sends a counter that resets once it gets to 15. I have this "wait" function that will help the process until the master request the next set of data. Attached is a screen shot of the Logic Analyzer, you can see that I am writing the words "AA" and "BB." This should trigger the flag saying that I received data, moving me out of the "WAIT_SYNCH" function. However, when I request reading the buffer I only get "FF00". This is the word that I placed to initialize my loop. I just ran out of ideas, and I don't know if I am doing something wrong or if instead I should be working using interrupts. I tried to use interrupts, but I couldn't get it to work. It might be related to the same problem.
I will really appreciate your help with this problem, because it has been holding our research project for too long.
Thanks,
Hector
/* ============================================================================= * Texas Instruments PGA970 Platform Software * (c) Copyright Texas Instruments, Incorporated. All Rights Reserved. * * Use of this software is controlled by the terms and conditions found * in the license agreement under which this software has been supplied. * =========================================================================== */ /** * @file pga970_main.c * * This File contains PGA970 main functions. * * @path $(CSLPATH)\PGA970\source\core * * @rev 1.3 */ /* ----------------------------------------------------------------------------- *! *! Revision History *! =================================== *! 06-June-2013 mf: Modified TusharB.Modified main loop. * =========================================================================== */ /******************************************************************************* * INCLUDE FILES *******************************************************************************/ #include "pga970_platf.h" /* ========================================================================== */ /** * main() Main routine * * @param none * * @return none * * @post none * * @see none */ /* ========================================================================== */ #define Ref_Calc 2.5/5340354 #define N_Dec 6 char x[6] = "12334"; char *y = x; void WAIT_SYNCH(){ int RXS; RXS = COM_RX_STATUS; while(RXS== 0x00); COM_RX_STATUS = 0x01; // Clears the COM_RX_STATUS Register COM_TX_STATUS = 0x00; // Clears the COM_TX_STATUS Register } void main(void) { int i; //config for waveform gen WAVEFORM_Config(49,0.86, 0); WAVEFORM_Read_Table(); //ADC1 CONFIG CONFIG_ALPWR(0x04); ADC_Config( 1, 0, 1, 8, 8); S1_CONFIG(0); DEMOD1_BPF_config( 0x951400, 0x18CBFF, 0xD6D6FF); DEMOD1_LPF_config(0xF304, 0x1976); AMUX_CTRL_CONFIG(0xF6); //ADC3 CONFIG ADC3_PTAT_LPF_Config(0x4A07,0x6C71);//LOW PASS FILTER ADC3_VI_LPF_Config(0x4A07,0x6C71);//LOW PASS FILTER S3_CONFIG(0x00);//Configures ADC3 gain, SEM, Inversion S3_CFG_1_CONFIG(0x03);//Configures S3 PTAT gain and S3 inversion DIG_IF_CTRL = 0x01; CFG_Peripheral_Config(); ALPWR = 0x04; COMBUF_RX_STATUS_CLEAR(); i = 0; while(1){ COM_MCU_TO_DIF_B1 = 0xFF; COM_MCU_TO_DIF_B2 = i; WAIT_SYNCH(); i++; if (i == 15){ i=0; } } }