1 Reply Latest reply on Mar 5, 2015 9:24 PM by user_343349849

    Still having trouble with UART

    user_343349849

       I have had some tech support but unable to rsolve this issue so far. I was advised the UART routine does not stop receiving on frame error or overrun and you do not explicitly need to clear any flags. However, in my routine, the packets receive several times and then I stop receiving data. I cannot find the digital values of the status error flags in the datasheet (it only seems to give english names of the flags). When my routine stops receiving data, the rec_status has value 160. I pressume this is either overrun or frame error because it no longer passes through my check. The transmitter sends new frames every 3 seconds so it should have automatically cleared and start receiving again.

         

      When the data stops being received, I have to stop the project and run again to clear it. 

         

      CY_ISR(RF_INT){

         

        uint8 rec_status;

         

        uint8 rec_data;

         

           rec_status = DRF1278_RXSTATUS_REG;   //This variable = 160 when data reception stops

         

          rec_data = DRF1278_GetByte();

         

           if(!(rec_status & DRF1278_RX_STS_STOP_ERROR)&&!(rec_status & DRF1278_RX_STS_OVERRUN)){

         

             switch(RF_Mode){

         

               case RF_IDLE : 

         

                         RF_Mode = RF_RECEIVING;

         

         RF_Ptr = 0;

         

              case RF_RECEIVING : 

         

                        RF_Buf[RF_DataBytes++] = rec_data;

         

                                RF_Timer = msTick + RF_TIMEOUT;

         

        break;

         

             }

         

           }

         

      }

        • 1. Re: Still having trouble with UART
          user_343349849

           They say a good man doesn't blame his tools. I found the problem and it was my fault.

             

          The Idle routine should have reset the databyte count to 0 and the comparison for packet data size overflow should have been set to same as the RFDATABYTES value.

             

          I will look around for values of status reg, rather than compare various errors, it would be better to have a "good data" condition test like.

             

          if(NoErrors) then{

             

            process packet

             

          }