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
  • mhm..I am just trying to read uint8_t data. There is simple funciton provided in the UART library found in the SDK that can do this which am using. The thing, I am unable to tell if the loop executes completely or not because when I try to debug the program, everything runs perfectly. Am thinking this is because when your are debugging you are giving good time for the handshake synchonisation between the PC and the nordic chip. I have tried to add delay but could not get it to work. Strange indeed

Reply
  • mhm..I am just trying to read uint8_t data. There is simple funciton provided in the UART library found in the SDK that can do this which am using. The thing, I am unable to tell if the loop executes completely or not because when I try to debug the program, everything runs perfectly. Am thinking this is because when your are debugging you are giving good time for the handshake synchonisation between the PC and the nordic chip. I have tried to add delay but could not get it to work. Strange indeed

Children
No Data
Related