How I got fooled by Nordic’s app_uart_init

The Nordic nRF51822 SDK supports two serial communication modes: raw and fifo.

There are two macros used to initialize each mode:

APP_UART_INIT(P_COMM_PARAMS, EVT_HANDLER, IRQ_PRIO, ERR_CODE)

APP_UART_FIFO_INIT(P_COMM_PARAMS, RX_BUF_SIZE, TX_BUF_SIZE, EVT_HANDLER, IRQ_PRIO, ERR_CODE)

Once initialized you can use “app_uart_put()” to send a character and “app_uart_get()” to get a character.

If you initialize with APP_UART_FIFO_INIT() macro, but link your application to app_uart.c instead of app_uart_fifo.c everything will compile fine.
You could send some text using app_uart_put in your main() function, but when you get some BLE data received event and try to use it… you will get troubles!

Only the first character will be sent to UART, nothing else…

I spent much time trying to figure-out why it was not working, finally I found someone with same problem and he give a hint:

https://devzone.nordicsemi.com/question/20383/sending-via-uart/

Just linking to app_uart_fifo.c instead of app_uart.c fixed the issue!

2 thoughts on “How I got fooled by Nordic’s app_uart_init

  1. Hey. I have tried everything with regards to the Uart with my nrf52. I spoke to the guys at nordic with very little help. Tried retarget.c and what ever was suggested.

    You the lucky one to get it working!

  2. Hi Naasik,
    so, didn’t you get it working?

    Is your issue similar to my nRF51 issue? Currently we are porting NuttX RTOS to nRF52, then we will have more freedom and could have more control of it. It will be an alternative to SoftDevice soon! 😉

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s