Device reset happening and i can't able to upload the code

Hello,

In my project i am using  nrf52840 with my custom board and to upload the code through NRF_CONNECT application with soft device its uploading properly but with  segger emmbedded its giving some error like this .please have look and let me know what is the problem.

after this i have add DEBUG in preprocessor definition and i got this

thank you.

  • Hello,

    Actually i have copy the whole code and paste it to another app_ble_uart example and its build properly but its not working as expected so in my project i am using nrf52840 with 17.0.2 SDK , when device power up the device connected with customized APP and it should send the command over BLE at the same time the MCU is receiving the sensor data from the sensor board via RS232 or MAX232 so when MCU is receives the data froom the sensor board the device is disconnected from the APP or if data not received from  the sensor board ble connected fine and based on the commands it takes an action . so why its disconnected from the device when data received from the MAX232.??

    thank you.

  • Hi

    Can you try debugging and share the debug log with me, or what the disconnect reason is when the device disconnects after receiving data from this sensor? And how do you handle the data received from the MAX232 in order to send it over BLE?

    Best regards,

    Simon

  • Hello simonr,

    thanks for your  reply,

    while debugging i got this after few second 

    info> app: defualt break2
    <info> app: data_array2:
    K,0.00,0,0,110
    <info> app: opt1:0
    <info> app: defualt break2
    <info> app: data_array2:
    K,0.00,0,0,110
    <info> app: opt1:0
    <info> app: defualt break2
    <info> app: data_array2:
    K,0.00,0,0,110
    <info> app: data_array2:OK,0.00,0,0,110
    <info> app: data_array2:OK,0.00,0,0,110
    <info> app: data_array2:OK,0.00,0,0,110
    <info> app: data_array2:OK,0.00,0,0,110
    <info> app: data_array2:OK,0.00,0,0,110
    <info> app: data_array2:OK,0.00,0,0,110
    <info> app: data_array2:OK,0.00,0,0,110
    <info> app: data_array2:OK,0.00,0,0,110
    <info> app: data_array2:OK,0.00,0,0,110
    <info> app: iam in app uart cmn err
    <error> app: ERROR 1 [NRF_ERROR_SVC_HANDLER_MISSING] at C:\A\DeviceDownload\nRF5SDK1702d674dde\nRF5_SDK_17.0.2_d674dde\examples\
    <error> app: End of error report

    for more information i copy the error also .

    here data_array2 is the data from the sensor board and which is connected to the UART P1.3(TX), UART P1.4(RX) pins of the MCU and at this time BLE is connected to my MCU device but when i am trying to send the data from the customized APP its working for few second and its stopped by displaying the above error and BLE gets disconnected after this.

    this is uart_init() for handing the sensor data over MAX232 
    
    
    void uart_event_handle(app_uart_evt_t * p_event)
    {
      
        static uint8_t index = 0;
        uint32_t       err_code;
       
        switch (p_event->evt_type)
        {
            case APP_UART_DATA_READY:
                UNUSED_VARIABLE(app_uart_get(&data_array[index]));
                index++;
    
                if ((data_array[index - 1] == '\n') ||
                    (data_array[index - 1] == '\r') ||
                    (index >= m_ble_nus_max_data_len))
                {
                    if (index > 1)
                    {
                        NRF_LOG_DEBUG("Ready to send data over BLE NUS");
                        NRF_LOG_HEXDUMP_DEBUG(data_array, index);
    
                        do
                        {
                            uint16_t length = (uint16_t)index;
                            err_code = ble_nus_data_send(&m_nus, data_array, &length, m_conn_handle);
                            if ((err_code != NRF_ERROR_INVALID_STATE) &&
                                (err_code != NRF_ERROR_RESOURCES) &&
                                (err_code != NRF_ERROR_NOT_FOUND))
                            {
                                APP_ERROR_CHECK(err_code);
                            }
                        } while (err_code == NRF_ERROR_RESOURCES);
                    }
    
                    index = 0;
                }
                break;
    
            case APP_UART_COMMUNICATION_ERROR:
                NRF_LOG_INFO("iam in app uart cmn err");
                APP_ERROR_HANDLER(p_event->data.error_communication);
                break;
    
            case APP_UART_FIFO_ERROR:
                NRF_LOG_INFO("iam in app uart fifo err");
                APP_ERROR_HANDLER(p_event->data.error_code);
                break;
    
            default:
                NRF_LOG_INFO(" defualt break2");
                break;
        }
       
       NRF_LOG_INFO("data_array2:%s",data_array);
       data_init(data_array);
      
     //   memset(data_array,0,20);
     }
    
    static void uart_init(void)
    {
       
          uint32_t                     err_code;     
          app_uart_comm_params_t const comm_params =
        {
            .rx_pin_no    = RX_PIN,//(P1.4)
            .tx_pin_no    = TX_PIN,//(P1.3)
            .rts_pin_no   = RTS_PIN_NUMBER,
            .cts_pin_no   = CTS_PIN_NUMBER,
            .flow_control = APP_UART_FLOW_CONTROL_ENABLED,
            .use_parity   = false,
      #if defined (UART_PRESENT)
            .baud_rate    = NRF_UART_BAUDRATE_115200
    
    #else
            .baud_rate    = NRF_UARTE_BAUDRATE_115200
    #endif
        };
    
          APP_UART_FIFO_INIT(&comm_params,
                         UART_RX_BUF_SIZE,
                         UART_TX_BUF_SIZE,
                         uart_event_handle,
                         APP_IRQ_PRIORITY_LOWEST,
                         err_code);
    
      
        APP_ERROR_CHECK(err_code);
        NRF_LOG_INFO("err:%d",err_code);
    
    }
    
    
    
    

    this is for handling the ble_uart data 
    
    static void nus_data_handler(ble_nus_evt_t * p_evt)
    {
         uint8_t result[120]={};
        if (p_evt->type == BLE_NUS_EVT_RX_DATA)
        {
            uint32_t err_code;
           
            uint8_t *PRCS;
    
            NRF_LOG_DEBUG("Received data from BLE NUS. Writing data on UART.");
            NRF_LOG_HEXDUMP_DEBUG(p_evt->params.rx_data.p_data, p_evt->params.rx_data.length);
    
            for (uint32_t i = 0; i < p_evt->params.rx_data.length; i++)
            {
             result[i]=p_evt->params.rx_data.p_data[i];
          
            NRF_LOG_INFO("result:%s",result);
            NRF_LOG_FLUSH();
            }
    
    
            for (uint32_t i = 0; i < p_evt->params.rx_data.length; i++)
            {
               FINAL[i]=p_evt->params.rx_data.p_data[i];
            
            NRF_LOG_INFO("FINAL:%s",FINAL);
            NRF_LOG_FLUSH();
            
            }
            
           
            if((result[0]=='P') && (result[1]=='R') && (result[2]=='O'))
            {
                internal_process(result);
               
            }
    
             command_init(result);
            
            
          
    
    
        }
    
    }

    please let me know can i use single UART (P1.3,P1.4 ) for handling this to or i need to use two UART.

    from above error i got that when its connected to the ble its fine when data send from the mobile APP its received properly but at the same time data received from the sensor to the RX pin its getting disconnect .

    please help me to resolve this .

    thank you.

  • Hi

    Are you able to see what function or base number that is returning the NRF_ERROR_SVC_HANDLER_MISSING error, as this should give us an idea of what exactly is going wrong.

    Does your application enable the SoftDevice, and do you also flash the SoftDevice onto your device? What SoftDevice version are you using? Here you can read more on the SoftDevice and Supervisor Calls (SVC). You can get this error if you have not enabled the SoftDevice (using sd_ble_enable) or if the headers included for the SoftDevice are not the correct headers for the particular SoftDevice you are using.

  • Hello,

    Does your application enable the SoftDevice, and do you also flash the SoftDevice onto your device? What SoftDevice version are you using? Here you can read more on the SoftDevice and Supervisor Calls (SVC). You can get this error if you have not enabled the SoftDevice (using sd_ble_enable) or if the headers included for the SoftDevice are not the correct headers for the particular SoftDevice you are using.

    Yes, i have enabled the soft device and as i used SEGGER no need to flash the soft device separately right.

    _

    i am not sure exactly but when data send from the BLE UART its working fine but when data sending from the MAX232 uart_init -> uart_handler i think here its self problem raised .

    i have doubt like can we able to send the BLE UART data as well as MAX232 data to the same RX pin at a time i thought this is the problem i am using uart_init with TX=P1.3 , RX=P1.4 so both data  is  hit to the same RX PIN so that's why  its giving me error but i am not sure .

    please tell me is there possibility as i said above, if not how we can resolve it.??

    thank you.

Related