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

app_ble_uart example not initializing BLE on nRF52DK PCA10040 SDKv16 and S132 soft device

Hi

I am trying to get the ble_app_uart to run on my nRF52DK with the nRF52832 on board. I am using SDK version 16 and SoftDevice version 132.

When compile and download the program, i do not see it advertising as it is not visible in the scanned device list on the nRF Connect app on my iPad.

Upon debugging, I find that during initialization in main(), the program seems to run into an error and goes to the app_error_weak() function and stays there.

The call stack shows that it arrived there from the following function - APP_ERROR_CHECK(err_code) after bsp_init() funct

<code>

static void buttons_leds_init(bool * p_erase_bonds)
{
    bsp_event_t startup_event;

    uint32_t err_code = bsp_init(BSP_INIT_LEDS | BSP_INIT_BUTTONS, bsp_event_handler);
    APP_ERROR_CHECK(err_code);

    err_code = bsp_btn_ble_init(NULL, &startup_event);
    APP_ERROR_CHECK(err_code);

    *p_erase_bonds = (startup_event == BSP_EVENT_CLEAR_BONDING_DATA);
}
</code>

Since there were no logging calls in place in the code until this point, there was no information on the Debug terminal.  I will put in some logging calls to indicate the status of the execution and post it here soon.

PS: To confirm if the hardware is ok, I downloaded the LED_blinky example and it works fine - i am able to see the blinky device on the nRF LED_Blinky app on my iPad and communicate with it.

So it appears the problem is happening only with this example, which sounds strange. I haven't made any changes yet, just using the default example code. 

Regards

Sreenivasa Chary

Parents
  • I also erased the kit and reloaded the software - both the soft device and the app, but still the same issue is seen.

  • Hi Sreenivasa, 

    After loading images, did you press   again to run? What is the log you see in the Debug Terminal window? Did you see LED1 blinking  (BSP_INDICATE_CONNECTED)? If not, Could you flash the image with nRF Connect Programmer or Command Line Tools with the following commands:

    nrfjprog --family NRF52 --program s132_nrf52_7.0.1_softdevice.hex --chiperase --verify
    C:\Users\amhs\Downloads\nRF5_SDK_16.0.0_98a08e2\examples\ble_peripheral\ble_app_uart\hex
    nrfjprog --family NRF52 --program ble_app_uart_pca10040_s132.hex --sectorerase --verify
    nrfjprog -r

    Did you see LED1 blinking (BSP_INDICATE_CONNECTED)?

    -Amanda H.

  • Hi Amanda,

    I found the cause of the issue, in app_button.c, in function app_button_init(),

    there is this call ,

     err_code = nrf_drv_gpiote_in_init(p_btn->pin_no, &config, gpiote_event_handler);

    which is in file nrfx_gpiote.c

    There, in the pin/channel allocation logic, for Pin number = 13 (0x0d) the code hits line 557:

    err_code = NRFX_ERROR_NO_MEM;

    Therefore, when it returns with this error (code 0x04), the next line in app_button_init() 

    line 298 :

    VERIFY_SUCCESS(err_code);

    is failing. And the system is going to NRF_BREAKPOINT_CND in app_error_weak.c

    I saw in another post, a similar report by some one else, but he was able to get the debug log where it suggested the solution - to modify the memory allocation. However, in my case i do not see any such log.

    What should i modify to overcome this condition?

    Regards

    Chary BS

  • Hi Sreenivasa, 

    SChary said:
    Therefore, when it returns with this error (code 0x04), the next line in app_button_init() 

    Try Sigurd's suggestion in this post

    SChary said:
    However, in my case i do not see any such log.

    You can try adding #define NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED 0 to your sdk_config.h

    If you want to get the debug log, you should compile with debug mode. 

    -Amanda H.

     

     

  • Hi Amanda,

    Thank you for the pointers. I have increased the two parameters as mentioned in Sigurd's post and it solves the problem, i can now see the LED blinking in advertising state.

    However, i am still not getting any DEBUG logs even after setting the flag you mentioned. It doesn't hinder my work in any way, but it would be good to have these logs since i plan to use the UART for communicating with an external peripheral.  Kindly let me know if any other settings need to be made to see the logs - even the basic log - "UART Started" and "Debug logging for UART over RTT started", which i can see in main.c are not coming on the debug terminal.

    Regards

    Sreenivasa Chary

  • Hi Amanda,

    I am able to receive data from the nRFConnect app onto the board and see it on the laptop's serial port connected to the Tx and Rx pins but the redirection to the RTT backend doesn't seem to be happening.

    Also, the data that i am typing on the console is not being received by the app. Do i have to enable some settings for that?

    Regards

    Chary BS

  • Hi Amanda

    I am just not able to figure out how to get the debug output on the RTT and use the UART normally...:(, can you help me out ?

    I need this functionality to debug the code while using the UART to communicate with my peripheral .

    Regards

    Chary BS

Reply Children
Related