This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Strange UART behaviour

Hello fellow devlopers.

I am experienceing very odd behaviour from the UART peripheral. I am trying to ouput a uint8_t[48] array from the UART termainl. I am using this simple code

while (i <48) 
{
uint8_t UART_Val;
UART_Val = Meta_data[i];
NRF_UART0->TXD = UART_Val;
while (NRF_UART0->EVENTS_TXDRDY != 1)
{
    // Wait for TXD data to be sent.
}
NRF_UART0->EVENTS_TXDRDY = 0;
i = i+1;
}

ofcourse I have prviously defined i as a 0 integer. The thing is, I only get the first 2 or three elements of the array to show up when I run the code. More stragnly, If I debugg the device to see what is wrong, all elements end up showing up. I think this is a case of synchonisation. Does anybody have a comment to add to this. Thanks in Advance.

Parents
  • Hi. What program are you using to receive the uart string? If the program expects a text string it will for example terminate on 0x00 characters or '\n' (newline) characters. See if you can print the data as raw values on the receiver end. You can also try to vary the contents of the Meta_data array, to see if this has any effect. Does the while loop finish or does it crash after 2-3 iterations?

Reply
  • Hi. What program are you using to receive the uart string? If the program expects a text string it will for example terminate on 0x00 characters or '\n' (newline) characters. See if you can print the data as raw values on the receiver end. You can also try to vary the contents of the Meta_data array, to see if this has any effect. Does the while loop finish or does it crash after 2-3 iterations?

Children
No Data
Related