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

Merging two SDK examples in SES

Hi all,

I am trying to get a hang of SES platform(Using the nRF52840 Preview DK, SDK 15.3) and it's my first few trails with it. I am trying something very basic now to integrate ble_app_uart and pwm_driver to set a particular duty cycle from the nRF UART app using a phone to get the basic flow going.

I am editing the ble_app_uart and adding pwm_driver example-code to it. Whenever I am compiling the code, I am getting the following 2 errors

#error "No enabled PWM instances. Check <nrfx_config.h>."
and
'NRFX_PWM0_INST_IDX' undeclared here (not in a function); did you mean 'NRFX_PWM_INSTANCE'?

Searching for them on the forum here, I was able to find some information on it. I have edited the sdk_config.h(to the best of my knowledge) to make sure the NRFX_PWM is enabled. I have also added nrfx_pwm.c in the nRF_Drivers folder in SES project. But I think the issue lies here as I cant seem to find Dependencies and Output Files for this file as shown below.

Is it something to do with adding the header files? I have added the nrfx_pwm.h file via the Project Options through Preprocessor (User Include Directories) but I am not sure if its added correctly. Are there any other files to be added?

Can anyone help me out to solve this issue? What am I doing wrong here?

I am attaching the SES project folder which I was making. (It should run if its placed in SDK 15.2 examples\ble_peripheral\ble_app_uart folder\pca10056\s140 folder)

ses.zip

  • Hello, 

    I am attaching the SES project folder which I was making. (It should run if its placed in SDK 15.2 examples\ble_peripheral\ble_app_uart folder\pca10056\s140 folder)

     I added the folder to the specified folder and was able to build. Did you try to build after adding the file? (I am however missing you sdk_config.h in the file you sent)

     

    Edit: (DevZone not working properly and replying before I was done with the answer)

    Make sure that you have enabled the correct instance of PWM in sdk_config.h

    // <e> NRFX_PWM_ENABLED - nrfx_pwm - PWM peripheral driver
    //==========================================================
    #ifndef NRFX_PWM_ENABLED
    #define NRFX_PWM_ENABLED 1
    #endif
    // <q> NRFX_PWM0_ENABLED  - Enable PWM0 instance
     
    
    #ifndef NRFX_PWM0_ENABLED
    #define NRFX_PWM0_ENABLED 1
    #endif

    Kind regards,
    Øyvind

  • Dear  Øyvind,

    Hmmm. Its weird that its compiling fine for you.

    PWM instances were already configured in sdk_config.h(I am attaching the same anyway for reference). Still its compiling with the same errors.

    Is it some Path error issue?

    0537.sdk_config.h

  • Dear Øyvind,

    I seemed to have fixed it. I am able to compile without errors now. It was sdk_config.h configuration issue.

    I needed to set all the below

    NRFX_PWM_ENABLED 1

    and  NRFX_PWM0_ENABLED 1

    and PWM_ENABLED 1

    and PWM0_ENABLED 1

    Earlier I was only setting NRFX_PWM_ENABLED  and NRFX_PWM0_ENABLED  to 1

    Any reasoning behind why this is so?

    I think there needs to be better documentation or steps mentioning this.

  • Glad to hear that you found the solution. I referred to wrong instances of the sdk_config, it should have been PWM_ENABLED and PWM0_ENABLED, known as legacy drivers which include nrfx drivers. More information here.

    dev_000 said:
    I think there needs to be better documentation or steps mentioning this.

    I agree that there little information regarding this topic. There is some information in the SDK which first introduced nrfx drivers, found here.  Git documentation can be found here.

    I hope this clears some confusion. 

    Kind regards,
    Øyvind

  • Hi Oyvind,

    In general, if I want to use a module, do I need to enable both the old driver as well as the new driver in the sdk_config.h? I had the same problem as OP when I used RTC so I think I have to enable both drivers for all the module?

Related