1 Reply Latest reply on Dec 22, 2016 1:54 PM by userc_25951

    Transmitting and receiving in regular interval

      Hi ,

      I am using this UART Setup and UART Messages Over Webpage  code in wiced sdk 2.4.0 , i want to transmit and receive every 10 minutes.  Data has to be received only when the transmission is successful. I have modified the code like this

      static void uart_rx_data_thread(uint32_t arg)

      {

        uart_info_t* uart_info = (uart_info_t*) arg;

          char rxBuf[200];

        char c;

        int idx = 0;

      while(1)

      {

        wiced_rtos_delay_milliseconds(600000);   //10 min

        if (wiced_uart_transmit_bytes(uart_info->uart_id, str,7) == WICED_SUCCESS)

        {

          while (wiced_uart_receive_bytes(uart_info->uart_id, &c, 1, WICED_NEVER_TIMEOUT) == WICED_SUCCESS)

          {

                wiced_uart_transmit_bytes(uart_info->uart_id, &c,1);       // This i have given to find whether iam receiving the data properly are not

          if (!(c == uart_info->delimeter))

          rxBuf[idx++] = c;

          if (c == uart_info->delimeter && strlen(rxBuf) > 0)

          {

          wiced_rtos_lock_mutex(&msg_fwd_mutex);

          rxBuf[idx++] = '\0';

          strcpy(rx_msgs[rx_end_index], rxBuf);

          rx_end_index = (rx_end_index + 1) % HISTORY_LEN;

          wiced_rtos_unlock_mutex(&msg_fwd_mutex);

             idx = 0;

             break;  }

          }

        }

        else

        WPRINT_APP_INFO(("Transmit not success"));

      }

      }

      I have given delay so that it will transmit data after every 10 min.  I want to receive the data only after 10 min and display it in the webpage. But if i receive the data in between 10min that data should not get displayed in the webpage.

      But in this code if i receive the data in between 10 min that data is getting displayed in webpage at 10th min.

       

      why it is happening. I don't  want this data to be received. please help me to solve this issue.

       

      Thank you.

        • 1. Re: Transmitting and receiving in regular interval

          When any data is received by the radio, it is stored into a buffer by lower level code until the user asks for it via the wiced_uart_receive_bytes method. In other words, when you call wiced_uart_receive_bytes, it is just checking to see if data exists in the buffer, and returning a packet if it does.

           

          What it sounds like you want to do is throw away data until it's been 10 minutes since the last 'good' piece of data has been received.

          2 of 2 people found this helpful