Hi
I use mc9s08dz96. I wrote the corresponding registers to create a break at the beginning of the data LIN frame. The data frame is sent correctly, but the problem is that the break part is not 13 bits. I set the break registers like this:
if (SCI1S1_TDRE == 0U) {
return ERR_TXFULL;
}
SCI1C2_SBK = 0x01U;
SCI1C2_SBK = 0x00U;
Then I send 0x55 and ID:
while(1){
if (SCI1S1_TDRE == 0U) {
return ERR_TXFULL;
}
SCI1C2_SBK = 0x01U;
SCI1C2_SBK = 0x00U;
delayy(10);
c=AS1_SendChar(Sync_);
delayy(10);
c=AS1_SendChar(ID_);
delayy(333);
}
I initialized these registers:
void AS1_Init(void)
{
SerFlag = 0x00U; /* Reset flags */
/* SCI1C1: LOOPS=1,SCISWAI=0,Rsrc=1,M=0,WAKE=1,ILT=0,PE=0,PT=0 */
setReg8(SCI1C1, 0xA8U); /* Configure the SCI */
/* SCI1C3: R8=0,T8=0,TXDIR=1,TXINV=0,ORIE=0,NEIE=0,FEIE=0,PEIE=0 */
setReg8(SCI1C3, 0x20U); /* Disable error interrupts */
/* SCI1C2: TIE=0,TCIE=0,RIE=0,ILIE=0,TE=0,RE=0,RWU=0,SBK=0 */
setReg8(SCI1C2, 0x00U); /* Disable all interrupts */
/* SCI1S2: LBKDIF=0,RXEDGIF=0,??=0,RXINV=0,RWUID=0,BRK13=1,LBKDE=0,RAF=0 */
setReg8(SCI1S2, 0x04U);
SCI1BDH = 0x00U; /* Set high divisor register (enable device) */
SCI1BDL = 0x1AU; /* Set low divisor register (enable device) */
SCI1C2_TE = 0x01U; /* Enable transmitter */
SCI1C2_RE = 0x01U;}
BRK13 defines for us that the break length is 13. If you have noticed in the registers above, I have set it.
setReg8(SCI1S2, 0x04U);
Finally, the frame LIN is like this:
Break is correctly sent, also 0x55, 0x34 for sync and ID, respectively. But the break length is not 13 bits. what is the reason?