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:
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”
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!
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! 😉