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

NRFX migration legacy layer

I can get a clean build and working product with some workarounds, but a couple issues remain from migrating sdk 13.1 to sdk 15.0 (SES nrf52832 s132).

1) After nrf_drv to nrfx, and twi to twim conversions, the app_button.c had references to nrf_gpiote but the nrf_gpiote.c was removed and replaced with nrfx_gpiote.c in the project. Having to change the nrf references in app_button.c (an sdk file) seemed odd to get nrfx to work.

2) Also in sdk_config.h if I try to delete or set to zero GPIOTE_ENABLED I get errors:

error if set to zero: undefined reference to 'nrfx_gpiote_in_is_set'

error if deleted: builds and downloads but no advertising and scanner does not pick up the device.

but all ok when GPIOTE_ENABLED 1 when the file is not even in the project, (also NRFX_GPIOTE_ENABLED is set to one)

3) Not sure if related, but the same for UART_ENABLED. I can set UART_ENABLED to zero but not delete/remove from sdk_config.h,, even though nrf_uarte.c has been removed and not in the project.  If I try to delete the UART_ENABLED section, the error is, "compiling 'nrfx_uart.c', #error "No enabled UART instances , Check <nrfx_config.h>. I have NRFX_UARTE_ENABLED and NRFX_UART_ENABLED set to one.

With these three workarounds all is good, but I'm going for the sdk_config.h file to have no legacy layers.

-thank-you.

Parents
  • Hello,

    I think the problem is not that you are not using the legacy drivers, but that the NRFX defines are "overwritten" by the "legacy" defines. if you look at the file "apply_old_config.h", which I assume is included in your project, you will find this sort of thing for most of your NRFX defines:

     

    #if defined (LEGACY_DEFINE)

    #undef NRFX_DEFINE
    #define NRFX_DEFINE LEGACY_DEFINE

    #endif 

     

    So all your NRFX defines are redefined to the old defines if the old defines are defined. Not the smoothest approach when changing drivers, but it is what it is at this point in time.

     

    So either define all the "old" configs to the same as the new ones, or remove them completely (not enough to set them to 0, since this will still count as defined).

     

    Try this, and let me know if it still doesn't work.

     

    Best regards,

    Edvin

  • I just gave apply_old_config.h a look, and this file ( "apply_old_config.h")  had never been part of my project (didn't know about it). The UART_ENABLED was set to zero, but not able to delete.

  • It is not easy to know what files that are included in SES, because only the .c-files are listed in the project view. 

     

    Did you get it to work? What did you mean by "UART_ENABLED was set to zero, but not able to delete"?

     

    You can e.g. comment out the whole section if you open the sdk_config.h file in plain text view, and not the CMSIS view.

     

    BR,

    Edvin

  • The section in sdk_config.h which has the legacy UART parameters is set to, UART_ENABLED 0, and works fine, but when I remove (delete) that section in plain text view

    // <e> UART_ENABLED - nrf_drv_uart - UART/UARTE peripheral driver - legacy layer
    //==========================================================

    I get errors "compiling 'nrfx_uart.c', #error "No enabled UART instances , Check <nrfx_config.h>,.

    -thank-you.

  • If you look in nrfx_uart.c, you see that it checks for:

    #if !NRFX_CHECK(NRFX_UART0_ENABLED)

    #error "No enabled UART instances. Check <nrfx_config.h>."

    #endif 

     

    Have you defined NRFX_UART0_ENABLED to 1?

     

    BR.

    Edvin

Reply Children
  • That helped, thank-you. After NRFX_UART0_ENABLED there was also NRFX_UARTE0_ENABLED and now no more UART_ENABLED legacy layer in sdk_config.h, thank-you.

    I was hoping the same for GPIOTE_ENABLED (as detailed in original question), but the error, undefined reference to 'nrfx_gpiote_in_is_set' maybe could be linked to the changes I had to make to app_button.c (nrf_drv to nrfx).

    GPIOTE_ENABLED is the last legacy layer remaining.

    -thank-you.

  • Hello,

    Have you included the files nrfx_gpiote.c/h?

    And have you defined:

    "#define NRFX_GPIOTE_ENABLED 1" ?

    Did you also define GPIOTE_ENABLED?

     

    Or did I misunderstand your question?

  • All three had already been completed, I included nrfx_gpiote.c/h,   NRFX_GPIOTE_ENABLED=1, GPIOTE_ENABLED=1, and the project works fine. It is just when  GPIOTE_ENABLED=0 that I get error: undefined reference to 'nrfx_gpiote_in_is_set'. I do not have nrf_gpiote.c in the project, and do not want this last legacy layer.

  • Could you please send the project? Or at least a project where I can replicate the issue?

     

    BR,

    Edvin

  • Hello,

    Ok. I understand. I got your project from my colleague. I see what you mean with the app_button issue.

     

    If you remove the GPIPTE_ENABLED completely in sdk_config.h. It should be sufficient to comment out GPIOTE_ENABLED, but if you intend to remove it completely, and only use the nrfx drivers, I guess you can completely remove the GPIOTE_ENABLED section.

    // <e> GPIOTE_ENABLED - nrf_drv_gpiote - GPIOTE peripheral driver - legacy layer
    //==========================================================
    //#ifndef GPIOTE_ENABLED
    //#define GPIOTE_ENABLED 1
    //#endif
    // <o> GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS - Number of lower power input pins 
    #ifndef GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS
    #define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 4
    #endif

     

    The only error I get then is that app_button is missing nrf_drv_gpiote.h, which I assume that you have also removed. 

    All nrf_drv_gpiote.h does in SDK 15 is mapping the old nrf_drv_gpiote names to the new nrfx_gpiote names.

     

    Solutions:

    1. Either include this file, nrf_drv_gpiote.h which will map to the correct names.

    2. Alternatively, you can change the include in app_button.c from:

    #include "nrf_drv_gpiote.h"

    to

    #include "nrfx_gpiote.h"

    and then, change all the names and function calls that are used in app_button.c to the new ones in nrfx_gpiote.h. The correct names are listed in nrf_drv_gpiote.h.

     

    Best regards,

    Edvin

Related