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

SOFTDEVICE_PRESENT macro must be present in a custom usb hid project that could potentially work without softdevice. Should I init and use softdevice?

To the kind attention of Nordic support team,

I 'm working on a custom project so that nRF52840 can operate in two different mutual exclusive running modes. A USB operational mode and a connectivity firmware mode (they are meant to never run at the same time). USB code is based on SDK15.2 USB HID composite example, and it makes no use of Softdevice. Having included connectivity firmware code also in the project I'm working on, emProject file of the project has got a SOFTDEVICE_PRESENT macro. My problem is that macro is still there for the USB operational mode also, I mean a project that can work without Softdevice is compiled with SOFTDEVICE_PRESENT macro. I'd like to know, having a situation where USB code could potentially work without Softdevice and having Softdevice loaded in flash (for connectivity fw purposes), do I have to enable Softdevice explicitly for the project running in USB mode, so that is compiled to work with a Softdevice and having a Softdevice properly initialized? Could you please tell me what is theoretically the best practice for this kind of situations? And what is the documentation I could read? Do I need to properly initialize Softdevice even when running in USB mode? And, should I init Softdevice does code like this suffice:

nrf_sdh_enable_request();
ASSERT(nrf_sdh_is_enabled());

Or is it a different procedure? Am I missing something? Is it safe to use those instructions in a project like USB HID composite example but using SOFTDEVICE_PRESENT macro also and having Softdevice present in flash?I already saw, that ENTER/EXIT CRITICAL regions where not working properly in USB project, maybe because SOFTDEVICE_PRESENT is there and Softdevice loaded in flash, still it has not been properly initialized (I didn't initialize it at all in USB project)

Thank you for your great work and attention.

Best regards

Parents Reply Children
No Data
Related