This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/MSP430F2618: Data missing while receiving data in both UART0 and UART1.

Part Number: MSP430F2618

Tool/software: Code Composer Studio

As we are using MSP430F2618  controller for our application , we have are both UART as for modbus protocol .

what we observed is on sending/query the data to UART every reguler interval say at 500msec once in while we are missing the data reception 

Example : we are sending 8 byte query we are receiving only 7 bytes.

code snippet:

static volatile unsigned char ChARxBuffer[SIZE_ChARxBuffer];
static volatile unsigned char ChATempRxBuffer[SIZE_ChARxBuffer];
static volatile unsigned char *ChARxBufRdPtr = ChARxBuffer, *ChARxBufWrPtr = ChARxBuffer; //Buffer and pointers for received bytes


#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCI0RX_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(USCIAB0RX_VECTOR))) USCI0RX_ISR (void)
#else
#error Compiler not supported!
#endif
{

*ChARxBufWrPtr++ = UCA0RXBUF; //Put received character in the buffer
if (ChARxBufWrPtr > &ChARxBuffer[SIZE_ChARxBuffer - 1]) //Check if end of buffer
ChARxBufWrPtr = ChARxBuffer; //Wrap pointer to beginning
MBChAData.MbBtRcdSize++;

if(timer_run==0)
{
ui810msCounter = CHA_RX_TIMEOUT;
timer_run=1;

}
RestartMucTimer();


}

//here
//baudrate = 9600
//parity = even 1 stop bits
void vfnInit_SCI0(void)
{
UCA0CTL0 = ucarrParity[strPCProgammed.ucModbusParity];
UCA0CTL1 = 0X80;
UCA0BR0 = ucarrBRLow[strPCProgammed.ucModbusBaudRate];
UCA0BR1 = ucarrBRhigh[strPCProgammed.ucModbusBaudRate];
//UCA0MCTL = UCBRS2 + UCBRS0; // Modulation UCBRSx = 5
UCA0CTL1 &= ~UCSWRST;
UCA0STAT = 0x00;
ucPtrPCComm_Rx = (unsigned char *)&ucarrRxBuf[0];
MB_CHA_DIR_RX_ENABLE();
PC_COMM_ENABLE_RX_INTR();

}

  • Hello Mallikarjuna,

    please take a look at our application report on debugging serial communications with MSP430. You should find a lot of useful information and guidance on how to identify the root cause for the communication issues you're observing.

    Best regards

    Peter

  • hi Peter,

    I have gone through the document as such there is no specific solution mentioned.

    please provide some more information if available. 

  • Hello Mallikarjuna,

    the intention of the document is, to provide you guidance on how to debug communication issues with the MSP430. It is not about providing a dedicated solution, as with all the variety of possible settings, setups and use cases it is not possible to provide a ready to use solution for all of them.

    Please follow the recommendations to identify the root cause for the issues you're specifically experiencing. Once you have managed to isolate the problem to a lower level, we can of course give you further guidance on debugging.

    Best regards

    Peter

  • hi Peter,

    Sure, we are trying out by doing different  communication setting , i will update if any improvement or issues.

  • HI Peter,

    As we did the further analysis by adding the error flag in the communication setting 

    we found the overrun error flag during the receiving the byte.

    now we have fixed this (overrun) issue by removing the some of the software which is in the 1millisecond ISR to main while loop.

     

  • Hi Mallikarjuna,

    many thanks for the update. Understood. Yes, it is always good practice to keep the code in the ISRs for the same reason as short a possible, to avoid missing bytes or other interrupts, when taking it in general.

    I am not sure, what CPU frequency you're using. Maybe that would be another option to increase the processing power and get some more headroom. Of course this comes with higher current levels. Still reducing the code and latency of ISRs should be done in parallel.

    In any case it sounds you're on good path. Please let me know, whether you still need support on this, and if not, please close this thread. Many thanks in advance.

    Best regards

    Peter

**Attention** This is a public forum