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

How to use UARTE1 for mesh serial DFU instead of UARTE0?

Current situation:

    I am using uarte to communicate over UART, at Individual level this works.
    I have serial mesh DFU implemented in my application and at individual level this works. (I see the serial_uart_init uses NRF_UART0 directly)

Now I have to integrate both in same application. I tried it and I'm getting following error

1> build/aio_Debug/obj/nrfx_uarte.o: In function `UARTE0_UART0_IRQHandler':
1> /home/shubham/aio/nRF_SDKs/nRF5_SDK_15.2.0_9412b96/modules/nrfx/drivers/src/nrfx_uarte.c:575: multiple definition of `UARTE0_UART0_IRQHandler'
1> build/aio_Debug/obj/serial_uart.o:/home/shubham/aio/nRF_SDKs/nrf5SDKforMeshv310src/mesh/serial/src/serial_uart.c:60: first defined here
Build failed


Rather I would like to know how to use both UARTs is there any simpler way to integrate both usages?

Parents
  • Hi Shubham, 

    Could you tell what you use UART for? If you use UART for purely logging and debugging, I would suggest to use RTT.

    If you user UART for communication, you would need to chose to use either nrfx_uarte.c or serial_uart.c 

    I would suggest to use serial_uart.c (serial.c)  to not to break the DFU features that included inside the serial library of Mesh. 

    In that case you would need to adapt your protocol to into the m_cmd_handlers[] list as defined in serial.c 

    x Is it possible to use different UART ? You may think of using UART instead of UARTE ? 

    If you want to use the same UART/UARTE, one option is to use a flag, so you will have single UARTE0_UART0_IRQHandler() but depend on the flag, you can call either the handler inside the nrfx_uarte.c or the handler inside serial_uart.c 

    What is your exact use case ? 

  • you will have single UARTE0_UART0_IRQHandler() but depend on the flag, you can call either the handler inside the nrfx_uarte.c or the handler inside serial_uart.c 

    How to decide which handler to call?

  • This only applied if you don't plan to have both UART operating simultaneously. If you know exactly when you want to do DFU then you can switch the flag to forward the interrupt to serial_uart.c

    For your application, I would suggest to follow the first suggestion to use only serial_uart.c and then add your own opcode into the list. 

  • Hey Hung,

    It is working.

    In sdk_config.h, enabled UART0_ENABLED, UART1_ENABLED and UART_EASY_DMA_SUPPORT.
    Above setting enables NRFX_UARTE0_ENABLED and NRFX_UARTE1_ENABLED.

    I used UARTE1 in nrf sdk and commented the IRQ handler for UARTE0.

    This way I can use UARTE1 from nrf sdk and nrf mesh sdk uses UART0.

    So I am not getting any build conflicts as well as both serials are working fine just that I changed the pin numbers in serial_uart.c


    Do you see any downside here? FYI, for serial DFU, I will be getting firmware on UARTE1 and then I may have to direct it to mesh sdk's UART.

Reply
  • Hey Hung,

    It is working.

    In sdk_config.h, enabled UART0_ENABLED, UART1_ENABLED and UART_EASY_DMA_SUPPORT.
    Above setting enables NRFX_UARTE0_ENABLED and NRFX_UARTE1_ENABLED.

    I used UARTE1 in nrf sdk and commented the IRQ handler for UARTE0.

    This way I can use UARTE1 from nrf sdk and nrf mesh sdk uses UART0.

    So I am not getting any build conflicts as well as both serials are working fine just that I changed the pin numbers in serial_uart.c


    Do you see any downside here? FYI, for serial DFU, I will be getting firmware on UARTE1 and then I may have to direct it to mesh sdk's UART.

Children
No Data
Related