HW peripherals used by Zephyr / portable Zephyr HW APIs

Windows 11, VSCode, NCS v2.3.0

A few questions about HW peripherals being used outside of my application - by Zephyr OS or Zephyr libs/modules.

How can I find out which HW peripherals are used by the Zephyr OS, as well as any additional features of Zephyr (eg BLE, ESB, etc)?

eg the Zephyr OS is probably using some kind of RTC to drive its scheduling, etc.  Radio applications will use the radio, but also maybe timers, PPI, etc?

I am developing software that wants to use some HW features and it's not clear how I can tell what is in use already.

I believe there is no SoftDevice in use with a Zephyr application, correct?

So I don't need to worry about SoftDevice HW utilization also?

Can you help me understand which Zephyr API to use for timer/counter?

I'm not clear which API to use with Zephyr to be portable across devices.

I'm on nRF52840, but looking at building on RP2040 also.

The nRF52840 device has a rich set of features presented by its Timer/Counter peripheral. 

I found this Zephyr API link for HW/Peripherals/Counter - https://docs.zephyrproject.org/latest/hardware/peripherals/counter.html

Is that the Zephyr API I would use to be portable across devices when building with Zephyr?  Or maybe for RTC?

The API I linked to is very limited.  I'm not sure I can accomplish what I want with it. What do people typically do when underlying device interfaces aren't accessible via Zephyr APIs?

What API would I use for a Timer/Counter peripheral?  And is there an example?

Thanks.

  • Hi Douglas 

    I will just break it down into multiple points

    1. You can check the config files and the device tree to see the enabled peripherals. 

    2. You are correct in that Zephyr does not use the Softdevice, as Zephyr uses an open source BLE stack. It is possible to run: 

    SoftDevice controller + Zephyr host or Zephyr controller + Zephyr host

    3. You should not have to worry about it, that is correct

    4. If you use NCS to build for a non Nordic device you will be breaching our Terms of Service unfortunately. To cite our license found in ncs/vx.x.x/nrf/LICENSE "This software, with or without modification, must only be used with a Nordic Semiconductor ASA integrated circuit." However if you don't use NCS you will not breach the license. 

    5. This is correct, if you want to use a driver for different devices you can use the standard Zephyr API. For the Nordic devices we also have the nRFX drivers This is often the solution if the Zephyr drivers are to limited. 

    6. See question 5

    7. Here is an example for nRFX drivers for timer/counter made by one of my coworkers, please note that is not updated for NCS v2.3 so for example the include paths are not correct anymore. And here is a Zephyr example

    Regards

    Runar

  • Ok thank you,  understood.  I looked at the examples and they make sense to me.  This answers my question.

  • Hello, I'm also interested in figuring out which PPI channels and Timers are used by zephyr and the BLE stack and which are free for the application to use. Could you describe in a bit more detail how I can figure out that information through the config and device tree functions?

    Thanks,

    Francisco

Related