The nrf52840 usbd examples of peripheral in SDK 13.0.0 worked fine. I want usb work with BLE softdevice and there are lots of conflicts between nrf drv and softdevice. Is there any example of usbd working together with ble softdevice?
The nrf52840 usbd examples of peripheral in SDK 13.0.0 worked fine. I want usb work with BLE softdevice and there are lots of conflicts between nrf drv and softdevice. Is there any example of usbd working together with ble softdevice?
Hi Sigurd, is there an ETA for when the updated version supporting USB power events/interrupts will be released? Thanks!
Hi Don,
A new S140 SoftDevice version with support for USB power events/interrupts will be released in the near future. I will add a comment here when it’s released. If you need a more accurate release date, you should ask the Nordic Regional Sales Manager in your area. If you do not have any contact information, then you can send me a private message with your location and I will provide you with the contact information of your local Nordic RSM.
Hi all,
The new S140 SoftDevice with support for USB power events/interrupts is now released. The version is 6.0.0-6.alpha
, and can be downloaded from here:
From the release notes:
The SoftDevice API now provides access to USB power handling registers
Another interesting feature is the improvement on the BLE 5 Long-Range:
The SoftDevice now implements a range delay (packet time of flight compensation) corresponding to a distance of 5 km when using LE Coded PHY
Sigurd, thanks very much for the quick reply. Don't we also need an updated version of the SDK too? Otherwise the app still can't register a USB power event handler. nrf_drv_power_usbevt_init() doesn't allow it.
From nrf_drv_power.c:
ret_code_t nrf_drv_power_usbevt_init(nrf_drv_power_usbevt_config_t const * p_config)
{
nrf_drv_power_usbevt_uninit();
if (p_config->handler != NULL)
{
m_usbevt_handler = p_config->handler;
#ifdef SOFTDEVICE_PRESENT
if (nrf_sdh_is_enabled())
{
/** @todo Implement USB power events when SD support it */
return NRF_ERROR_INVALID_STATE;
}
else
#endif
{
nrf_power_int_enable(
NRF_POWER_INT_USBDETECTED_MASK |
NRF_POWER_INT_USBREMOVED_MASK |
NRF_POWER_INT_USBPWRRDY_MASK);
}
}
return NRF_SUCCESS;
}
Example application's power event handler and registration of the hander:
static void power_usb_event_handler(nrf_drv_power_usb_evt_t event)
{
switch(event)
{
case NRF_DRV_POWER_USB_EVT_DETECTED:
if (!nrf_drv_usbd_is_enabled())
{
app_usbd_enable();
}
break;
case NRF_DRV_POWER_USB_EVT_REMOVED:
m_usb_connected = false;
break;
case NRF_DRV_POWER_USB_EVT_READY:
m_usb_connected = true;
break;
default:
ASSERT(false);
}
}
static const nrf_drv_power_usbevt_config_t config =
{
.handler = power_usb_event_handler
};
ret_code_t ret;
ret = nrf_drv_power_usbevt_init(&config);
APP_ERROR_CHECK(ret);
Thanks! Don
Hi Don,
It's easiest to wait for a new SDK with support for S140 6.0.0-6.alpha, but it should be possible to do the migration to the new S140 and implement the new S140 USB Power functions, such as sd_power_usbpwrrdy_enable()
and sd_power_usbdetected_enable()
yourself. But if this is not critical for you at the current time, then it could be better to wait for the supported SDK.