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

SDK12 app_pwm

Hi guys, I'm migrating my SDK 10 project up to SDK 12. There are quite a few new configuration files and setups. In order to enable app_pwm peripherals I enabled the proper defines in the project sdk_config.h file including: APP_PWM_ENABLED 1 TIMER_ENABLED 1 TIMER1_ENABLED 1 PPI_ENABLED 1 GPIOTE_ENABLED 1

However I seem to be getting an odd compile error I can't pin down. At the code:

APP_PWM_INSTANCE(PWM1,1)

I get the following compile error:

Symbol 'TIMER1_CC_NUM' could not be resolved

This suggests to me a compile error in the deeper layers of nrf_drv_timer.c but I can't seem to nail this one down. Are there any other configuration defines I'm missing?

As a side note: Is there any documentation explaining the differences between using app_pwm and nrf_drv_pwm?

Thanks guys,

-DC

  • Hi Dave

    The difference between app_pwm and nrf_drv_pwm is basically that app_pwm uses timer-ppi-gpiote to generate static pwm waveform. To change the pwm duty cycle you need to use CPU. app_pwm is generally high current as TIMER + 16MHz clock source is contantly required, typically >1mA for nRF51.

    I am not sure what hardware you plan on using with SDK, nRF51 or nRF52, the nrf_drv_pwm is a driver for the pwm hardware which is present on nRF52. There is no pwm hardware for nRF51. So for nRF52 you have three options, low power pwm library, pwm library and pwm driver+pwm hardware. For nRF51 you can choose between low power pwm library or pwm library

    pwm library: Accurate pwm and pwm frequency can be up to 200kHz. High current consumption and high resource use with which requires TIMER+PPI+GPIOTE and also CPU time for duty cycle uptdates. Limited to maximum 4 pwm channels on nRF51. Limited to maximum 6 pwm channels on nRF52.

    low power pwm library: Less accurate pwm with pwm frequency up to 6kHz. Uses less power than pwm library (~100uA per pwm channel for 100Hz pwm). Generally adequate for LED control. High CPU usage, CPU usage increases with higher frequency of the pwm and the number of pwm channels

    pwm driver: Applicable for nRF52 only as it uses pwm hardware in the background. Accurate and up to 16MHz pwm. Current consumption high as EasyDMA is used (~2mA).

    Not sure about the error that you are seeing. I have the TIMER1_CC_NUM defined in nRF52832_peripherals.h file which is traced to \Keil_v5\ARM\Pack\NordicSemiconductor\nRF_DeviceFamilyPack\8.9.0\Device\Include. Have you updated to DeviceFamilyPack 8.9.0 in Keil?

    image description

Related