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

using printf gives me " <error> app: SOFTDEVICE: ASSERTION FAILED "

I am currently working in the " ble_thread_dyn_mtd_coap_cli" multi protocol example.

Whenever I call printfmy program crashes. I think it has to do with the ble_nus service that is added in the project. So I found this link https://devzone.nordicsemi.com/question/14089/wireless-printf-using-ble-uart/ and put retarget in sdk_config.h to 0 but it still crashes on printf probably an easy solution but if anyone could help would be great.

Thanks !

  • Don't quite understand but changing the coap_init function below from client to server seems to have fixed the problem..

    static void thread_coap_init(void)
    {
        thread_coap_configuration_t thread_coap_configuration =
        {
            .coap_server_enabled                = true,
            .coap_client_enabled                = false,
            .coap_cloud_enabled                 = false,
            .configurable_led_blinking_enabled  = false,
        };
    
        thread_coap_utils_init(&thread_coap_configuration);
    }
    
  • Hi,

    I'm not sure what the link you posted have to do with the issue, but I think this have to do with app_uart not being initialized. The stdio retarget layer in the SDK use app_uart functions to direct the stdio functions/printf to UART. If app_uart is not initialized, it will generate an error code, and you will most likely end up in the error handler. Please use this debug method to see if/what error codes are returned.

    The example you are referring use NRF_LOG functions to send data to RTT instead of UART. The default UART interface on the nRF52840 PDK is used by the CLI interface in OpenThread stack. It is possible to setup app_uart/retarget functions to send the data on UART interface, but this will require you to either drop the CLI interface, or use the second UARTE peripheral (UARTE1) on the nRF52840 chip and on different pins. You will then need a UART/serial to USB adapter to be able to read the UART output on your computer.

    Best regards,

    Jørgen

Related