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

uart on NRF51822

Hello,

I have an development kit NRF51 and wrote a code for it which uses uart, ble advertising and ble scan. It works pretty well on the kit.

The problem is when I try to put the same code on a custom board with an NRF51822. I have already worked with other code for this custom board like ble_app_beacon and it worked fine, but with this code I'm working I got many problems. It doesn't work at all and on the custom board and if I comment all uart things it seems to run very very slow.

So I tried to get just the uart to work first using the code bellow but it doesn't work, it just throws garbage at the terminal. It doesn't work with the custom board but with the development kit it works perfectly.

I'm using SDK 10, S130, gcc and eclipse. My board has a crystal of 16MHz.

Does anyone knows what is the problem?

/**
 * @brief Function for application main entry.
 */
 
int main(void)
{

    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, NULL);
    SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, NULL);
    uart_init();
    app_uart_putstring((uint8_t *)"\n\r12345 Test!");

    // Enter main loop.
    for (;; )
    {
    	power_manage();
    }
}
Parents
  • Thank you all, it's solved now.

    When I compiled with one of the calibrated with RC options I also changed the second parameter of the function APP_TIMER_INIT to true and I got those warnings:

    In function 'ble_stack_init': warning: passing argument 4 of 'softdevice_handler_init' makes pointer from integer without a cast SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_SYNTH_250_PPM, true)

    softdevice_handler.h:117:10: note: expected 'softdevice_evt_schedule_func_t' but argument is of type 'int' uint32_t softdevice_handler_init(nrf_clock_lfclksrc_t clock_source,

    So I changed the parameter to NULL and it worked fine. Thank you all.

Reply
  • Thank you all, it's solved now.

    When I compiled with one of the calibrated with RC options I also changed the second parameter of the function APP_TIMER_INIT to true and I got those warnings:

    In function 'ble_stack_init': warning: passing argument 4 of 'softdevice_handler_init' makes pointer from integer without a cast SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_SYNTH_250_PPM, true)

    softdevice_handler.h:117:10: note: expected 'softdevice_evt_schedule_func_t' but argument is of type 'int' uint32_t softdevice_handler_init(nrf_clock_lfclksrc_t clock_source,

    So I changed the parameter to NULL and it worked fine. Thank you all.

Children
No Data
Related