AnsweredAssumed Answered

USART - wrong data

Question asked by Joble on Aug 30, 2012
Latest reply on Sep 4, 2012 by Joble

I'm currently debugging STM8 software of a colleague who is on holiday and i face a problem which i cannot immediatly solve...  (I’m an analog engineer, so software is not really my cup of tea)

The device has a USART interface (at 250kBaud). 99% of the received data is correct, but sometimes dataslots are skipped. Usualy (allways???) skipped slots are
the first few after the break.

The break of the transmitter is 3,4ms and the MAB is 108µs, only 32 slots are sent. When i use another transmitter with 15ms break, 136µs MAB and
512 data slots, the receiver works flawless.

I have simplified the code to the basic functionality as shown below, but the problem remains...

  INTERRUPT_HANDLER(UART2_RX_IRQHandler, 21)
  {
   
  RxBuffer[RxPos] = UART2_ReceiveData8();
  if(UART2_GetFlagStatus(UART2_FLAG_FE) )
  {
   Data_1 = RxBuffer[DMX_Structure.start_address];
   Data_2 = RxBuffer[DMX_Structure.start_address + 1];
   Data_3 = RxBuffer[DMX_Structure.start_address + 2];
   Data_4 = RxBuffer[DMX_Structure.start_address + 3];
   Data_5 = RxBuffer[DMX_Structure.start_address + 4];

   RxPos = 0;  
   UART2_ClearFlag (UART2_FLAG_FE); // Clear frame error flag of UART
  }
 
  if(RxPos<513)
   RxPos++;         

  UART2_ClearFlag(UART2_FLAG_RXNE);
  }


  Any ideas what might go wrong?

Regards.

Outcomes