Does PWM frequency of all 4 channels in one pwm module on an nRF52840 have to be the same?

Hi,

I am developing an application for an nRF52840 using nRF Connect SDK v2.9.0. The application currently uses the Zephyr driver for simple PWM functions on several GPIOs. Does the PWM frequency across all 4 channels (CH0, CH1, CH2, CH3) in one module (for example pwm0) have to be the same?

I think the answer is yes per the nRF52840 product specification. Correct me if I'm wrong.

However, the follow up question: Does the SDK or the Devicetree Visual Editor detect different PWM frequencies as a problem? It doesn't seem like it does, and so, if different channels of one pwm module are set to different frequencies, what frequency will prevail?

Thanks,

Ken

Parents
  • Hello Ken,

    You need to have the same PWM frequency accross all channels on the same PWM instance. You have 3 PWM instances, so that means you can have 3 separate frequencies. 

    You can also generate PWM signals withouot the PWM peripheral. One way is to use a TIMER instance, together with the GPIOTE peripheral and PPI to connect the two peripherals together. But that would also limit you to one frequency per TIMER instance. But if the case is that you need 4 different frequencies, it would be possible to acheive by using e.g. PWM0, PWM1, PWM2 and TIMERX (any timer instance not used by the SoftDevice Controller). 

    You can see that each PWM instance has it's own COUNTERTOP register:

    https://docs.nordicsemi.com/bundle/ps_nrf52840/page/pwm.html#register.COUNTERTOP

    This is the register that basically decides the frequency of the PWM instance. 

    Best regards,

    Edvin

  • Hi Edvin,

    Thanks for your response.  How about my followup questions from above:

    Does the SDK or the Devicetree Visual Editor detect different PWM frequencies as a problem? It doesn't seem like it does, and so, if different channels of one pwm module are set to different frequencies, what frequency will prevail?

    Also, why 3 and not 4 PWM instances?  SoftDevice Controller?  Is this active if using Zephyr?

    Ken

  • Ken58 said:
    is one of the PWM instances used by the OS or SoftDevice equivalent?

    No. The softdevice uses one RTC and one TIMER instance (or technically, it is the MPSL layer that uses these). Please see:

    https://docs.nordicsemi.com/bundle/ncs-latest/page/nrfxlib/softdevice_controller/doc/softdevice_controller.html

    https://docs.nordicsemi.com/bundle/ncs-latest/page/nrfxlib/mpsl/doc/mpsl.html

    Best regards,

    Edvin

  • Hi Edvin,

    Thanks for pointing out the documentation URLs.

    Question:  Is the softdevice of nrfxlib part of a typical Zephyr application built with nRF Connect SDK?

    Sorry, but I am still learning how all of what is in the SDK works together.

    Ken

  • Hello,

    The SoftDevice is not part of a standalone zephyr installation, but it will be added when you use nRF Connect SDK. The nRF Connect SDK has a choice to use either the Zephyr's Bluetooth LE controller, or the softdevice controller (which is Nordic Semiconductor's closed source Bluetooth Low Energy controller). Unless you specify NCS applications to use the Zephyr controller, it will use the SoftDevice Controller by default. 

    So while you could choose to use the Zephyr controller, that is not something that we qualify with Bluetooth, so you would have to do the entire qualification part on your own, which would be a much more expensive way to certify your BLE device with Bluetooth. If you use our SoftDevice controller, you only need to certify a much smaller part, as the controller is pre-certified.

    That being said, the Zephyr controller will probably use a similar amount of peripherals. 

    Best regards,

    Edvin

  • Hi Edvin,

    We are far away from my original ticket, but thank you so much for the discussion.  Indeed, I have found that Nordic's support provided here has been world class.  I appreciate it very much.

    You said "Unless you specify NCS applications to use the Zephyr controller, it will use the SoftDevice Controller by default".  I think I have used defaults all along the way so I think my application is using SoftDevice.  If I wanted to use the Zephyr control, how would I specify this?  How can I check to ensure my application is using SoftDevice?

    Ken

  • Hello Ken,

    Sorry for not specifying in my previous reply.

    If you want to test the Zephyr Bluetooth Low Energy controller, instead of the Softdevice controller, you will have to add:

    CONFIG_BT_LL_SW_SPLIT=y

    in your prj.conf. 

    This config is defined in ncs\zephyr\subsys\bluetooth\controller\kconfig:

    config BT_LL_SW_SPLIT
    	bool "Software-based BLE Link Layer [EXPERIMENTAL]"
    	select EXPERIMENTAL
    	select ENTROPY_GENERATOR
    	help
    	  Use Zephyr software BLE Link Layer ULL LLL split implementation.
    

    So if you are using NCS, and do not have a line saying CONFIG_BT_LL_SW_SPLIT=y in your prj.conf or any other .conf files present in your application folder, then you are using the softdevice controller. 

    Best regards,

    Edvin

Reply
  • Hello Ken,

    Sorry for not specifying in my previous reply.

    If you want to test the Zephyr Bluetooth Low Energy controller, instead of the Softdevice controller, you will have to add:

    CONFIG_BT_LL_SW_SPLIT=y

    in your prj.conf. 

    This config is defined in ncs\zephyr\subsys\bluetooth\controller\kconfig:

    config BT_LL_SW_SPLIT
    	bool "Software-based BLE Link Layer [EXPERIMENTAL]"
    	select EXPERIMENTAL
    	select ENTROPY_GENERATOR
    	help
    	  Use Zephyr software BLE Link Layer ULL LLL split implementation.
    

    So if you are using NCS, and do not have a line saying CONFIG_BT_LL_SW_SPLIT=y in your prj.conf or any other .conf files present in your application folder, then you are using the softdevice controller. 

    Best regards,

    Edvin

Children
No Data
Related