Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

uart_serial UARTE1 sdk_config issue

I'm having a frustrating time trying to enable UARTE1 to stream fast ADC results to a terminal.

I believe I have edited sdk_config.h correctly, but looking at nrf_serial.c in SES I see that nrf_serial.h is greyed out.

I have successfully built and run the serial and serial uartes examples, but when I try to patch these examples into my existing project it won't build as 'nrf_serial.h cannot be found'

I guess it's something to do with the sdk_config, but I've tried all combinations of enabling / disabling UARTs but without success.  I am using SPIM0 / TWIM1 and SPIS2 without errors - do any of these conflict with UARTE1 on the '840?

Segger RTT is using UARTE0(?) hence trying to enable UARTE1.

Is there a trick to this?

sdk_config.h

  • Hey Tony,


    You need to enable UARTE0 on both the legacy and NRFX layers:

    // <e> UART_ENABLED - nrf_drv_uart - UART/UARTE peripheral driver - legacy layer
    //==========================================================
    #ifndef UART_ENABLED
    #define UART_ENABLED 1
    #endif
    
    // <o> UART0_ENABLED - Enable UART0 instance
    //==========================================================
    #ifndef UART0_ENABLED
    #define UART0_ENABLED 1
    #endif
    
    // <o> UART1_ENABLED - Enable UART1 instance
    //==========================================================
    #ifndef UART1_ENABLED
    #define UART1_ENABLED 0
    #endif
    
    
    
    // <e> NRFX_UARTE_ENABLED - nrfx_uarte - UARTE peripheral driver
    //==========================================================
    #ifndef NRFX_UARTE_ENABLED
    #define NRFX_UARTE_ENABLED 1
    #endif
    // <o> NRFX_UARTE0_ENABLED - Enable UARTE0 instance 
    #ifndef NRFX_UARTE0_ENABLED
    #define NRFX_UARTE0_ENABLED 1
    #endif
    
    // <o> NRFX_UARTE1_ENABLED - Enable UARTE1 instance 
    #ifndef NRFX_UARTE1_ENABLED
    #define NRFX_UARTE1_ENABLED 0
    #endif

     

    Segger RTT is using UARTE0(?) hence trying to enable UARTE1.

    No, the RTT uses the SWD interface as the transport between the nRF and the J-link OB debugger device.

    I am using SPIM0 / TWIM1 and SPIS2 without errors - do any of these conflict with UARTE1 on the '840?

     No, there should be no conflict between the SPI/TWI peripherals and the UARTE peripherals. 

  • Thanks for the prompt feedback, but that didn't make any difference. I needed to add this to the sdk_config.h.....

    // <q> NRF_SERIAL_ENABLED  - nrf_serial - Serial port interface
     
    
    #ifndef NRF_SERIAL_ENABLED
    #define NRF_SERIAL_ENABLED 1
    #endif
    

    However, I still have an error reported..

     3731.sdk_config.h

    I've attached my updated sdk_config.h  I'm guessing I still have a miissing #define?

  • You probably have to include the queue library, both the source and header file to the IDE and to sdk_config.h, like you did with the serial library.

    I suggest you study the serial example in sdk/examples/peripheral/serial, as that should have set up the serial library properly. Then you can copy the relevant parts of the sdk_config, see what's included of source files, and copy the paths to the necessary header file.

  • Hi Haakon

    I had missing include directories in the preprocessor options.
    Thanks for the steer

Related