Hi, I am having some problem wit sci communication. I have the following problem, i am sending values by sci, in a loop. And the first bytes are dummy values (incorrect information) but then it is working well.
I dont know why the first bytes are incorrect.
I really apreciate your help.
All of configuration registers are correctly configured.
SciaRegs.SCICCR.all =0x0007;
SciaRegs.SCICTL1.all =0x0003;
SciaRegs.SCICTL2.all =0x0000;
SciaRegs.SCIHBAUD =0x0000;
SciaRegs.SCILBAUD =0x0003;
SciaRegs.SCICCR.bit.LOOPBKENA =0; // Enable loop back
SciaRegs.SCICTL1.all =0x0023; // Relinquish SCI from Reset
SciaRegs.SCIFFTX.all=0xE040;
SciaRegs.SCIFFRX.all=0x204f;
SciaRegs.SCIFFCT.all=0x0;
I am not using interrupts
This is my code
void average(void)
{
Uint16 fila=0,i=0;
for(i=0;i<9;i++)
{
resultado=mat_datos[0][i];
scia_xmit();
}
}
void scia_xmit()
{
for(ind=2;ind>=0;ind--)
{
sendchar=((resultado >> (ind*8)) & 0x000000FF);
SciaRegs.SCITXBUF=sendchar;
while(SciaRegs.SCIFFTX.bit.TXFFST > 0 ){}
}
resultado=0;
}