52840 NCS UART DFU

Hi

 I am currently working with my project with 52840 and i am using sdk v3.0.1 & toolchain v3.0.0 to develope.

 I am learning how to use DFU over UART from the application in Devacademy l9/e2 , it works fine using the example , after that i try it on my own project but because my project use one uart only , so UART DFU and my APP use the same uart(UART0) , and i added two config

CONFIG_SHELL=y
CONFIG_MCUMGR_TRANSPORT_SHELL=y

also init uart0 in my application 

void uart0_init(void)
{
    uint32_t err =  device_is_ready( dev_uart0 );

    if( err != true )
    {
        printk("\nUART_init_err = %d\n", err);
    }
    uart_irq_callback_user_data_set(dev_uart0,uart0_irq_callback, NULL )
   
    uart_irq_rx_enable( dev_uart0 );
}
i use Auterm(v0.35a) to Get image , Auterm data keep running into my uart0_irq_callback , not into MCUMGR shell
is there any way to let my application uart and uart dfu use the same uart and the same time without deinit the uart ? Thanks!
Parents
  • Hello,

    I believe this is expected behavior when you use UART0 simultaneously for two independent purposes, your own IRQ-driven application code and the MCUmgr Shell. UART hardware allows only one handler to be active per UART at a time.

    When you enable CONFIG_SHELL=y and CONFIG_MCUMGR_TRANSPORT_SHELL=y, it allows MCUmgr to handle DFU commands through the shell interface over UART. However, if your application also sets up its own UART interrupt handler (like uart0_irq_callback), it takes control of the UART and prevents the shell and MCUmgr from receiving data. That’s why the incoming data is going to your uart0_irq_callback instead of being handled by the MCUmgr shell.

    Kind Regards,

    Abhijith

Reply
  • Hello,

    I believe this is expected behavior when you use UART0 simultaneously for two independent purposes, your own IRQ-driven application code and the MCUmgr Shell. UART hardware allows only one handler to be active per UART at a time.

    When you enable CONFIG_SHELL=y and CONFIG_MCUMGR_TRANSPORT_SHELL=y, it allows MCUmgr to handle DFU commands through the shell interface over UART. However, if your application also sets up its own UART interrupt handler (like uart0_irq_callback), it takes control of the UART and prevents the shell and MCUmgr from receiving data. That’s why the incoming data is going to your uart0_irq_callback instead of being handled by the MCUmgr shell.

    Kind Regards,

    Abhijith

Children
  • Hi Menon:

        Thanks for reply. 

         I disabled the CONFIG_SHELL=n and CONFIG_MCUMGR_TRANSPORT_SHELL=n , cuz seem like its not needed if i am using Auterm.

      According to what you replied, if i want to process uart dfu, i need to deinit uart0 right?so i added this two

    uart_irq_callback_user_data_set( dev_uart0, NULL, NULL ); 

    uart_irq_rx_disable( dev_uart0 );

    after that i use Auterm to get Image again , and it seems not getting any data from Auterm.

    i was expeting to get this LOG <inf> mcuboot_util: Image index: 0, Swap type: none , but i seems not working at all.

    is there any way to solve it?

    Regards,

    Wu

Related