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

Using UART1 for SDK and UART0 for Mesh

Hi,

I am trying to integrate UART and DFU serial from the mesh example.

What I did is:

1. Adding uart drivers and libraries into the DFU project.

2. Adding codes of uart into DFU codes. I changed the priority of the art to "LOW".

3. Editing the sdk_config to enable uart1.

4. Programming an nrf52840 devkit by softdevice, dfu application, device page, and a bootloader as the board connected to the pc.

5. Programing an nrf52840 dongle by softdevice, dfu application, device page, and a bootloader as the target device.

Once I enter the command to send a file it returns:

Upgrading target on COM3 with DFU package D:\Behine Niroo\Nordic\NRF Mesh\nRF5_SDK_17.0.2_d674dde\examples\ble_peripheral\ble_app_blinky\pca10059\s140\ses\Output\Release\Exe\dfu_test.zip. Flow control is enabled.


Failed to upgrade target. Error is: Failed to establish connection

Possible causes:
- bootloader, SoftDevice or application on target does not match the requirements in the DFU package.
- baud rate or flow control is not the same as in the target bootloader.
- target is not in DFU mode. If using the SDK examples, press Button 4 and RESET and release both to enter DFU mode.
- if the error is ERROR_BUSY at the beginning of the DFU process,increase the value of PAGE_ERASE_TIME_MAX by few milliseconds.

What does make this problem? May this relate to the art codes I added?

I appreciate it if you advise me on this issue.

Br,

Sama

Parents
  • Hi Sama, 
    We need to have a look on how you modified the DFU project. I assume DFU works fine before you add the modification ? 


    I think what you would need to do is to verify that both UARTs work together. Have you tried to send some data to UART0 and UART1 , just don't test DFU before you verify that you can use both UARTs normally. 

  • Hi Hung,

    Thank you for your reply.

    The DFU works fine before modifying.


    #ifndef NRFX_UARTE1_ENABLED
    #define NRFX_UARTE1_ENABLED 1
    #endif


    #ifndef NRFX_UART_ENABLED
    #define NRFX_UART_ENABLED 1
    #endif


    #ifndef NRFX_UART0_ENABLED
    #define NRFX_UART0_ENABLED 0
    #endif


    #ifndef NRFX_UART1_ENABLED
    #define NRFX_UART1_ENABLED 1
    #endif

    #ifndef UART_ENABLED
    #define UART_ENABLED 1
    #endif


    #ifndef UART_LEGACY_SUPPORT
    #define UART_LEGACY_SUPPORT 0
    #endif


    #ifndef UART0_CONFIG_USE_EASY_DMA
    #define UART0_CONFIG_USE_EASY_DMA 0
    #endif

    #ifndef UART1_ENABLED
    #define UART1_ENABLED 1
    #endif

    #ifndef UART1_CONFIG_USE_EASY_DMA
    #define UART1_CONFIG_USE_EASY_DMA 1
    #endif

    #ifndef APP_FIFO_ENABLED
    #define APP_FIFO_ENABLED 1
    #endif


    #ifndef APP_UART_ENABLED
    #define APP_UART_ENABLED 1
    #endif


    #ifndef APP_UART_DRIVER_INSTANCE
    #define APP_UART_DRIVER_INSTANCE 1
    #endif


    #ifndef RETARGET_ENABLED
    #define RETARGET_ENABLED 1
    #endif

    Actually, I have been completely confused. I have been trying to enable uarte1 for nrf_log tasks in the uart example. It compiles without any error and I see that uarte1 is enabled at the code sources. However, I can not see nrf_log messages.

    I had a look at the libuarte in which there is an unclear description about the pin configuration. It is suggested to short Arduino pins, although it works in a loop test without shorting any pin.

    Could you clarify that the uarte1 and uart0 use the same pins? Is it possible to enable both uarts on the same pins and use them for different tasks asynchrony? For example, the uart0 is enabled as default and when I send a command it changes to uarte1. I tried to change APP_UART_DRIVER_INSTANCE but it did no work.

    What I want to do is using a USB connector for the mesh DFU over serial and using another USB connector for communication.

    I tried to add usbd cdc acm to DFU. I faced app_timer errors.

    Which method is the simplest way?

    I look forward to hearing from you.

    Br,

    Sama

  • Hi Sama, 
    No you can't use the same pin for UARTE0 (or UART) and UARTE1. 
    The dual uart example (serial_uartes) you pointed to use the same pin: 
    RX pin on UARTE0 as the TX pin on UARTE1 just to show how a loop back can be done. 
    In reality if you want to use 2 UARTs at the same time you need to use different pins. 

    I don't really understand what you meant by "USB connector for the mesh DFU over serial " I assume it's the USB over USB of the Jlink chip (the normal virtual UART we have when we connect the DK to PC ? )

    Are you planning to use usbd cdc or you are planning to use UARTE1, please stick to one solution only. 

    I strongly recommend you to test both UART using normal application first before you move to mesh and before you move to mesh DFU. 
    You need to be able to understand how things work before you move to more complicated application. 

    Building with no error doesn't mean that it's working. 

Reply
  • Hi Sama, 
    No you can't use the same pin for UARTE0 (or UART) and UARTE1. 
    The dual uart example (serial_uartes) you pointed to use the same pin: 
    RX pin on UARTE0 as the TX pin on UARTE1 just to show how a loop back can be done. 
    In reality if you want to use 2 UARTs at the same time you need to use different pins. 

    I don't really understand what you meant by "USB connector for the mesh DFU over serial " I assume it's the USB over USB of the Jlink chip (the normal virtual UART we have when we connect the DK to PC ? )

    Are you planning to use usbd cdc or you are planning to use UARTE1, please stick to one solution only. 

    I strongly recommend you to test both UART using normal application first before you move to mesh and before you move to mesh DFU. 
    You need to be able to understand how things work before you move to more complicated application. 

    Building with no error doesn't mean that it's working. 

Children
No Data
Related