UART/RS485 multiple Devices with MAX485
Posted: Wed Dec 23, 2020 9:10 am
Hey everyone
I'm using some Bluepills with a STM32F103C8T6 and a Custom made Board also with a STM32F103C8T6.
The custom Made boards communicates with the Bluepill Board. I'm using a Max485 UART/RS485 Transceiver. This Transciever has an Enable Pin which needs to be High to send data and low to receive. The Idea is to send an address Byte to every Slave. The right Slaves sends back a fixed amount of bytes and ends with the address again.
There are two questions about the communication:
Is it possible to generate an Interrupt when new data is in the Databuffer of a Slave?
and the second question is about the timing of the Enable Pin. Right now I realized something like that:
Is it possible to generate something like a TX Buffer empty Interrupt?
Kind regards and Merry Christmas everyone!
Jens

I'm using some Bluepills with a STM32F103C8T6 and a Custom made Board also with a STM32F103C8T6.
The custom Made boards communicates with the Bluepill Board. I'm using a Max485 UART/RS485 Transceiver. This Transciever has an Enable Pin which needs to be High to send data and low to receive. The Idea is to send an address Byte to every Slave. The right Slaves sends back a fixed amount of bytes and ends with the address again.
There are two questions about the communication:
Is it possible to generate an Interrupt when new data is in the Databuffer of a Slave?
and the second question is about the timing of the Enable Pin. Right now I realized something like that:
Code: Select all
void sendData()
{
digitalWrite(ENABLE_PIN, HIGH);
// put data into buffer
SysbusSerial.write(MKE_UARTstartMarker);
for (int i = 0; i < MKE_DATA_BUFF_SIZE; i++)
{
SysbusSerial.write(DataBuffer[i]);
}
SysbusSerial.write(MKE_UARTstartMarker);
delayMicroseconds(MKE_UART_DELAY_US);
// START LISTENING AGAIN
digitalWrite(ENABLE_PIN, LOW);
}
Kind regards and Merry Christmas everyone!
Jens