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.

TMS570LS0432: SCI Tx and rx in interrupt mode

Part Number: TMS570LS0432

Hello,

i am using TMS570LS0432 . I want  communicate SCI in interrupt mode but yet not achieved success It works well in polling mode. Is there any sample code and processor available for sci interrupt mode.

If yes please provide us .waiting for your positive reply..

Thanks in advance...

  • Hello,

    1. Enable the SCI TX and RX INT under SCI Global in HALCoGen
    2. Enable the SCI interrupt (channel 13 and Channel 27) under VIM channel 0-31
    3. Check VIM RAM to make sure that the right ISRs are assigned to channel 13 and channel 27: linHighLevelInterrupt, and linLowLevelInterrupt
    4. Generate code, and inport the HALCoGen to CCS project
    5. Enable irq interrupt in your main():_enable_IRQ();
    6. Initialize SCI: sicInit(), and TX/RX data through SCI
    7. You should get INT whenever you type character in TeraTerm terminal

    8. The ISR is in sci.c

  • Hello,

    I have done upto 6 step and .I want to continuous transmit data from micro-controller side. i wrote the below code for transmitting and receiving data after executing this i am continuous receiving data at teraterm terminal but when i transmit from teraterm then i am not receiving valid data at micro-controller side.please suggest i  am wrong in writing below code.

    int main(void)

    {

    _enable_IRQ();

      sciInit();

      memset(Tx_buff, 0, sizeof(Tx_buff));
      sprintf(Tx_buff,"\r\nSPEED_EST_RPM : %d\0",speed_est_rpm);
      sciSend(scilinREG,sizeof(Tx_buff),(uint8*)Tx_buff);
       sciReceive(scilinREG, 1, ReceivedChar);

    while(1);

    }

    void sciNotification(sciBASE_t *sci, uint32 flags)
    {

           memset(Tx_buff, 0, sizeof(Tx_buff));
           sprintf(Tx_buff,"\r\nSPEED_EST_RPM : %d\0",speed_est_rpm);
           sciSend(scilinREG,sizeof(Tx_buff),(uint8*)Tx_buff);

           sciReceive(scilinREG, 1, &ReceivedChar[0]);

    }

  • Hi Sameer,

    1. Disable the TX interrupt for testing the RX int in your current code
    or
    2. comment out or remove the sciSend(...) from your sciNotification(..)

  • Thank you for reply.

    If i disable TX INT and comment out scisend() in sci notification then i am able to transmit data only one time to terminaland receive data on controller whenever typed in terminal.but i want to transmitt data continuously to terminaland receive data on controller side only when i type in terminal.so how can do this.

    For continuous transmission i have enabled  rti interrupt of 100ms and for every 1 second i am transmitting the data  to terminal the transmitting data is nothing but data received from the terminal.

    Here is my code

    int main(void)

    {

    _enable_IRQ();

      sciInit();

      rtiinit();

    rtiStartCounter(rtiCOUNTER_BLOCK0); 

    sciReceive(scilinREG, 1, &ReceivedChar[0]);

    while(1)

    {

      if(count==10)
            {
                memset(Tx_buff, 0, sizeof(Tx_buff));
                sprintf(Tx_buff,"\r\nSPEED_EST_RPM : %d\0",ReceivedChar[0]);

                sciSend(scilinREG,strlen(Tx_buff),(uint8*)Tx_buff);
                gioToggleBit(gioPORTA,  1);
                count=0;
            }

    }

    }

    /*******************END of Main code******************/

    void sciNotification(sciBASE_t *sci, uint32 flags)
    {

           sciReceive(scilinREG, 1, &ReceivedChar[0]);

    }

    void rtiNotification(uint32_t notification)
    {
        if(notification==rtiNOTIFICATION_COMPARE0)
        {
            count++;

        }

    }

    After that every time when i type something in terminal receive data  in microcontroller correctly but after that it is showing garbage data until i am sending the byte from terminal.

    is this any wrong in code..

    waiting for your reply..

  • Hi

    Please enable RTI interrupt before starting the RTI:

       _enable_IRQ();

       rtiInit();

       rtiEnableNotification(rtiNOTIFICATION_COMPARE0);

       rtiStartCounter(rtiCOUNTER_BLOCK0);

       sciReceive(scilinREG, 1, &ReceivedChar[0]);

       while(1)

       {...}

     

  • thank you ..

    problem solved