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.

TMS570LC4357: TMS570LC4357: missing data while receiving in ISR

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

dear e2e ,

 I am trying to communicate with GSM module and controller through UART(SCI).  I am sending data to module in polling and Receiving data in interrupt method. While receiving data, some data is missing.

I  configured UART to 115200 baud rate , 1 start bit , 1 stop bit and 8 bit data . I enable rx int mode in sci tab of halcogen

Below is the code for interrupt service routine.

extern unsigned char rx_str[500];

unsigned char rx_k = 0;

void sciNotification(sciBASE_t *sci, uint32 flags)
{

sciReceive(sciREG1, 50 , rx_str);
rx_k++;

}

Can you help me to resolve this problem?

  • Hi Chethan,

    sciReceive function takes care of receiving the data irrespective of whether it is configured in polling or interrupt mode. Do not call sciReceive from the notification function. It can be called from your application. The argument 'data' passed as argument to the function will be updated with the received data.
    The notification function is provided for users if they want to execute any additional code once the data is received. The SCI ISR provided as part of HALCoGen takes for of reading the data and updating the buffer.

    Thanks and Regards,
    Veena
  • Hi veena
    When configured sciRecieve in our application, some of the data is missing, so i'm using interrupt to receive the data so none of the data goes missing. But even in ISR some data is missing.

    Can you send a sample program to implement sciNotification ?
  • Hi Chethan,

    I did a simple SCI receive example. I enabled Rx interrupt in HALCoGen GUI. In main, I initialize SCI and call sciReceive function

    void main(void)
    {
    uint8 RxData[] = {0,0,0};

    _enable_IRQ();
    sciInit();

    sciReceive(sciREG1, 3, RxData);

    while(1);
    }

    I have left the sciNotification function empty. You should not call sciReceive inside sciNotification function. Once you have enabled the Rx interrupt and called sciRecieve function with proper parameters, SCI ISR takes care of reading the data as and when it is received. The ISR saves the received data in the buffer passed as the parameter to sciRecieve.

    In this example, when I call sciRecieve function, SCI ISR gets configured to listen to the Rx channel, read the data received and store them in the RxData buffer. The ISR finally branches to sciNotification function once all the 3 bytes has been received.

    Note that sciNotification is not the actual SCI Rx ISR. Rx ISR is implemented as part of HALCoGen drivers and the sciNotification is an application callback which is called once the configured number of data is received.

    Hope this answers your question.

    Thanks and Regards,
    Veena