I performed early software development on an nRF52840-DK. I'm using Zephyr on the nRF52840.
Now I have a custom board and started doing development on it by creating a .overlay file to change pin assignments, etc.
I then decided to create a custom board folder under my Project_folder/boards/arm to eliminate the dependence on the nRF52840-DK. I copied the contents of the nRF52840-DK board entries and renamed them to refer to the custom board, then edited the references to also refer to the custom board. Unused peripherals in the .dts have been marked as "disabled".
The project compiles and loads using the custom board specification, but BLE doesn't advertise. printk statements show that BLE gets initialized and the advertising is enabled, but the advertisements don't show up on LightBlue. Everything else seems to work the same as with the original nRF52840-DK .dts with .overlay file (and BLE advertises with them). Is there any peripheral specified by the .dts/.overlay that could affect the operation of the BLE radio? Is there something else in the board definition scheme that could affect BLE (or radio)?
What happens if you use exactly the same configuration as the nRF52840 DK, and not disable any peripherals? Could it be that you accidentally disabled something that is needed by the Bluetooth stack for instance? Did you check the log or do any debugging? If so, what did you find?
If you don't make progress, perhaps you can upload the project here so that I can look at it?
Thanks. Yes, I looked at the log and didn't see any errors reported.
I went back to the original nRF52840 DK .dts file and used an overlay file to start removing peripherals I wasn't using. I found that disabling uart0 caused the BLE advertising to not appear!
My custom board uses a Laird BL654PA module (nRF52840 + power amp), so I'll check with them to see if there is some dependence on uart0. I looked in the Zephyr documentation to try to find a list of nRF52840 resources used by the BLE driver, but didn't find anything. When using Zephyr with CONFIG_BT_LL_SOFTDEVICE_DEFAULT=y I assume that a Nordic SoftDevice is being used, but am not sure what resources it requires. Is there a list of "reserved resources" that you can recommend?
The SoftDevice controller as well as the Multiprotocol Service Layer (MPSL) which it relies on reserves several peripherals, and limits access to others.
You can refer to MPSL and SoftDevice controller documentation for details, but snipping out the relevant parts:
The following peripherals are owned by MPSL and must not be accessed directly by the application:
The following peripherals are owned by the SoftDevice Controller and must not be accessed directly by the application:
Thanks for this list. I remember seeing this before.
However I'm finding that if uart1 is "disabled" in the .dts file, BLE advertising doesn't occur (even though it is started with no error reported). If I specify it to be "okay", advertising occurs as expected (however when a connection occurs, it drops randomly later).
There also seems to be a dependence with uart0. I commented out the zephyr dependence (zephyr, console = &uart0; ... zephyr,bt-c2h-uart = &uart0;)
I'm trying to determine where "uart0" and "uart1" are used and what seems to be dependent on them, and what the linkage to BLE might be.
Any thoughts? Is there another list of peripherals that zephyr must have ownership of (my prj.conf file has "CONFIG_UART_CONSOLE=n"
I am not able to explain problems with disabling UART1 that. I tested with a random example (Bluetooth peripheral LSB) and disabled uart1 in an overlay, but did not see any issues. If I disable UART0 however, there are problems. This is used for logging. If I disable logging by setting CONFIG_LOG=n and CONFIG_SERIAL=n in prj.conf this issue is resolved. Can you test that on your end?