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

Parents Reply
  • 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

Children
  • okej its true,  but problem still exist 

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

    problem is in file nrf_derial.c line 207-209

    #if defined(UARTE_PRESENT) && defined(UART_PRESENT)

    drv_config.use_easy_dma = (p_config->mode == NRF_SERIAL_MODE_DMA);

    #endif

    nrf_drv_uart.h line 197

    struct nrf_drv_uart_config_t has member named ‘use_easy_dma’ if  this: 

    #if defined(NRF_DRV_UART_WITH_UARTE) && defined(NRF_DRV_UART_WITH_UART)

    my fix :

    instead of condition file nrf_derial.c  in line 207

    #if defined(UARTE_PRESENT) && defined(UART_PRESENT)

     

    replacing condition is from nrf_drv_uart.h line 197

    #if defined(NRF_DRV_UART_WITH_UARTE) && defined(NRF_DRV_UART_WITH_UART)

    it is correct fix? build complete 

  • So you didn't try the fix I suggested in the previous reply?

    It may work the way you describe. The issue with just avoiding one instance of #if defined() is that this check may be done several other places in your project (but maybe not). Also, remember that the changes you do in the generic SDK files applies to all projects using the same SDK.

    BR,

    Edvin

Related