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

UART resets the chip when sending new line

Hi,

I want to communicate with other chip on UART. the chip on other end requires AT(CR,LF) command to start communication over UART.

UART is setup correctly, but it reset the NRF51 chip following is snippet of my code for sending data over UART

uint8_t p_data[4] = {0x41, 0x54, 0x0d, 0x0a};

for (uint8_t i=0; i<4; i++) { while (app_uart_put(p_data[i]) != NRF_SUCCESS); }

It creates problem only when I try to put 0x0a(new line). otherwise it works ok.

Is there anything I can try to resolve this ???

Parents
  • Are you using the default SDK 11 UART example otherwise?? My main code looks like this, which seems to be working fine with optimization level 3:

    printf("\n\rStart: \n\r");
    
    uint8_t p_data[4] = {0x41, 0x54, 0x0d, 0x0a};
    
    for (uint8_t i=0; i<4; i++) { while (app_uart_put(p_data[i]) != NRF_SUCCESS); }
    for (uint8_t i=0; i<2; i++) { while (app_uart_put(p_data[i]) != NRF_SUCCESS); }
    	
    while (true) { }
    

    I can receive all the characters on the UART peer side. Perhaps it could help to see trace of the UART lines when this data is sent (RXD,TXD,RTS,CTS), perhaps that will provide some hints.

Reply
  • Are you using the default SDK 11 UART example otherwise?? My main code looks like this, which seems to be working fine with optimization level 3:

    printf("\n\rStart: \n\r");
    
    uint8_t p_data[4] = {0x41, 0x54, 0x0d, 0x0a};
    
    for (uint8_t i=0; i<4; i++) { while (app_uart_put(p_data[i]) != NRF_SUCCESS); }
    for (uint8_t i=0; i<2; i++) { while (app_uart_put(p_data[i]) != NRF_SUCCESS); }
    	
    while (true) { }
    

    I can receive all the characters on the UART peer side. Perhaps it could help to see trace of the UART lines when this data is sent (RXD,TXD,RTS,CTS), perhaps that will provide some hints.

Children
No Data
Related