6 years, 4 months ago.

Nrf51822 app_uart_init issue

Hey there,

Hopefully this issue is pretty straightforward, but I suspect it may be something more devilish. I am trying to set up an Nrf51822 as a radio go-between with another MCU and a phone. I am starting with the BLE_LoopbackUART project and can successfully connect to a smartphone. I am using this module - https://developer.mbed.org/platforms/Nordic-nRF51-Dongle/

Now I am trying to set up the hardware uart so that I can start moving the data through to the other MCU, but I'm getting the following error when calling app_uart_init :

undefined symbol app_uart_init ( const app_uart_comm_params_t*, app_uart_buffers_t*, void(*)(app_uart_evt_t*), app_irq_priority_t, unsigned short*)

relevant code chunk

#include "app_uart.h"
....

void uart_evt_handler( app_uart_evt_t * p_app_uart_event){
    
}

void init_uart_module(){
    //configure our UART module settings
    app_uart_comm_params_t uart_module;
    uart_module.rx_pin_no = 20;
    uart_module.tx_pin_no = 19; 
    uart_module.rts_pin_no = 18;
    uart_module.cts_pin_no = 17;
    uart_module.flow_control = (app_uart_flow_control_t)APP_UART_FLOW_CONTROL_LOW_POWER;
    uart_module.use_parity = false;
    uart_module.baud_rate = 1000000; 
    
    uint32_t  err_code_;
    app_irq_priority_t priority_ = APP_IRQ_PRIORITY_HIGH; 
    //  APP_UART_FIFO_INIT( &uart_module, 100, 100, uart_evt_handler , priority_, err_code_) ;  //Have an issue using this Macro, or calling the function directly
    uint16_t uart_id = 0;                                                                 
    app_uart_init(&uart_module, NULL, uart_evt_handler , priority_, &uart_id);  
}

From what I can tell from the error, there are 2 problems :

1 - The compiler thinks the third input paramater is of the wrong type - void(*)(app_uart_evt_t*) but I have tried casting uart_evt_handler, and I am using the same formatting and code as is used in the nordic example code

2 - It thinks that the last input parameter is of type unsigned short*, though it should be of type uint16_t *. Again explicit casting doesn't fix this.

Any thoughts on what is going on here?

Thanks, Steve

Where should app_uart_init be defined?

posted by Martin Kojtal 26 May 2015

in app_uart.h , which is included, and which is also where the app_uart_comm_params_t struct is defined, as well as some other things in use, and that has no issues.

posted by Stephen Hibbs 26 May 2015

Hi Steve,

I am having the same problem. If you have solved this issue, please help me for the same.

Thanks, Akshat

posted by Kishore Chilakala 05 Aug 2015

Nope, after much wasted time i just moved to using the Serial library, which works ok.

posted by Stephen Hibbs 05 Aug 2015

thanks for your response, I am doing the same thing

posted by Kishore Chilakala 06 Aug 2015
Be the first to answer this question.