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

Errors when modifying the UART/serial port emulation project to run in a serialized connection

Hi,

I have built the example hrs_uart project and it works fine when I load the image into a pair of OCA10040 demo boards, one as application board and the other as connectivity board.

I am trying to modify the UART/serial emulation project to run in the same way.

I copied the hrs_uart folder to the UART/serial folder.  in the sdk_config.h file I enabled the nus service and disabled the hrs services.

it was built OK. However, when I run it, It had a fatal error.

I debugged it and found that the function call nrfx_uarte_init returned with an error code 8.

please help on this issue

Parents
  • Hi,

    The driver returns this invalid state error if the application tries to initialize the driver multiple times, so there are probably mor than one user of the UART in your program. Please check if the NRF_LOG_BACKEND_UART_ENABLED setting is disabled in your sdk_config.h header. Maybe it's the logger module that tries to use it.  For logging you can use RTT (NRF_LOG_BACKEND_RTT_ENABLED).

    Best regards,

    Vidar

  • Hi Vidar,

    I have just found out that this nRF52832 has only one UART port. 

    To modify the UART/serial port emulation project and make it work on a pair of serialized PCA10040 boards seems impossible. It need one UART to face PC and another one to face the connectivity boards. Is it correct?

    Thank you for your help

  • Yes, this will not work on the 52832 unfortunately. Unless it is an option to use the SPI serialization transport?

  • Hi Vidar,

    I just used a PCA10056 to replace the application board PCA10040. This nRF52840 should have two uart ports on the chip.

    However, still it can be built, when run, it stops with that error code 8. As you suggested, it could  be an issue when initialize the UART.

    I checked the code and see these,

    in app_uart.c:  

    static nrf_drv_uart_t app_uart_inst = NRF_DRV_UART_INSTANCE(APP_UART_DRIVER_INSTANCE);

    in sdk_config.h:

    #define APP_UART_DRIVER_INSTANCE  0

    in ser_phy_uart.c:

    static const nrf_drv_uart_t m_uart = NRF_DRV_UART_INSTANCE(0);

    It seems they are trying to initialize with the same ID.

    I have no clue to configure the SDK for these two UARTs. 

    Thank you for your help!

Reply
  • Hi Vidar,

    I just used a PCA10056 to replace the application board PCA10040. This nRF52840 should have two uart ports on the chip.

    However, still it can be built, when run, it stops with that error code 8. As you suggested, it could  be an issue when initialize the UART.

    I checked the code and see these,

    in app_uart.c:  

    static nrf_drv_uart_t app_uart_inst = NRF_DRV_UART_INSTANCE(APP_UART_DRIVER_INSTANCE);

    in sdk_config.h:

    #define APP_UART_DRIVER_INSTANCE  0

    in ser_phy_uart.c:

    static const nrf_drv_uart_t m_uart = NRF_DRV_UART_INSTANCE(0);

    It seems they are trying to initialize with the same ID.

    I have no clue to configure the SDK for these two UARTs. 

    Thank you for your help!

Children
Related