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

where to define UARTs for the file nrf_drv_uart.h

I have combined the ble_app_uart_c with mesh light switch example. In the file nrf_drv_uart.h it does not show the same "active defines"  as with the original ble_app_uart_c.  UARTE_PRESENT, NRFX_UARTE_ENABLED,UART_PRESENT and NRFX_UART_ENABLED are undefined, hence a compile error.

I have gone through  SDK_config.h and enabled them there I have also tried CMSIS configuration wizard. I have also tried in the pre_processor, but cant get the defines to activate. I see in the top of sdk_config there is a header file active "app_config.h" (which  is in the preprocessor) I have also added the top four defines there.

Anywhere else I can try?

thank you

Parents
  • If you try to redefine the variables in the SDK, you can see from the output transcript when building the project that the location of the defines are in $(SDK_ROOT)/modules/nrfx/mdk/nrf_peripherals.h. For me, i use nrf52840 and thus the defines are located in nrf52840_peripherals.h at line 225-230. 

    So if I've got it right, UARTE_PRESENT and UART_PRESENT should be located in the pheripherals header and NRFX_UARTE_ENABLED and NRFX_UART_ENABLED should be in your sdk_config.h. 

  • Thanks Krfjpe, my defines are set to "1" in nrf52840_peripherals.h and  sdk_config.h. result is still the same. 

  • Hi,

    It appears I have the same error now. In your sdk_config.h, how does this snippet look for you? 

    #ifndef UART_ENABLED
    #define UART_ENABLED 1
    #endif
    If it appears shadowed, try to define it right above and see where it has been defined previously.

  • It looks the same, not shadowed.  It wont have anything to do with app_config.h specified in the pre processor in the light switch example?

    I have also noticed  in app.uart_fifo.c the following is shadowed.  and my entire retarget.c is shadowed.

    #if NRF_MODULE_ENABLED(APP_UART)

  • Krdjpe,Yip I have looked at all the threads, from co-exit, to BLE_uart to mesh, Mesh to BLE_UART and so far no luck. Bear in mind also these threads are old with sdk 12,14 and Mesh 2.. Im using SDK 15.2 Mesh 3.1.

    This is what I have done. I have taken a working light switch example and added all the .c files and all the .h files for the SDK 15.2\examples\periphiral\uart. This is the most basic  peripheral example I could find. I have not added any additional code to the original light switch example except  the required header files. I have also compared the sdk_config.h file between mesh and sdk15.2. 

    here is my findings.

    1 the following defines is in the UART sdk 15.2 example but not the mesh example. I have added them

    //==========================================================
    // <e> NRFX_PRS_ENABLED - nrfx_prs - Peripheral Resource Sharing module
    //==========================================================
    #ifndef NRFX_PRS_ENABLED
    #define NRFX_PRS_ENABLED 1
    #endif
    
    
    // <q> NRFX_PRS_BOX_4_ENABLED  - Enables box 4 in the module.
     
    
    #ifndef NRFX_PRS_BOX_4_ENABLED
    #define NRFX_PRS_BOX_4_ENABLED 1
    #endif
    
    
    // <q> RETARGET_ENABLED  - retarget - Retargeting stdio functions
     
    
    #ifndef RETARGET_ENABLED
    #define RETARGET_ENABLED 1
    #endif
    //==========================================================
    
    // <h> nRF_Libraries 
    
    //==========================================================
    // <q> APP_FIFO_ENABLED  - app_fifo - Software FIFO implementation
     
    
    #ifndef APP_FIFO_ENABLED
    #define APP_FIFO_ENABLED 1
    #endif
    
    // <e> APP_UART_ENABLED - app_uart - UART driver
    //==========================================================
    #ifndef APP_UART_ENABLED
    #define APP_UART_ENABLED 1
    #endif
    

    2.If I manually redefine in main.c (to check for duplicates) 

    #define UART_PRESENT 1
    #define  NRFX_UART_ENABLED 1
    #define  UARTE_PRESENT 1
    #define  NRFX_UARTE_ENABLED 1

    I get duplicated in nrf52840_perphirals.h  and funny enough in apply_old_config.h

    apply_old_config.h is completely shadowed out.

    If I double up my sdk_config. (copy the entire contents and paste it at the bottom) I can see the compiler is not even looking at this file.

    This must be defined somewhere else I assume.

    looking forward to your advice.

Reply
  • Krdjpe,Yip I have looked at all the threads, from co-exit, to BLE_uart to mesh, Mesh to BLE_UART and so far no luck. Bear in mind also these threads are old with sdk 12,14 and Mesh 2.. Im using SDK 15.2 Mesh 3.1.

    This is what I have done. I have taken a working light switch example and added all the .c files and all the .h files for the SDK 15.2\examples\periphiral\uart. This is the most basic  peripheral example I could find. I have not added any additional code to the original light switch example except  the required header files. I have also compared the sdk_config.h file between mesh and sdk15.2. 

    here is my findings.

    1 the following defines is in the UART sdk 15.2 example but not the mesh example. I have added them

    //==========================================================
    // <e> NRFX_PRS_ENABLED - nrfx_prs - Peripheral Resource Sharing module
    //==========================================================
    #ifndef NRFX_PRS_ENABLED
    #define NRFX_PRS_ENABLED 1
    #endif
    
    
    // <q> NRFX_PRS_BOX_4_ENABLED  - Enables box 4 in the module.
     
    
    #ifndef NRFX_PRS_BOX_4_ENABLED
    #define NRFX_PRS_BOX_4_ENABLED 1
    #endif
    
    
    // <q> RETARGET_ENABLED  - retarget - Retargeting stdio functions
     
    
    #ifndef RETARGET_ENABLED
    #define RETARGET_ENABLED 1
    #endif
    //==========================================================
    
    // <h> nRF_Libraries 
    
    //==========================================================
    // <q> APP_FIFO_ENABLED  - app_fifo - Software FIFO implementation
     
    
    #ifndef APP_FIFO_ENABLED
    #define APP_FIFO_ENABLED 1
    #endif
    
    // <e> APP_UART_ENABLED - app_uart - UART driver
    //==========================================================
    #ifndef APP_UART_ENABLED
    #define APP_UART_ENABLED 1
    #endif
    

    2.If I manually redefine in main.c (to check for duplicates) 

    #define UART_PRESENT 1
    #define  NRFX_UART_ENABLED 1
    #define  UARTE_PRESENT 1
    #define  NRFX_UARTE_ENABLED 1

    I get duplicated in nrf52840_perphirals.h  and funny enough in apply_old_config.h

    apply_old_config.h is completely shadowed out.

    If I double up my sdk_config. (copy the entire contents and paste it at the bottom) I can see the compiler is not even looking at this file.

    This must be defined somewhere else I assume.

    looking forward to your advice.

Children
  • I must say I am stuck in the same place as you are describing above, except that I am trying to get it working with an OpenThread application. 

    It looks like an issue occurs while using the legacy drivers as 'nrf_drv_uart.h' in app_uart instead of the nrfx drivers.

    Let me know if you figure something out, I'll try again tomorrow and maybe post a new question.

Related