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

Upgrade to SD310 V2 on 54122 stuck in sd_softdevice_enable()

Hi all, I did this upgrade hoping to have a TX_COMPLETE event issue fixed (I'm not able to send more than 1 buffer per connection it seems in my notification based service). However now my app, actually bootloader sitting at 0x3c000, is stuck in sd_softdevice_enable() at initialization stage. There haven't been any changes to the clock setup, the code is compiled with the new headers of v2, migration document read - necessary memory layout applied to linker when building application, sd_ble_enable(), sd_ble_gap_address_get/set() called as part of init as instructed. Am I missing something?

static void ble_stack_init(void)

{ uint32_t err_code;

SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, true);

// Enable BLE stack
ble_enable_params_t ble_enable_params;
memset(&ble_enable_params, 0, sizeof(ble_enable_params));
ble_enable_params.gatts_enable_params.service_changed = 0;//IS_SRVC_CHANGED_CHARACT_PRESENT;
err_code = sd_ble_enable(&ble_enable_params);
APP_ERROR_CHECK(err_code);

// Register with the SoftDevice handler module for BLE events.
//err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
//APP_ERROR_CHECK(err_code);

// Register with the SoftDevice handler module for BLE events.
err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);
APP_ERROR_CHECK(err_code);

}

int main(void) { uint32_t err_code = NRF_SUCCESS;

 // Start 32 MHz crystal oscillator
NRF_CLOCK->XTALFREQ = 0;
NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
NRF_CLOCK->TASKS_HFCLKSTART = 1;
// Wait for the external oscillator to start up
while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0) {}

//-------------------------------------------------------------------------------------
nrf_gpio_cfg_output(LED1_PIN);
nrf_gpio_cfg_output(LED2_PIN);	
__LED1_OFF;
__LED2_OFF;   
//-------------------------------------------------------------------------------------
nrf_gpio_cfg_input(USBSTS_PIN, NRF_GPIO_PIN_NOPULL);
//
// This check ensures that the defined fields in the bootloader corresponds with actual
// setting in the nRF51 chip.
APP_ERROR_CHECK_BOOL(NRF_UICR->CLENR0 == CODE_REGION_1_START);
APP_ERROR_CHECK_BOOL(*((uint32_t *)NRF_UICR_BOOT_START_ADDRESS) == BOOTLOADER_REGION_START);
APP_ERROR_CHECK_BOOL(NRF_FICR->CODEPAGESIZE == CODE_PAGE_SIZE);

// Initialize.
timers_init();
gpiote_init();

ble_stack_init();

Cheers

Parents
  • I had the very same problem. You now have to enable the softdevice first via the master boot record and then ask the softdevice to forward interrupts to your bootloader. The procedure is decribed in the new version of the documentation. Here is my implementation:

    init_hardware::init_hardware()
    {
        sd_mbr_command_t command = { SD_MBR_COMMAND_INIT_SD };
        check_error( sd_mbr_command( &command ) );
    
        check_error( sd_softdevice_vector_table_base_set( &__unaligned_rom_start_address__ - static_cast< char* >( nullptr ) ) );
        check_error( sd_softdevice_enable( nRF51::fag_default_low_frequency_clock_source, &softdevice_assertation_handler ) );
    }
    
Reply
  • I had the very same problem. You now have to enable the softdevice first via the master boot record and then ask the softdevice to forward interrupts to your bootloader. The procedure is decribed in the new version of the documentation. Here is my implementation:

    init_hardware::init_hardware()
    {
        sd_mbr_command_t command = { SD_MBR_COMMAND_INIT_SD };
        check_error( sd_mbr_command( &command ) );
    
        check_error( sd_softdevice_vector_table_base_set( &__unaligned_rom_start_address__ - static_cast< char* >( nullptr ) ) );
        check_error( sd_softdevice_enable( nRF51::fag_default_low_frequency_clock_source, &softdevice_assertation_handler ) );
    }
    
Children
Related