Hi, I have two device (TMS30F28069) which should be able to talk each other with SPI. But I have a synchronization problem and I don't know how to find a good way to do. Igive you a part of code in orderto explain me if you see something really wrong...I've tried a lot of things but nothing work at each time:
Master :
The transmission :
SPI_Emit_CMD(0, 1);
The function :
SPI_Emit_CMD(unsigned int CMD_IN, unsigned int CMD_OUT){
unsigned int res = 0, k = 0;
while(res != CMD_OUT){
SpibRegs.SPITXBUF = CMD_IN;
while(SpibRegs.SPISTS.bit.INT_FLAG != 1);
DELAY_US(10);
res = SpibRegs.SPIRXBUF;
}
}
Slave :
The transmission :
SPI_Emit_CMD(1, 0);
The function :
SPI_Emit_CMD(unsigned int CMD_IN, unsigned int CMD_OUT){
unsigned int res = 0;
while(res != CMD_OUT){
SpibRegs.SPITXBUF = CMD_IN;
while(SpibRegs.SPISTS.bit.INT_FLAG != 1);
//DELAY_US(4);
res = SpibRegs.SPIRXBUF;
}
}
I don' understand what is so wrong ? Thank you to help me