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

USB not enumerating after reset

I am using the secure_bootloader to perform firmware updates via USB on the nRF52840 (custom board). This works great when I start with no application (only bootloader and softdevice). After loading the application successfully, I use a button trigger in the application that will reset back to the bootloader to perform another update. The nRF52840 resets and enters bootloader mode, but this time the USB CDC ACM doesn't enumerate on my Windows PC.

Another thing of interest is that when I run the bootloader from Embedded Studio, the USB port doesn't enumerate either. If I stop my debugger and disconnect/reconnect USB, then it enumerates. My custom board is powered by USB, so that may be a factor here. Do I need to stop, suspend, or force restart USB when entering the bootloader?

This is the application code that I use to reset to the bootloader for firmware update.

static uint32_t do_dfu(void)
{
uint32_t err_code;

NRF_LOG_DEBUG("In ble_dfu_buttonless_bootloader_start_finalize\r\n");

err_code = sd_power_gpregret_clr(0, 0xffffffff);
VERIFY_SUCCESS(err_code);

err_code = sd_power_gpregret_set(0, BOOTLOADER_DFU_START);
VERIFY_SUCCESS(err_code);

// Signal that DFU mode is to be enter to the power management module
nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_DFU);

return NRF_SUCCESS;
}

Related