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

app_uart_get more than 1 byte

Hi,

I'm using app_uart for communication between different mcu. I can send more than 1 byte like "0x3917015623"  through  changing tx_buffer[0] to tx_buffer[5]. Unfortunately i couldn't recieve the slave devicess message "0x2917013607". I can only get the first byte "0x07". My configuration are the same as uart example. How can i recieve all the message ?. I tried to use serial library but i couldn't initialize. (It gave ERROR 6 NRF_ERROR_NOT_SUPPORTED).

Slave device is sending me a message every second. And i'm calling app_uart_get function every 500 miliseconds.

Here is my uart init;

void uart_error_handle(app_uart_evt_t * p_event)
{
    if (p_event->evt_type == APP_UART_COMMUNICATION_ERROR)
    {
        APP_ERROR_HANDLER(p_event->data.error_communication);
    }
    else if (p_event->evt_type == APP_UART_FIFO_ERROR)
    {
        APP_ERROR_HANDLER(p_event->data.error_code);
    }    
}

void uart_init(void)
{
    uint32_t err_code;
    const app_uart_comm_params_t comm_params =
        {
            RX_PIN_NUMBER,
            TX_PIN_NUMBER,
            RTS_PIN_NUMBER,
            CTS_PIN_NUMBER,
            UART_HWFC,
            false,
  #if defined (UART_PRESENT)
            NRF_UART_BAUDRATE_115200
  #else
            NRF_UARTE_BAUDRATE_9600
  #endif
        };
//    const app_uart_buffers_t m_buffers =
//      {
//        &rx_buffer_s,
//        sizeof(rx_buffer_s),
//        &tx_buffer_s,
//        sizeof(tx_buffer_s)
//      }
      APP_UART_FIFO_INIT(&comm_params,
                           UART_RX_BUF_SIZE,
                           UART_TX_BUF_SIZE,
                           uart_error_handle,
                           APP_IRQ_PRIORITY_LOWEST,
                           err_code);

      APP_ERROR_CHECK(err_code);
//      err_code = app_uart_init(&comm_params, &m_buffers, uart_error_handle, APP_IRQ_PRIORITY_LOW);
//      APP_ERROR_CHECK(err_code);
  
}

Regards,

Parents
  • I tried to use serial library but i couldn't initialize. (It gave ERROR 6 NRF_ERROR_NOT_SUPPORTED).

     Which function returned NRF_ERROR_NOT_SUPPORTED?

  • nrf_serial_init function was returning NRF_ERROR_NOT_SUPPORTED. I fixed that error yesterday. I did a lot of things. I couldn't remember exactly but i remember that i changed some code in nrf_serial.c . Now, i can send 5 byte data on TX_PIN  but i received wrong data from slave. Also i am using MAX485 IC for communication. I need to set RTS_PIN before sending operation and clear it before receive operation. But nrf_gpio_pin_set or nrf_gpio_pin_clear command doesn't effect the RTS_PIN. When i deactive UART module then these command are starting to work. When UART module enabled, RTS_PIN goes high at wrong time and out of my control. Time between sending operation and RTS_PIN high is about 95 ms. It should be at the same time. So how can i control RTS pin while UART Module enabled.(I can control other gpio when uart enabled.)

    here is my serial init code:

    NRF_SERIAL_DRV_UART_CONFIG_DEF(m_uart0_drv_config,
                          RX_PIN_NUMBER, TX_PIN_NUMBER,
                          RTS_PIN_NUMBER, CTS_PIN_NUMBER,
                          NRF_UART_HWFC_ENABLED, NRF_UART_PARITY_EXCLUDED,
                          NRF_UART_BAUDRATE_9600,
                          UART_DEFAULT_CONFIG_IRQ_PRIORITY);
    
    #define SERIAL_FIFO_TX_SIZE 32
    #define SERIAL_FIFO_RX_SIZE 32
    
    NRF_SERIAL_QUEUES_DEF(serial_queues, SERIAL_FIFO_TX_SIZE, SERIAL_FIFO_RX_SIZE);
    
    #define SERIAL_BUFF_TX_SIZE 5
    #define SERIAL_BUFF_RX_SIZE 5
    
    NRF_SERIAL_BUFFERS_DEF(serial_buffs, SERIAL_BUFF_TX_SIZE, SERIAL_BUFF_RX_SIZE);
    
    NRF_SERIAL_CONFIG_DEF(serial_config, NRF_SERIAL_MODE_IRQ,
                          &serial_queues, &serial_buffs, NULL, NULL);
    
    
    NRF_SERIAL_UART_DEF(serial_uart, 0);
    
        ret_code_t ret;
    //    ret = nrf_drv_clock_init();
    //    APP_ERROR_CHECK(ret);
    //    ret = nrf_drv_power_init(NULL);
    //    APP_ERROR_CHECK(ret);
    
        nrf_drv_clock_lfclk_request(NULL);
        ret = app_timer_init();
        APP_ERROR_CHECK(ret);
        
        ret = nrf_serial_init(&serial_uart, &m_uart0_drv_config, &serial_config);
        APP_ERROR_CHECK(ret);

  • Yes, error code 13( decimal ) is NRF_ERROR_TIMEOUT. 

    Ok, will wait for the update from you. 

    Best regards

    Bjørn

  • I pretty solved the rx pin problem. I started to use the SN65HVD72 IC instead of MAX485.  I can receive the message but NRF_ERROR_TIMEOUT error very offen happens. I changed nrf_serial_read function's time out parameters but didn't helped. My transmitter send a byte 0 to 255. Here is the outputs of receiver side  (I print first return code in decimal, secondly received data):

    <info> app: Recieved error : 0

    <info> app: Recieved data : 54

    <info> app: Recieved error : 0

    <info> app: Recieved data : 55

    <info> app: Recieved error : 0

    <info> app: Recieved data : 56

    <info> app: Recieved error : 0

    <info> app: Recieved data : 57

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 0

    <info> app: Recieved data : 60

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 0

    <info> app: Recieved data : 66

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 0

    <info> app: Recieved data : 70

    <info> app: Recieved error : 0

    <info> app: Recieved data : 71

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 0

    <info> app: Recieved data : 74

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 0

    <info> app: Recieved data : 78

    <info> app: Recieved error : 0

    <info> app: Recieved data : 79

    <info> app: Recieved error : 0

    <info> app: Recieved data : 80

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 0

    <info> app: Recieved data : 86

    <info> app: Recieved error : 0

    <info> app: Recieved data : 87

    <info> app: Recieved error : 0

    <info> app: Recieved data : 88

    <info> app: Recieved error : 0

    <info> app: Recieved data : 89

    <info> app: Recieved error : 0

    <info> app: Recieved data : 90

    <info> app: Recieved error : 0

    <info> app: Recieved data : 91

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 0

    <info> app: Recieved data : 97

    <info> app: Recieved error : 0

    <info> app: Recieved data : 98

    <info> app: Recieved error : 0

    <info> app: Recieved data : 99

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 0

    <info> app: Recieved data : 102

    <info> app: Recieved error : 13

    <info> app: Recieved data : 253

    <info> app: Recieved error : 0

    <info> app: Recieved data : 104

    <info> app: Recieved error : 0

    <info> app: Recieved data : 105

  • What are you passing as the timeout_ms value when you call nrf_serial_read?

    /**
     * @brief Function for reading from a serial port.
     *
     * @param p_serial   Serial port instance.
     * @param p_data     Receive buffer pointer.
     * @param size       Receive buffer size.
     * @param p_read     Amount of data actually read from the serial port.
     *                   NULL pointer can be passed.
     * @param timeout_ms Operation timeout, in milliseconds. Pass 0 to operate in
     *                   non blocking mode.
     *
     * @return Standard error code.
     * */
    ret_code_t nrf_serial_read(nrf_serial_t const * p_serial,
                               void * p_data,
                               size_t size,
                               size_t * p_read,
                               uint32_t timeout_ms);

  • uint32_t err_code;
    
    err_code = nrf_serial_read(&serial_uart, &rx_message, sizeof(rx_message), NULL, 10);
    NRF_LOG_INFO("Recieved error : %d \n",err_code);
    if(err_code == 13)
    {
      ret = nrf_serial_uninit(&serial_uart);
      APP_ERROR_CHECK(ret);
      nrf_delay_ms(10);
      ret = nrf_serial_init(&serial_uart, &m_uart0_drv_config, &serial_config);
      APP_ERROR_CHECK(ret);
    
    }
    (void)nrf_serial_flush(&serial_uart, 0);
    if(rx_message[3]>0)
        NRF_LOG_INFO("Recieved data : %d \n", rx_message[3]);
        
    rx_message[3] = rx_data;
    our_rx_characteristic_update(&m_our_service, &rx_data);
    err_code = 0;

    I call this function each second. When i connected the Board via BLE, frequency of errors is increasing.

  • Hi Mehmet, 

    the SoftDevice( i.e. BLE protocol stack) has the highest priority so whenever there is a BLE event, then the SoftDevice will preempt any application code, see Interrupt priority levels in the SoftDevice Specification. 

    So the fact that you see timeouts when there is BLE activity is to be expected as the SoftDevice will get priority over the application UART code. It is possible to schedule application code around the BLE events using the Timeslot API, see Concurrent multiprotocol implementation using the Radio Timeslot API

    Best regards

    Bjørn

Reply Children
  • Is there any example of it ? Would you please explain ".It is possible to schedule application code around the BLE events using the Timeslot API "?. Did you mean scheduler ?

  • We have a tutorial on the Timeslot API. Its based on SDK v11, but the Timeslot API has not changed very much since then so it should still be relevant, see https://devzone.nordicsemi.com/nordic/short-range-guides/b/software-development-kit/posts/setting-up-the-timeslot-api

    The Timeslot API allows the application to request a timeslot where you are guaranteed that there will be no interrupts from the SoftDevice. YOu can perform the UART transaction in the Timeslot to avoid the timeout issues. 

  • Well, i will try it. My Development Kit has broken i guess. I created a new ticket for it. Can i program my Custom Board with ST-Link on STM dev kits?

  • I tried timeslot, actually i am not sure that i did it correct. I got  "<error> app: SOFTDEVICE: ASSERTION FAILED" error. The program is falling error after  serial_timslot.h line : 180

    Q1: where shoul i call timeslot_sd_init() ? Is this function start to my receiving operation ? Should i call it in main just one time or every time when i want to read rx pin?

    serial_timslot.h

    #include <stdint.h>
    #include <stdbool.h>
    #include "nrf.h"
    #include "app_error.h"
    #include "nrf_gpio.h"
    #include "nrf_sdh.h"
    #include "boards.h"
    
    #include "nrf_serial.h"
    #include "nrf_drv_uart.h"
    
    
    
    
    NRF_SERIAL_DRV_UART_CONFIG_DEF(m_uart0_drv_config,
                          RX_PIN_NUMBER, TX_PIN_NUMBER,
                          RTS_PIN_NUMBER, CTS_PIN_NUMBER,
                          NRF_UART_HWFC_DISABLED, NRF_UART_PARITY_EXCLUDED,
                          NRF_UART_BAUDRATE_9600,
                          UART_DEFAULT_CONFIG_IRQ_PRIORITY);
    
    #define SERIAL_FIFO_TX_SIZE 64
    #define SERIAL_FIFO_RX_SIZE 64
    
    NRF_SERIAL_QUEUES_DEF(serial_queues, SERIAL_FIFO_TX_SIZE, SERIAL_FIFO_RX_SIZE);
    
    #define SERIAL_BUFF_TX_SIZE 5
    #define SERIAL_BUFF_RX_SIZE 5
    
    NRF_SERIAL_BUFFERS_DEF(serial_buffs, SERIAL_BUFF_TX_SIZE, SERIAL_BUFF_RX_SIZE);
    
    NRF_SERIAL_CONFIG_DEF(serial_config, NRF_SERIAL_MODE_IRQ,
                          &serial_queues, &serial_buffs, NULL, NULL);
    
    
    NRF_SERIAL_UART_DEF(serial_uart, 0);
    
    uint8_t rx_message[5];
    uint8_t rx_data, rx_data1, rx_data2; 
    int8_t tx_data=0x66; 
    
    
    /**Timeslot API için sabitler
    */
    static nrf_radio_request_t  m_timeslot_request;
    static uint32_t             m_slot_length;
    
    static nrf_radio_signal_callback_return_param_t signal_callback_return_param;
    
    /**Bir sonraki timeslot eventini earliest modda çağır
    */
    uint32_t request_next_event_earliest(void)
    {
        m_slot_length                                  = 100000;
        m_timeslot_request.request_type                = NRF_RADIO_REQ_TYPE_EARLIEST;
        m_timeslot_request.params.earliest.hfclk       = NRF_RADIO_HFCLK_CFG_NO_GUARANTEE;
        m_timeslot_request.params.earliest.priority    = NRF_RADIO_PRIORITY_NORMAL;
        m_timeslot_request.params.earliest.length_us   = m_slot_length;
        m_timeslot_request.params.earliest.timeout_us  = 1000000;
        return sd_radio_request(&m_timeslot_request);
    
    }
    
    /**@brief Configure next timeslot event in earliest configuration
     */
    void configure_next_event_earliest(void)
    {
        m_slot_length                                  = 15000;
        m_timeslot_request.request_type                = NRF_RADIO_REQ_TYPE_EARLIEST;
        m_timeslot_request.params.earliest.hfclk       = NRF_RADIO_HFCLK_CFG_NO_GUARANTEE;
        m_timeslot_request.params.earliest.priority    = NRF_RADIO_PRIORITY_NORMAL;
        m_timeslot_request.params.earliest.length_us   = m_slot_length;
        m_timeslot_request.params.earliest.timeout_us  = 1000000;
    }
    
    /**@brief Configure next timeslot event in normal configuration
     */
    void configure_next_event_normal(void)
    {
        m_slot_length                                 = 100000;
        m_timeslot_request.request_type               = NRF_RADIO_REQ_TYPE_NORMAL;
        m_timeslot_request.params.normal.hfclk        = NRF_RADIO_HFCLK_CFG_NO_GUARANTEE;
        m_timeslot_request.params.normal.priority     = NRF_RADIO_PRIORITY_HIGH;
        m_timeslot_request.params.normal.distance_us  = 100000;
        m_timeslot_request.params.normal.length_us    = m_slot_length;
    }
    
    
    /**@brief Timeslot signal handler
     */
    void nrf_evt_signal_handler(uint32_t evt_id)
    {
        uint32_t err_code;
        
        switch (evt_id)
        {
            case NRF_EVT_RADIO_SIGNAL_CALLBACK_INVALID_RETURN:
                //No implementation needed
                break;
            case NRF_EVT_RADIO_SESSION_IDLE:
                //No implementation needed
                break;
            case NRF_EVT_RADIO_SESSION_CLOSED:
                //No implementation needed, session ended
                break;
            case NRF_EVT_RADIO_BLOCKED:
                //Fall through
            case NRF_EVT_RADIO_CANCELED:
                err_code = request_next_event_earliest();
                APP_ERROR_CHECK(err_code);
                break;
            default:
                break;
        }
    }
    
    
    /**@brief Timeslot event handler
     */
    nrf_radio_signal_callback_return_param_t * radio_callback(uint8_t signal_type)
    {
        switch(signal_type)
        {
            case NRF_RADIO_CALLBACK_SIGNAL_TYPE_START:
                //Start of the timeslot - set up timer interrupt
                signal_callback_return_param.params.request.p_next = NULL;
                signal_callback_return_param.callback_action = NRF_RADIO_SIGNAL_CALLBACK_ACTION_NONE;
                
                NRF_TIMER0->INTENSET = TIMER_INTENSET_COMPARE0_Msk;
                NRF_TIMER0->CC[0] = m_slot_length - 1000;
                NVIC_EnableIRQ(TIMER0_IRQn);
                
    /*-------------------Read UART--------------------------------------*/            
    /*---------------------------------------------------------------------------------------------------*/            
              uint32_t err_code;
              err_code = nrf_serial_read(&serial_uart, &rx_message, sizeof(rx_message), NULL, 0);
              NRF_LOG_INFO("Recieved error : %d \n",err_code);
    //        if(err_code == 13)
    //        {
    //          ret = nrf_serial_uninit(&serial_uart);
    //          APP_ERROR_CHECK(ret);
    //          nrf_delay_ms(10);
    //          ret = nrf_serial_init(&serial_uart, &m_uart0_drv_config, &serial_config);
    //          APP_ERROR_CHECK(ret);
    //          
    //        }
            (void)nrf_serial_flush(&serial_uart, 0);
              if(rx_message[3]>0)
                  NRF_LOG_INFO("Recieved data : %d \n", rx_message[3]);
                  rx_message[3] = rx_data;        
            //   err_code = 0;
    /*---------------------------------------------------------------------------------------------------*/ 
                break;
    
            case NRF_RADIO_CALLBACK_SIGNAL_TYPE_RADIO:
                signal_callback_return_param.params.request.p_next = NULL;
                signal_callback_return_param.callback_action = NRF_RADIO_SIGNAL_CALLBACK_ACTION_NONE;
                break;
    
            case NRF_RADIO_CALLBACK_SIGNAL_TYPE_TIMER0:
                //Timer interrupt - do graceful shutdown - schedule next timeslot
                configure_next_event_normal();
                signal_callback_return_param.params.request.p_next = &m_timeslot_request;
                signal_callback_return_param.callback_action = NRF_RADIO_SIGNAL_CALLBACK_ACTION_REQUEST_AND_END;
                break;
            case NRF_RADIO_CALLBACK_SIGNAL_TYPE_EXTEND_SUCCEEDED:
                //No implementation needed
                break;
            case NRF_RADIO_CALLBACK_SIGNAL_TYPE_EXTEND_FAILED:
                //Try scheduling a new timeslot
                configure_next_event_earliest();
                signal_callback_return_param.params.request.p_next = &m_timeslot_request;
                signal_callback_return_param.callback_action = NRF_RADIO_SIGNAL_CALLBACK_ACTION_REQUEST_AND_END;
                break;
            default:
                //No implementation needed
                break;
        }
        return (&signal_callback_return_param);
    }//After this line, i got SD ASSERTION ERROR
    
    
    /**@brief Function for initializing the timeslot API.
     */
    uint32_t timeslot_sd_init(void)
    {
        uint32_t err_code;
        
        err_code = sd_radio_session_open(radio_callback);
        if (err_code != NRF_SUCCESS)
        {
            return err_code;
        }
        
        err_code = request_next_event_earliest();
        if (err_code != NRF_SUCCESS)
        {
            (void)sd_radio_session_close();
            return err_code;
        }
        return NRF_SUCCESS;
    }

    main.c

    /**@brief Function for application main entry.
     */
    int main(void)
    {
        ret_code_t rc;
        ret_code_t ret;
        bool erase_bonds;
        
        // Initialize.
        
            log_init();
        power_management_init();
        
        saadc_init();
        timers_init();
        timer_internal_init();
        ble_stack_init();
        gap_params_init();
        gatt_init();
        services_init();
        advertising_init();
        conn_params_init();
        app_buttons_init(); 
        //uart_init();  //UART ile NRF_LOG Modülleri aynı anda kullanılamıyor. NRF_LOG modülü devredışı bırakıldı.
        
        ret = nrf_serial_init(&serial_uart, &m_uart0_drv_config, &serial_config);
        APP_ERROR_CHECK(ret);
        gpio_init();
        timeslot_sd_init();
    
    //    ret = nrf_drv_clock_init();
    //    APP_ERROR_CHECK(ret);
    //    ret = nrf_drv_power_init(NULL);
    //    APP_ERROR_CHECK(ret);
    
    //    nrf_drv_clock_lfclk_request(NULL);
    //    ret = app_timer_init();
    //    APP_ERROR_CHECK(ret);
        
    
    
        uint8_t message[] = {0x29,0x17,0x01,0x52,0x6D};
        uint8_t rx_message[5];
        
        // Start execution.
        advertising_start(erase_bonds);
         /* Register first to receive an event when initialization is complete. */
        (void) fds_register(fds_evt_handler);
        rc = fds_init();
        APP_ERROR_CHECK(rc);
        
      /* Wait for fds to initialize. */
         wait_for_fds_ready();
    
         motor_delay = record_read(MOTOR_DELAY_FILE_ID,MOTOR_DELAY_KEY);
         uint8_t rx_data, rx_data1, rx_data2; 
         int8_t tx_data=0x66; 
    
         NRF_LOG_INFO("FDS_REGISTER complete."); 
    
    //     delete_all_process();
    //     wait_for_fds_ready();
        // Enter main loop.
        for (;;)
        {
            idle_state_handle();
            
            if(timer_overflow >=5)
            {
              timer_overflow=0;
              ++timer_overflow_2;
             /*10_ms operations*/
             
             
             
         
             
    
             
                
            }
    
            if(timer_overflow_2 >=10)
            {
              ++timer_overflow_3;
              timer_overflow_2=0;
              
                
              
             /*100_ms operations*/         
                  if(button_motor_flag == true)
                  {
                    nrf_gpio_pin_set(RELAY_1);
                  }
                  else
                  {
                    nrf_gpio_pin_clear(RELAY_1);
                  }
    
                  if(button_lamba_flag == true)
                  {
                    nrf_gpio_pin_set(RELAY_2);
                  }
                  else
                  {
                    nrf_gpio_pin_clear(RELAY_2);
    
                  }
                  
                
    
    
            } 
    
            
              
    
            if(timer_overflow_3 >= 5)
            {
              ++timer_overflow_4;
              timer_overflow_3=0; 
              /* 500 ms lik ilemler*/
    
              ++motor_delay_counter;
    
              our_sensor_characteristic_update(&m_our_service, &SIGNAL_IN);
              our_trm_error_characteristic_update_2(&m_our_service, &TRM_IN);
              
              
    //          uint32_t err_code;
    //          
    //          err_code = nrf_serial_write(&serial_uart, &message, sizeof(message), NULL, 100);
    //          ++message[3];
    //          (void)nrf_serial_flush(&serial_uart, 0);
    
    
    
    
              if((motor_delay_counter > motor_delay) && (motor_stop_flag == false))      
             {
                
                  nrf_gpio_pin_set(MOTOR);
                  motor_delay_counter = 0;
                  // nrf_gpio_pin_set(TX_PIN_NUMBER);
                               
             }
     
    
    
    ////////////////////////////////////////
    //  LIGHT STATUS EKLENECEK
    /////////////////////////////////////// 
    
            }
            
    
            if(timer_overflow_4 >= 2)
            {
              timer_overflow_4 = 0;
              /*1 sn lik ilemler */
              ret_code_t ret_code;
              
    //          uint32_t err_code;
    // 
    //          err_code = nrf_serial_read(&serial_uart, &rx_message, sizeof(rx_message), NULL, 100);
    //        NRF_LOG_INFO("Recieved error : %d \n",err_code);
    //        if(err_code == 13)
    //        {
    //          ret = nrf_serial_uninit(&serial_uart);
    //          APP_ERROR_CHECK(ret);
    //          nrf_delay_ms(10);
    //          ret = nrf_serial_init(&serial_uart, &m_uart0_drv_config, &serial_config);
    //          APP_ERROR_CHECK(ret);
    //          
    //        }
    //        (void)nrf_serial_flush(&serial_uart, 0);
    //          if(rx_message[3]>0)
    //              NRF_LOG_INFO("Recieved data : %d \n", rx_message[3]);
    //              rx_message[3] = rx_data;
    //        //     our_rx_characteristic_update(&m_our_service, &rx_data);
    //           err_code = 0;
    //        
              delete_record(MOTOR_DELAY_FILE_ID,MOTOR_DELAY_KEY);
              wait_for_fds_ready();
              record_write(MOTOR_DELAY_FILE_ID,MOTOR_DELAY_KEY,&motor_delay);
              wait_for_fds_ready();
              //show_stats();
            }
    
        }
    }
    
    
    /**
     * @}
     */

Related