Hello together,
Ive got a question. I have a system which is able to receive data and to send response.
I am using SCI-B (RS485) for communication. To send data, GPIO x has to be set to 1 (high), in receive mode GPIOx has to be to set to 0(low).
Initially system is in rx mode and waits for requests. When I got a request, I am switching to tx mode (I am setting GPIOx high), writing all data to
void serial_port_putchar(char a)
{
// this causes the processor to hang if the transmit buffer is full,
// but it's OK because all time critical activities take place in the ISR
while (ScibRegs.SCIFFTX.bit.TXFFST != 0) {}
// Place the byte to send in the transmit buffer:
ScibRegs.SCITXBUF=a;
}
Now, when I am switching to rx mode immediatelly after I put all my values into RXBUF, some data (last parts) arent transmitted. How can I calculate time necessry to wait till complete data is sent, before switching to rx mode (setting GPIOx low again)
Thanks
Bye