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

implementation UART to examples from SDK

Hello, 

I have problem with implementing UART to simple_coap_client example, but there is too much problems. Some issues have been solved, but it still is not all. 

defines in sdk_config.h  -solved 

uart0 - used by openthread lib -solved

Can you help me with best way to use COAP and UART in same project?  

 

nRF5_SDK_for_Thread_and_Zigbee_2.0.0_29775ac

Linux ubuntu 18.04

Segger studio

  • What compiler/IDE are you using? 

    Can you send the project in a .zip folder? (ps: it may be too large to upload here. Just delete the build files, and zip it).

    Best regards,

    Edvin

  • this is link to google drive zip file of SDK 

    project is simple_coap_client

    drive.google.com/open

  • Hello,

    Can you try to change the define in sdk_config.h:

    #define NRFX_PRS_ENABLED 1

    to

    #define NRFX_PRS_ENABLED 0.

    On my end, this makes the project compile, and I can still use the CLI. I don't know what you intend to use the other UART for, but can you try this and see if it works?

    Best regards,

    Edvin

  • OK thanks it works, but i comment one line but its not correct fix 

    in file nrf_serial.c

    #if defined(UARTE_PRESENT) && defined(UART_PRESENT)
        drv_config.use_easy_dma = (p_config->mode == NRF_SERIAL_MODE_DMA);
    #endif

    ‘nrf_drv_uart_config_t {aka struct <anonymous>}’ has no member named ‘use_easy_dma’

  • Hello,

    I see. It seems like these drivers were written mainly for UART0. 

    If you look at nrf_drv_uart.h line 200 and up, the bool use_easy_dma is only declared if:

    NRF_DRV_UART_WITH_UARTE is defined and NRF_DRV_UART_WITH_UART is defined.

    NRF_DRV_UART_WITH_UARTE is defined, so that is fine.

    NRF_DRV_UART_WITH_UART is only defined if:

    UART_PRESENT is defined and NRFX_UART_ENABLED is 1.

    UART_PRESENT is defined, so that is fine.

    NRFX_UART_ENABLED is defined in sdk_config.h, so it should be fine, BUT:

    there is a file called apply_old_config.h. Look in this file on line 1278, it says:

    #define NRFX_UART_ENABLED   (UART_ENABLED && NRFX_UART0_ENABLED)

    So NRFX_UART_ENABLED is first defined in sdk_config.h, then undefined in apply_old_config.h on line 1277, then defined as UART_ENABLED && NRFX_UART0_ENABLED.

    (This is why I said that this driver was written mainly for UART0). Try to change line 1278 in apply_old_config.h as:

    #define NRFX_UART_ENABLED   (UART_ENABLED && (NRFX_UART0_ENABLED || NRFX_UART1_ENABLED))

    This passes this compiler error, but there is more:

    in nrfx_uart.c on line 45-47:

    #if !NRFX_CHECK(NRFX_UART0_ENABLED)
    #error "No enabled UART instances. Check <nrfx_config.h>."
    #endif

    Change the check to:

    #if (!NRFX_CHECK(NRFX_UART0_ENABLED) && !NRFX_CHECK(NRFX_UART1_ENABLED))

    I have reported these bugs regarding only checking NRFX_UART0_ENABLED internally.

    Best regards,

    Edvin

Related