AnsweredAssumed Answered

High speed SCI

Question asked by Aaron Lee on Oct 13, 2018
Latest reply on Oct 15, 2018 by Aaron Lee

Hi,

We are using a S12ZVCA with the 12MHz external crystal. I need to have a 250 kbps baud rate on SCI.

I have try to receive 4 bytes, but only receive the 1st bytes.

Processor Expert setting as follow:

 

 

 

 

void main(void){
      ............
      i=0;
      while(i<bLen) {
            RxFlag = AS1_RecvChar(&ReceiveChar);
            if(RxFlag != ERR_RXEMPTY)
                  bBuf[i++] = ReceiveChar;
      }
      ............
}

byte AS1_RecvChar(AS1_TComData *Chr){
      byte Result = ERR_OK; /* Return error code */
      byte StatReg = SCI1SR1; /* Read status register */

      if (StatReg & SCI1SR1_IDLE_MASK) {
            (void) SCI1DRL; /* Dummy read of the SCI1DRL to clear the flag*/
            SerFlag |= IDLE_ERR;
      }
      if (StatReg & (SCI1SR1_OR_MASK|SCI1SR1_NF_MASK|SCI1SR1_FE_MASK|SCI1SR1_PF_MASK)) { /* Is any error flag set? */
            Result = ERR_COMMON; /* If yes then set common error value */
      } else if ((StatReg & SCI1SR1_RDRF_MASK) == 0U) { /* Is the reciver empty and no error is set? */
            return ERR_RXEMPTY; /* If yes then error */
      } else {
            /* Else branch due to MISRA compliance */
      }
      *Chr = SCI1DRL; /* Read data from the receiver */
      return Result; /* Return error code */
}

Do you have any recommend?

 

Best Regards,

Aaron

Outcomes