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

integration usbd acd acm with DFU mesh

Hi,

I want to add DFU over mesh and usbd into the client example. 

I have faced an error of Multiple definitions of UARTE0_UART0_IRQHandler. I comment out the UARTE0_UART0_IRQHandler in the ses_startup. I tried to use UARTE1 for usbd by enabling the flags of uarte1 in the sdk_config. the codes are built without any compiler error but I can not see comport for usbd.

Could you please advise me?

Br,

Sama

Parents
  • Hi,

    Is there any solution?

    I look forward to hearing from you.

    Br,

    Sama

  • Hi,

    I have been waiting for a long time without any response.

    I managed to add USBD CDC ACM to the client example including DFU over serial, and I can send and receive data via USB port.

    Now, all I want to do is send the data from the serial terminal on the detected USB PORT and then publish it over the mesh.


    I have a function named "send message" as below, called when data received from the USB port.

    void send_message (void) 
    {
        uint32_t status=0;
        char buffer[8];///={0x44,0x61,0x74,0x61};
        uint8_t length;
        uint16_t address;
        access_message_tx_t msg;
        length= sizeof(buffer);
                   if (length)
                    { 
                      msg.opcode.opcode = simple_message_OPCODE_SEND ;
                      msg.opcode.company_id = 0x0059; // Nordic's company ID
          
                      msg.p_buffer = (const uint8_t *) &buffer[0];
                      msg.length =length;
                
                      
    
                      //SEGGER_RTT_printf(0,"Sending to group address 0x%04x\n", address);
                      status= access_model_publish(m_clients[0].model_handle, &msg);        //CHANGED TO 0 FROM 3 
                      __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Status : %u \n", status);
    
                      if (status == NRF_ERROR_INVALID_STATE ||
                      status == NRF_ERROR_BUSY||status == NRF_ERROR_NO_MEM)
                       {
                         __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Cannot send. Device is busy.\n");
                          hal_led_blink_ms(LEDS_MASK, 50, 4);
                       }
                       else
                       {
                             ERROR_CHECK(status);
                       }
                    }
    
    }

    I get the error when I send data:


    app_error_weak.c, 105, Mesh assert at 0x0002CDF8 (:0)
    which I got with adding UART into client example, and I asked in this ticket.

    I have used the addr2line tool and it returned:

    ....\mesh\core\src/timer_scheduler.c:218 (discriminator 1).


    I have searched the Devzone, and I found out this is related to the priority level. As far as I understood, when I call a mesh API from a handler, it is needed to initialize the mesh with "NRF_MESH_IRQ_PRIORITY_LOWEST" and use the same priority level for the user interrupt (cdc_acm_user_ev_handler in this situation).

    Here is the mesh init function:

    static void mesh_init(void)
    {
    mesh_stack_init_params_t init_params =
    {
    .core.irq_priority = NRF_MESH_IRQ_PRIORITY_LOWEST,
    .core.lfclksrc = DEV_BOARD_LF_CLK_CFG,
    .core.p_uuid = NULL,
    .models.models_init_cb = models_init_cb,
    .models.config_server_cb = config_server_evt_cb
    };

    and here is the priority setting of USBD:

    #ifndef NRFX_USBD_CONFIG_IRQ_PRIORITY
    #define NRFX_USBD_CONFIG_IRQ_PRIORITY 6
    #endif

    #ifndef USBD_CONFIG_IRQ_PRIORITY
    #define USBD_CONFIG_IRQ_PRIORITY 6
    #endif


    Any solution?

    Please let me know if I should create a new ticket.

    Br,
    Sama

Reply
  • Hi,

    I have been waiting for a long time without any response.

    I managed to add USBD CDC ACM to the client example including DFU over serial, and I can send and receive data via USB port.

    Now, all I want to do is send the data from the serial terminal on the detected USB PORT and then publish it over the mesh.


    I have a function named "send message" as below, called when data received from the USB port.

    void send_message (void) 
    {
        uint32_t status=0;
        char buffer[8];///={0x44,0x61,0x74,0x61};
        uint8_t length;
        uint16_t address;
        access_message_tx_t msg;
        length= sizeof(buffer);
                   if (length)
                    { 
                      msg.opcode.opcode = simple_message_OPCODE_SEND ;
                      msg.opcode.company_id = 0x0059; // Nordic's company ID
          
                      msg.p_buffer = (const uint8_t *) &buffer[0];
                      msg.length =length;
                
                      
    
                      //SEGGER_RTT_printf(0,"Sending to group address 0x%04x\n", address);
                      status= access_model_publish(m_clients[0].model_handle, &msg);        //CHANGED TO 0 FROM 3 
                      __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Status : %u \n", status);
    
                      if (status == NRF_ERROR_INVALID_STATE ||
                      status == NRF_ERROR_BUSY||status == NRF_ERROR_NO_MEM)
                       {
                         __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Cannot send. Device is busy.\n");
                          hal_led_blink_ms(LEDS_MASK, 50, 4);
                       }
                       else
                       {
                             ERROR_CHECK(status);
                       }
                    }
    
    }

    I get the error when I send data:


    app_error_weak.c, 105, Mesh assert at 0x0002CDF8 (:0)
    which I got with adding UART into client example, and I asked in this ticket.

    I have used the addr2line tool and it returned:

    ....\mesh\core\src/timer_scheduler.c:218 (discriminator 1).


    I have searched the Devzone, and I found out this is related to the priority level. As far as I understood, when I call a mesh API from a handler, it is needed to initialize the mesh with "NRF_MESH_IRQ_PRIORITY_LOWEST" and use the same priority level for the user interrupt (cdc_acm_user_ev_handler in this situation).

    Here is the mesh init function:

    static void mesh_init(void)
    {
    mesh_stack_init_params_t init_params =
    {
    .core.irq_priority = NRF_MESH_IRQ_PRIORITY_LOWEST,
    .core.lfclksrc = DEV_BOARD_LF_CLK_CFG,
    .core.p_uuid = NULL,
    .models.models_init_cb = models_init_cb,
    .models.config_server_cb = config_server_evt_cb
    };

    and here is the priority setting of USBD:

    #ifndef NRFX_USBD_CONFIG_IRQ_PRIORITY
    #define NRFX_USBD_CONFIG_IRQ_PRIORITY 6
    #endif

    #ifndef USBD_CONFIG_IRQ_PRIORITY
    #define USBD_CONFIG_IRQ_PRIORITY 6
    #endif


    Any solution?

    Please let me know if I should create a new ticket.

    Br,
    Sama

Children
Related