Because of the Thanksgiving holiday in the U.S., TI E2E™ design support forum responses may be delayed the week of November 23.

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/EK-TM4C123GXL: Other microcontrollers forum

Part Number: EK-TM4C123GXL

Tool/software: Code Composer Studio

Hi there,

I want to communicate the TIVA with Matlab by UART. The data sending by Matlab to TIVA is fine. However, when i try to scan the data in Matlab sent from TIVA it does not work properly. Probably because the Matlab only receive byte by byte. So I tried to slip the values in char and then concatanate them on matlab again. It did not work also as I use a terminal to see data sent and TIVA sends variables as [xx] format. For example, if I send a variable char '"x" equal to 1, it sends [01] instead. I printed the situation for better explaining and the pertinent lines of code are showing bellow also for both:



TIVA code

                    aux = UARTCharGet(UART0_BASE);
                    if(aux=='M')
                    {
                        //while(UARTCharsAvail(UART0_BASE))
                        //{
                        UARTCharPutNonBlocking(UART0_BASE, 'canopy_shape');
                        UARTCharPut(UART0_BASE,canopy_shape);
                        UARTCharPut(UART0_BASE,'s');
                        UARTCharPut(UART0_BASE,area_vetor[0]);
                        UARTCharPut(UART0_BASE,area_vetor[1]);
                        UARTCharPut(UART0_BASE,area_vetor[2]);
                        UARTCharPut(UART0_BASE,area_vetor[3]);
                        UARTCharPut(UART0_BASE,area_vetor[4]);
                        UARTCharPut(UART0_BASE,'s');
                        UARTCharPut(UART0_BASE,height_vetor[0]);
                        UARTCharPut(UART0_BASE,height_vetor[1]);
                        UARTCharPut(UART0_BASE,height_vetor[2]);
                        UARTCharPut(UART0_BASE,'s');
                        flag_menu=7;
                        GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0x00);
                        //} //while
                    }

You guys always get the problem and solve it very quickly here. Thanks for that. Hope it repeats this time :)
Best regards

  • The functions UARTCharPut(), and UARTCharPutNonBlocking() send an 8-bit value to the UART. If you want to send the string " canopy_shape", copy the files uartstdio.c and uartstdio.h to your project and use the function UARTprintf(). It is used like printf(), but does not support outputting floating point numbers. The same is true if you want to change values from there native form to ASCII. For example:

        UARTPrintf(" canopy_shape %d",canopy_shape);

    This function will print the string " canopy_shape " followed by the ASCII decimal value in the variable canopy_shape. See the documentation for the UART Standard IO functions in the TivaWare docs directory. See chapter 21 of SW-TM4C-UTILS-UG-2.2.0.295.pdf. Look at the example at the end of the chapter as you will need to call UARTStdioConfig() before calling UARTprintf().

    C:\ti\TivaWare_C_Series-2.2.0.295\docs\ SW-TM4C-UTILS-UG-2.2.0.295.pdf

     

  • yep, done. I completely forgot about this way to send it.
    Thank you so much