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.

TMS320F28379D: Sending SCI data to MATLAB, can't send more than 2 numbers in a row (trying to send array of ints to MATLAB

Part Number: TMS320F28379D

Hello hope you are well,

I am trying to set up a communications link between my TMS320 F28379D and MATLAB, I've set up an SCI interrupt that triggers whenever the microcontroller receives anything from the serial port linked to MATLAB. I am trying to send data from the following array to MATLAB.

Uint16  array_c[4]  = {10, 11, 12, 13};

Below is the code I am using for my interrupt:

interrupt void sci_test_isr(void)
{
    GpioDataRegs.GPATOGGLE.bit.GPIO31 = 1;
    flag_clearer = SciaRegs.SCIRXBUF.all;
    interrupt_counter++;

    if(flag_clearer == 0x61);
    {
        i = 0;
        for(i = 0; i < tx_message_length; i++)
        {
            tx_msg_buffer[i] = array_b[i];
            scia_xmit(tx_msg_buffer[i]);
        }

    }

    PieCtrlRegs.PIEACK.all = PIEACK_GROUP9;

}

I've set up a serial object in MATLAB that reads the serial line. If my tx_message length is 2, I get the first two numbers [10,11] read in MATLAB - this is the correct message for a length of 2.

However, as soon as my message length goes beyond 2 I start getting errors. For example when my message length is 4, I get [10,13] whereas it should be [10,11,12,13].  I tried sending [1,2,3,4,5,6,7,8] as well, getting [1,8] on the MATLAB side. I get the following error in MATLAB when this happens:

'Warning: The specified amount of data was not returned within the Timeout period for 'read'. 'serialport' unable to read all requested data. For more information on possible reasons, see serialport Read Warnings. '

On my transmit line, it seems as though all the message values are being loaded into the transmit buffer. However, I don't read the correct data on MATLAB.

A few extra details: I am not using the FIFO enhancements, and I am using the TMS320 Launchpad, where the SCI A line has some sort of a relationship with the USB line used for programming the controller. 

How can I fix this?

  • Hi Eric,

    I tried sending [1,2,3,4,5,6,7,8] as well, getting [1,8] on the MATLAB side. I get the following error in MATLAB when this happens:

    'Warning: The specified amount of data was not returned within the Timeout period for 'read'. 'serialport' unable to read all requested data. For more information on possible reasons, see serialport Read Warnings. '

    Can you please reach out to the Mathworks team via the Mathworks forum? We don't support their tools on our forum but they should be able to help you.

    Best Regards,

    Marlyn