Is your feature request related to a problem? Please describe.
This is mostly an issue for boards like Pro Micro that lack physical buttons to control DFU mode.
On that board there seem to be only two ways to activate OTA:
- there is no valid application at all;
- an application explicitly requests OTA DFU before doing a reset.
Describe the solution you'd like
The boot loader could check if the board is connected to a USB host at all.
If not, then it does not make sense to expect USB serial or UF2 DFU.
E.g., if the board is powered via a battery or a dumb charger.
I think that such an enhancement would make sense even for boards with physical buttons.
Describe alternatives you've considered
Always having to patch application, so that the right DFU mode is initiated.
Additional context
It seems that something like app_usbd_core_state_get or raw NRF_USBD->USBADDR > 0 can be used as a check.
Is your feature request related to a problem? Please describe.
This is mostly an issue for boards like Pro Micro that lack physical buttons to control DFU mode.
On that board there seem to be only two ways to activate OTA:
Describe the solution you'd like
The boot loader could check if the board is connected to a USB host at all.
If not, then it does not make sense to expect USB serial or UF2 DFU.
E.g., if the board is powered via a battery or a dumb charger.
I think that such an enhancement would make sense even for boards with physical buttons.
Describe alternatives you've considered
Always having to patch application, so that the right DFU mode is initiated.
Additional context
It seems that something like
app_usbd_core_state_getor rawNRF_USBD->USBADDR > 0can be used as a check.