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

BLE not visible after adding nrf_gpio and twi functions

Hi all, 

I am merging TWI code with BLE.  I started with the ble_app_uart example working perfectly, however, after adding TWI libs and drivers (nrf_twi; nrf_twim; twi_master), and a simple function to blink a led using gpio, the BLE device is not visible anymore. Any help please? 

My code is exactly the ble_app_uart + twi drivers + leds_init function, My leds_init function is bellow.

void leds_init(void)
{
     nrf_gpio_cfg_output(LED_PIN);

	//Turn on the LED to indicate initializing
	
	nrf_gpio_pin_clear(LED_PIN);
	nrf_delay_ms(500);
	// this will switch led on
	nrf_gpio_pin_set(LED_PIN);
	nrf_delay_ms(500);
	// this will switch  led off
	nrf_gpio_pin_clear(LED_PIN);
	nrf_delay_ms(500);
}

Thanks

  • Hi Amanda,

    Yeap. so i changed the value of LED from 17 to 11 on pca10040 file. Also, commented the call of bsp_btn_ble.h in the main file, and removed the group "Board support" that has the bsp files. 

    Board is still not discovered.  

    So i debugged again, and the board is resetting apparently when try to start the advertising. On ble_advertising.c , it enters on p_advertising->whitelist_reply_expected = false; (line 582) and then reset.

    // Fetch the whitelist.
        if ((p_advertising->evt_handler != NULL) &&
            (p_advertising->adv_mode_current == BLE_ADV_MODE_FAST || p_advertising->adv_mode_current == BLE_ADV_MODE_SLOW) &&
            (p_advertising->adv_modes_config.ble_adv_whitelist_enabled) &&
            (!p_advertising->whitelist_temporarily_disabled))
        {
            p_advertising->whitelist_in_use         = false;
            p_advertising->whitelist_reply_expected = true;
            p_advertising->evt_handler(BLE_ADV_EVT_WHITELIST_REQUEST);
        }
        else
        {
            p_advertising->whitelist_reply_expected = false;
        }

    ble_adv_whitelist_enabled has the value of 0x00 on my code, and so whitelist_temporarily_disabled

  • Hi, 

    Could you compile with the debug mode in the Segger and provide the debug log?

    -Amanda H.

  • Here is what appears on output 

    Preparing target for download
    Executing Reset script TargetInterface.resetAndStop()
    Reset: Halt core after reset via DEMCR.VC_CORERESET.
    Reset: Reset device via AIRCR.SYSRESETREQ.
    Downloading ‘s132_nrf52_6.1.1_softdevice.hex’ to J-Link
    Programming 2.7 KB of addresses 00000000 — 00000aff
    Programming 144.3 KB of addresses 00001000 — 0002514f
    J-Link: Flash download: Bank 0 @ 0x00000000: Skipped. Contents already match
    Download successful
    Downloading ‘ble_app_uart_pca10040_s132.elf’ to J-Link
    Programming 46.1 KB of addresses 00026000 — 000318b1
    Programming 0.1 KB of addresses 000318b4 — 0003194b
    J-Link: Flash download: Bank 0 @ 0x00000000: Skipped. Contents already match
    Download successful
    Stopped by vector catch
    Preparing target for user application
    Executing Reset script TargetInterface.resetAndStop()
    Reset: Halt core after reset via DEMCR.VC_CORERESET.
    Reset: Reset device via AIRCR.SYSRESETREQ.

  • Hi Mylena, 

    Sorry for the delay. 

    Check your interrupt priorities. It looks like you are trying to call a Softdevice SV call from within an interrupt context running at high priority, which is not allowed. You can try to use APP_IRQ_PRIORITY_LOW for the TWI interrupts. 

    Please note that we are moving into the summer vacation period here in Norway, so it might take a bit longer to get to the bottom of this than expected, as staff during the month of July will be reduced. I'm sorry about the inconvenience, but please be patient. And I'll get back to you as soon as I hear something from the devs.

    -Amanda H.

Related