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

app_uart getting started

I've modified the simple_uart example to use app_uart instead but I cannot get any data transmitting. I know the connections are correct because it works fine under normal simple_uart testing.

Here is my init code which also sends a character and a string. When I debug it always makes it through to NRF_SUCCESS case, but never transmits 'T'

uart_buffers.rx_buf = rx_buffer;
uart_buffers.rx_buf_size = sizeof(rx_buffer);
uart_buffers.tx_buf = tx_buffer;
uart_buffers.tx_buf_size = sizeof(tx_buffer);

comm_params.rx_pin_no = rxd_pin_number;
comm_params.tx_pin_no = txd_pin_number;
comm_params.cts_pin_no = cts_pin_number;
comm_params.rts_pin_no = rts_pin_number;
comm_params.baud_rate = 9600;
comm_params.use_parity = false;
comm_params.flow_control = APP_UART_FLOW_CONTROL_DISABLED;

uint32_t res = app_uart_init(&comm_params, &uart_buffers, &app_uart_handler, APP_IRQ_PRIORITY_HIGH, comm_uuid);

if(res == NRF_SUCCESS)
{
	app_uart_put('T');
	simple_uart_putstring("Test 1\r\n");
	return;
}
Parents
  • Having both simple_uart and app_uart in the same example will most likely mess up the actual configuration of the UART peripheral, and should therefore not be done.

    I've attached a quick example I made right now that shows how app_uart can be used.

    app_uart_example.zip

  • Ole, I have not been able to get this example on app_uart working perfectly using a either 51822/51422 chips with SDK 6.1. It can be fixed by putting a small delay (20us) between sending characters, if not the application goes to error (NRF_ERROR_NO_MEM). Currently I am testing this against a PC using Putty with baud rate 460800, when I used baud 38400 I needed about 300us delay to keep the program from crashing. Any suggestions ?

    void putstring(char * s) { uint32_t err_code;

    uint8_t len = strlen((char *) s);
    for (uint8_t i = 0; i < len; i++)
    {
        err_code = app_uart_put(s[i]);
        nrf_delay_us(20);
        APP_ERROR_CHECK(err_code);
    }
    

    }

Reply
  • Ole, I have not been able to get this example on app_uart working perfectly using a either 51822/51422 chips with SDK 6.1. It can be fixed by putting a small delay (20us) between sending characters, if not the application goes to error (NRF_ERROR_NO_MEM). Currently I am testing this against a PC using Putty with baud rate 460800, when I used baud 38400 I needed about 300us delay to keep the program from crashing. Any suggestions ?

    void putstring(char * s) { uint32_t err_code;

    uint8_t len = strlen((char *) s);
    for (uint8_t i = 0; i < len; i++)
    {
        err_code = app_uart_put(s[i]);
        nrf_delay_us(20);
        APP_ERROR_CHECK(err_code);
    }
    

    }

Children
No Data
Related