UART Data Transmission

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi:

   

Right now with my CY8CKIT-049-42xx, I am trying to see how fast can be the transmission of an array of uint8,  so I am using a TCPWM in a Timer configuration just to use the its interruption service routine so send an array of 40 elements with the help of  UART v3.0 element. Because of the need to send the data to the computer as fast as possible, I have configured the UART to 115200 bps (the max. speed of the PC) and TX buffer size of 256 Bytes. I am using putty to analyze the received data, and it work fine when I use transmission periods equal or longer than 800 milliseconds.

   

This is weird isn't it?

   

I have configured the Baud Rate  to 115200 bps and further I am using a large TX Buffer.  Theoretically I can send 11520 bytes in 1 second (This knowing that I am sending  the start bit, the info byte and stop bit).

   

I have check my ISR, but I don´t find any mistake...

   

uint8_t arr2[]= {97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,97,98,99,100,101,102,103,104};

   

CY_ISR(timer_isr)

   

{

   

    uint32 source;

   

    source = Timer_GetInterruptSourceMasked();         

   

    //Sending the data

   

    LED_1_Write(!LED_1_Read());                        //the change of the led state is an indicator of the begin of the array transmission

   

    UART_SpiUartPutArray(arr2,sizeof(arr2));

   

    Timer_ClearInterrupt(source);

   

}

   

I would appreciate any help or advice in this matter, because I really need a faster transmission.

   

Greetings.

   

Martín

   

P.S. I am attachind the UART and Timer configuration as a PNG.

0 Likes
4 Replies
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

Try to move code from ISR section to main loop like this:

   

volatile CYBIT timer_isr_flag = 0;

   

CY_ISR(timer_isr)

   

{

   

    uint32 source;

   

    source = Timer_GetInterruptSourceMasked();

   

    timer_isr_flag = 1;       

   

    Timer_ClearInterrupt(source);

   

}

   

 

   

main{

   

     ...

   

     for(;;){

   

          ...

   

          if (timer_isr_flag == 1) {

   

                timer_isr_flag = 0; //clear flag

   

               LED_1_Write(!LED_1_Read()); //led indicator                       

   

               UART_SpiUartPutArray(arr2,sizeof(arr2)); //Send data

   

          }

   

         ....

   

     }

   

}

0 Likes
Anonymous
Not applicable

Hi:

   

Thank you for the quick reply. Do you really think that the routine is too large?  I can try. But in my project I am planning to use main loop to poll the received data from the UART, so I don't think that this solution may work in the future. Nevertheless by making a change in the Baud Rate from 115200 bps to 19200 bps, the data can be transmitted using transmission periods no longer than 500 milliseconds. Any idea of the cause of this problem? one may think that with a greater Baud Rate the data would be transmitted faster and with efficiency.

   

I am going to keep working in this issue

   

Thank you 

   

Martin

0 Likes
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

just do it. once you report your result, I will show how-to UART_Rx part.

0 Likes
Anonymous
Not applicable

Well it didn't work at the beginning, but I increased the frequency of the TCPWM Clock it work quiet fine...

   

Never the less I am still concerned because I was wanting to use the main just for polling the data from the UART v3.0.

   

In which way affects using the main for loop instead using the interrupt service handler ?

   

Thank you for all your help

   

Martin

0 Likes