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

Ble uart application wont run when just plugin supply

I have a ble_uart application which is working when I load it on the chip. But it will not automaticly run again if I unplug the supply and just plugin again. When I unplug the supply, then I have to run the application again on Keil.

But if I comment out uart_init(); then the application will automaticly run by plugin the supply.

This behavoir will only appear on the ble_example. The Uart example without SD will run automaticly by plugin even when uart is initialized.

Why the ble_uart application wont run automaticly when I plugin the supply?

Uart_init seems to be the problem. But why it isnt a problem when I run it from Keil?

I cant debug this, because when i start the debugger, then I have to run the program from keil, and then it will always run.

We use a Raytac module. This module has no external LFKC. Does Ble_Uart work without LFKC?

Here my UART initialization

static void uart_init(void)
{
    uint32_t                     err_code;
    const app_uart_comm_params_t comm_params =
    {
        RX_PIN_NUMBER,
        TX_PIN_NUMBER,
        RTS_PIN_NUMBER,
        CTS_PIN_NUMBER,
        APP_UART_FLOW_CONTROL_DISABLED,
        false,
        UART_BAUDRATE_BAUDRATE_Baud19200					
    };

    APP_UART_FIFO_INIT( &comm_params,
                       UART_RX_BUF_SIZE,
                       UART_TX_BUF_SIZE,
                       uart_event_handle,
                       APP_IRQ_PRIORITY_LOW,
                       err_code);
    APP_ERROR_CHECK(err_code);
}
  • The device may be powered through the UART pins when you unplug the power, so when you plugin the supply again the device have not been powered off and will hence not run the startup code.

    It is weird however that this is only the case when using SD.

    Is the behaviour the same even though nothing is connected on the other side of the UART? How do you see that the code is not running (not advertising, LEDs not blinking)?

  • This is not possible, because on the other side is a distance sensor. And the sensor will also have no power when I unplug the supply.I tested it with a LED(which should blink). Yes, the behaviour is the same if the sensor is not connected to the module.

  • Can you check if the application starts at all or where in the application it halts? Turn on the LED at different places to see where it stops.

  • I wont hit the error handler. So I dont really find where it halts. It will exactly in uart_init function stop. After the uart_init function I dont know where it goes

  • Do you have DEBUG defined in your preprocessor symbols? Or else the error handler will not be entered, see here.

1 2 3