Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to send data to UART for the provisioner example of mesh sdk.

Hi,

I am using nrf17.02 sdk and nrf mesh 5.0 sdk for nrf52832 dev kit.

1) I want to send the data to UART not on RTT while using the mesh example "provisioner" example of mesh sdk in place "meshsdk/example/provisioner". How to procees with it, can anyone help me?

2) I combined uart example of nrf 17.0 sdk with the provisioner example of mesh sdk but not able to receive the data over UART. Is this the right way to do, can i use uart example with the provisioner, if yes then can you please provide me the source code, as for me it is not working, i am not sure if having some issues in combining both the project of both sdks.

3) Can i use the provisioner code for dongle nrf52840(PCA10059) where i want to get data over USB, as it is mentioned in nordic infocenter that we can not. If we can then can you please provide me with required source code.

If anyone can help me, it is very helpful for me to proceed. Can anyone help me with high priority?

Thanks & Regards,

Ela

Parents
  • Hi,

    1) I suggest you look at the proximity coexist example you can see how the logging over UART is initialized instead of RTT. Then try to merge this logging functionality over to your application. 

    2) We do have an example in the SDK that combines UART with the light switch example. You can use this as a reference for how you can combine the uart example and the provisioner example. This is not something we have done so you have to try implementing yourself.

    3) Like it is mentioned here, only a few examples supports the dongle but with limited functionalities. It might be possible to modify the example so that it can run on the dongle, I would not recommend using the dongle since it lacks a onboard debugger and only light switch server example has been tested with the dongle.

  • Hi Mttrinh,

    1) I was using coexist example but i am not able to compile the code as throwing some of the errors, i have done the same way it is mentioned in the infocenter for coexist example, but still not able to test the coexist example.

    2) I have tried merging the code, but it did not work for me. I have doubt about logging module, as we do have backend logging too in the sdk. In mesh sdk we are using log.c file for logging via RTT but in nrf sdk we are using backend logging via RTT as in file nrf_backend_rtt.c . As, i want tio use provisioner code of the mesh sdk, which logging shall i used, shall i made changes only in log.c file  or shall i add backend logging via UART. I have tried both but nothing worked, when tried doing changes in log.c file having lot of errors when added backend logging for UART. Can you please help me in achieving this, if possible by providing changes need to be done or added in the provisioner code, it will be of great help.

    Thanks & Regards,

    Ela 

  • Hi Mttrinh,

    It will be very helpful if a working code can be provided as reference for the desired output.

    Thanks & Regards,

    Ela

  • Hi Mttrinh,

    It will be very helpful if a working code can be provided as reference for the desired output.

    Thanks & Regards,

    Ela

  • Ela said:
    1) Yes i have copied the ble_app_uart_coexist folder into ble_peripheral folder and set the MESH_ROOT in global macros to the mesh sdk path.

    This is strange, I would suggest you try download a fresh copy of the SDKs and see if that helpes solve this.

    As for the implementation, unfortunately we don't have an exact example to show you how to do this. Your implementation of your uart handler seems correct. Have you tried debugging through the code to see what happens? Does the code enter the uart handler when you send the commands? 

    It looks like in your main that you don't call uart_init()?

  • Hi Mttrinh,

    1) I have tried with freshly downloaded sdks but still face the same issue.

    2) I have called uart_init() in the initialize function of main.c attaching the code,

    static void initialize(void)
    {
        
          uart_init();
       
       // __LOG_INIT(LOG_SRC_APP | LOG_SRC_ACCESS, LOG_LEVEL_INFO, LOG_CALLBACK_DEFAULT);
        __LOG_INIT(LOG_SRC_APP | LOG_SRC_FRIEND, LOG_LEVEL_DBG1, log_callback_rtt);
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "----- BLE Mesh Static Provisioner Demo -----\n");
    
        ERROR_CHECK(app_timer_init());
        hal_leds_init();
    
    #if BUTTON_BOARD
        ERROR_CHECK(hal_buttons_init(button_event_handler));
    #endif
    
        ble_stack_init();
        mesh_init();
        node_setup_uri_check();
    }
    

    3) I have debugged this but not able to find out why it is not happening, i have put condition for scanning and resetting the does but not able to perform, not even able to reset the node. Can you find any memory issue, when i am pressing 4 nothing is coming as response, according to uart_event_handler it should reset the node, attaching the uart_event_handler which i have implemented for the desired output:

    void uart_event_handler(app_uart_evt_t * p_event)
    {
        static uint8_t data_array[244];
        static uint8_t index = 0;
       // static uint8_t val = 0;
        uint32_t       err_code;
    
         //printf("\r\nUART started uart event handler.\r\n");
        switch (p_event->evt_type)
        {
            case APP_UART_DATA_READY:
            {
                UNUSED_VARIABLE(app_uart_get(&data_array[index]));
                printf("Data array in switch %c\r\n",data_array[index]);
    
                index++;
    
                 if ( data_array[index - 1] == '1')
                {
                   printf("Sucess pressed 1 \r\n");
                   check_network_state();
                   index = 0;
                   memset(data_array[index], 0 , sizeof(data_array[index]));
    
                }
    
                if ( data_array[index - 1] == '2')
                {
                   printf("Sucess pressed 2 \r\n");
                   provisioning_resume();
                   index = 0;
                   memset(data_array[index], 0 , sizeof(data_array[index]));
    
                }
    
                 if ( data_array[index - 1] == '4')
                  {
                   printf("Sucess pressed 4 \r\n");
                 
                     if (mesh_stack_is_device_provisioned())
                     {
                       /* Clear all the states to reset the node. */
                       provisioner_invalidate();
                       mesh_stack_config_clear();
                     }
                   node_reset();
                   index = 0;
                   memset(data_array[index], 0 , sizeof(data_array[index]));
    
                  }
    
                    
                #if 0
                if ( data_array[index - 1] == ';')
                {
                   printf("sucess \r\n");
                   index = 0;
                   memset(data_array[index], 0 , sizeof(data_array[index]));
    
                }
                #endif
               
                    
                break;
                }
    
            case APP_UART_COMMUNICATION_ERROR:
                APP_ERROR_HANDLER(p_event->data.error_communication);
                break;
    
            case APP_UART_FIFO_ERROR:
                APP_ERROR_HANDLER(p_event->data.error_code);
                break;
    
            default:
                break;
        }
      }
    
    
    
     

    Can you please help me with this?

    Thanks & Regards,

    Ela

  • Hi Mttrinh,

    Any update for this?

    Thanks & Regards,

    Ela

Reply Children
No Data
Related