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

PWM in Mesh SDK 2.0.0

Hi,

I would like to use a PWM application with mesh SDK. However when I try to compile, I got an error because "app_pwm.h" is missing (No such file or directory).

The only related topics I found was here and here but I guess this is outdated as "The nRF5 SDK for Mesh now requires the nRF5 SDK to compile. By default, the nRF5 SDK is expected to be adjacent to the nRF5 SDK for Mesh".

Can someone help me with this?

Parents
  • hello,

    Assuming that you are using Segger Embedded Studio (SES), you can follow the directions in the .\nrf5-mesh-sdk_v2.01\doc\getting_started\SES.md file... This will allow you to direct SES to the location of your nRF5 SDK.

    # nRF5 SDK for Mesh Segger Embedded Studio first time setup
    
    Segger Embedded Studio determines the location of the nRF5 SDK through macros.
    Before building the example, you must first configure the `SDK_ROOT` macro
    in Segger Embedded Studio. This is a one time global configuration that will
    still be valid the next time you open Segger Embedded Studio. The `SDK_ROOT`
    variable defaults to an nRF5 SDK 15.0.0 instance unzipped right next to the mesh
    folder if not set.
    
    The `SDK_ROOT` macro can be set by navigating to Tools -> Options, then
    "Building". Under "Build" in the configuration list, edit "Global macros" to
    contain `SDK_ROOT=<the path to your nRF5 SDK 15 instance>`. Save the
    configuration.
    
    The path can be verified by opening one of the source files under the "nRF5 SDK"
    file group. If the macro was set correctly, the file should open in the editor
    window. If not, it will show an error message telling you that the file couldn't
    be found.
    
    For more info on Segger Embedded Studio macros, see
    https://studio.segger.com/ide_project_macros.htm

    Alternatively, you can simply ensure that the nRF5 SDK is located adjacently to the nRF5 Mesh SDK as depicted in the image below...

    Regards,

  • Hello leonwj,

    Thanks for the quick reply.

    Unfortunately, that is not the solution. I had  nRF5 SDK located adjacently to the nRF5 Mesh SDK already. That part is fine, since I was able to Build the light_switch server example without changes.

    I also checked through the instructions: "The path can be verified by opening one of the source files under the "nRF5 SDK" file group. If the macro was set correctly, the file should open in the editor window. If not, it will show an error message telling you that the file couldn't be found." and it worked.

    But if I try to include other header files it fails with the message No such file or directory as described before.


    Then I still edited the "Global macro" as described, but still it doesn't work (I tried app_pwm.h and nrf_drv_pwm.h).

    Regards,

  • ok, you didn't include your error log in your original post so my initial observation was to highlight how to get the nRF5 SDK configured into a mesh solution...

    The app_pwm.h file is included in the nRF5 SDK so you may have to explicitly configure your SES settings to include the .\nrf5_sdk_15.0.0_a53641a\components\libraries\pwm directory into your build path (see below):

    Edit Options...->Preprocessor

    Regards,

  • Hello leonwj,

    I explicitly configured my SES settings to include the .\nrf5_sdk_15.0.0_a53641a\components\libraries\pwm directory into your build path (as well as 2 other include file that were stated as missing in further Build attempts):

    I also added the file app_pwm.c to my project files under nRF SDK.

    However I got 7 errors like this when trying to Build again:

    What do I need to do more? Is there a sdk_config.h that needs to be edited as well in Mesh SDK?

  • Yes, examples in the mesh also have sdk_config.h (found in the include folder for the mesh example). here you need to set APP_PWM_ENABLED to 1

  • Hi,

    So, I edited sdk_config.h to enable and set APP_PWM_ENABLED 1, I got 48 errors this time. Then I tried to enable NRFX_TIMERNRFX_PPI and NRFX_GPIOTE with no results.

Reply Children
  • @PauloZacarias

    You appear to have missed to add a few *.c files from $SDK_ROOT/modules/nrfx/drivers/src/ in your projects and potentially also the preprocessor include directories for their related .h files.

    In your SES Preprocessor include files, I would suggest removing $SDK_ROOT/modules/nrfx/templates (and any subdirectories), since the directory $SDK_ROOT/integration/nrfx has files with identical names that have been tailored to the SDK. (depending on order  you list the preprocessor include directory, you can get one set or the other -I hope Nordic can fix the overlap between these two directory branches in next SDK) Without the changes, you can be making config changes and nothing happens.

    If you plan to eventually migrate your project to a newer version of Mesh stack, it can help to define a global macro similar to $(SDK_ROOT), e.g $(MESH_ROOT) and use it when defining the preprocessor include directories for the MeshSDK.

    Finally, the file implmentation/nrfx/nrfx_log.h has a subtle bug that can appear depending on the order your .h files get included. On line 51 the right-hand side of the #define should be NRFX_CONCAT_3(..) instead of CONCAT_3(..). Since CONCAT_3(..) is defined in nordic_common.h you can be lucky and the preprocessor may have picked up the definition already. and you won't (initially) experience any error.(Spent 1/2 day hunting that one down, so thought should share it!)

  • Hi erik,

    I added the missing files from $SDK_ROOT/modules/nrfx/drivers/src/, plus some header and c files more to solve dependencies issues.

    Now, besides some undefined references (still), I also get errors with multiple definition:



    Isn't there a better way to actually integrate the nrf SDK 15 with Mesh SDK?
    Because so far I have just been fixing dependencies issues over and over again :/

    Any help is more than welcome!

  • Try to set these defines in sdk_config.h to 1 :

    GPIOTE_ENABLED
    NRFX_GPIOTE_ENABLED
    NRFX_PPI_ENABLED
    NRFX_TIMER_ENABLED
    PPI_ENABLED
    TIMER_ENABLED
    NRF_STRERROR_ENABLED

  • Thanks for the reply Daniel,

    I enabled them all but still get the same 12 errors.

    EDIT: I added app_util_platform.c and nrf_drv_ppi.c, and respective path to header directories.

    Undefined references seem to be solved! But now I still face multiple declaration issues:

  • Hi,

    Have you solved the issues with missing and double includes now, or do you want us to have a look at it?

    Regards,
    Terje

Related