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

BLE demo with UART not working

Hi there,

I was able to successfully compile and run the "BLE HIDS keyboard" example on my nRF52832 using Segger SES 5.44

My Nordic chip is connected via UART Rx/Tx to another MSP430 and I like to send some data bytes from the MSP to the Nordic chip. So I checked the various UART examples in the nRF5 SDK 17.0.2 (which we want to use) and added some Uart code to the HIDS keyboard example. My hardware is similar to pca10040, but its not identical. I also have a Led connected to Port P0.17 so I can see the blinking code while BLE advertising is active etc

Withoutn Uart code , the Nordic chip starts, I can see the Led blinking and then the device is advertising and I can connect my smartphone - for diagnostics I'm using the "nRF connect" app which works well.

With Uart, my main() routine includes a call to a uart_init() routine which basically calls APP_UART_FIFO_INIT() - without this call, the Nordic chip works well as explained above, when calling this APP_UART_FIFO_INIT(), the Led goes solid on and I'm not able to connect to the device in any way.

Comm Params are like this

static void uart_init(void)
{
    uint32_t  err_code;
    app_uart_comm_params_t const comm_params =
    {
        .rx_pin_no    = RX_PIN_NUMBER,
        .tx_pin_no    = TX_PIN_NUMBER,
        .rts_pin_no   = RTS_PIN_NUMBER,
        .cts_pin_no   = CTS_PIN_NUMBER,
        .flow_control = APP_UART_FLOW_CONTROL_DISABLED,
        .use_parity   = false,
        .baud_rate    = NRF_UART_BAUDRATE_57600
    };

    if (1)
    {
      APP_UART_FIFO_INIT(&comm_params,
                         UART_RX_BUF_SIZE,
                         UART_TX_BUF_SIZE,
                         uart_event_handle,
                         APP_IRQ_PRIORITY_HIGH,
                         err_code);
    }
}

I checked, as good as possible, the settings in sdk_config.h but I can't find out why the device is not working with Uart.

Any idea what might be missing ?

thanks, Matthias

Parents
  • I build with Debug and I also switched to another Hardware board (UTO-NBL-42a) - its a small breakout board - to eliminate any possible issue with the MSP430

    Without "uart_init" the debug terminal output is like this, just fine

    Starting..
    <info> app_timer: RTC: initialized.
    <info> app:     m_whitelist_peer_cnt 2, MAX_PEERS_WLIST 8
    <info> app: Fast advertising with whitelist.
    <info> app: Slow advertising with whitelist.

    With "uart_init" is see this

    Starting..
    UartInit
    <info> app_timer: RTC: initialized.
    <info> app_timer: RTC: initialized.
    <info> app:     m_whitelist_peer_cnt 2, MAX_PEERS_WLIST 8
    <info> app: Fast advertising with whitelist.
    <error> app: ERROR 4 [NRF_ERROR_NO_MEM] at F:\Keil\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:181
    PC at: 0x00028427

    After the first "RTC initialized" it takes approx 20 secs, then I see the 2nd "RTC initialised" and the error in app_error_fault_handler() with ID=0x4001

    APP_UART_FIFO_INIT returns =8, but according to some other posts, I assume this is ok

    I added a 10 kOhm resistor to Uart RX (P0.08) but see no change either.

  • sorry - I meant show us the C source code.

Reply Children
Related