Re: USART Multiprocessor communication.
Posted: Tue Sep 28, 2021 11:37 am
The address is defined in your firmware, the protocol, not in the uart. it is not a hardware concept.
'modbus' can be extremely easy
of course this won't be a functional 'modbus', but it isn't too far from this.
oh i read a little about RS485
https://en.wikipedia.org/wiki/RS-485
that 'enable' pins apparently is about enabling the receiver output or driver output or making them hi-z. I'd guess that would matter more when the slaves need to transmit. As if other slaves are not in hi-z mode, they may instead sink/short the signal to ground. This could also affect the master as rs485 has a different topology.
I'd guess it'd take some effort to figure it out. For purely stm32, you could make that pin hi-z by simply putting it in INPUT mode. But that interfacing external hardware e.g. MAX232 or MAX485 drivers could mean that more signal lines is needed.
'modbus' can be extremely easy
Code: Select all
void setup() {
Serial1.begin(115200);
}
#define ADDRESS 0x01;
void loop() {
if (Serial1.available()){
uint8_t c = Serial1.read();
if(c == ADDRESS) {
// do something
}
}
}
oh i read a little about RS485
https://en.wikipedia.org/wiki/RS-485
that 'enable' pins apparently is about enabling the receiver output or driver output or making them hi-z. I'd guess that would matter more when the slaves need to transmit. As if other slaves are not in hi-z mode, they may instead sink/short the signal to ground. This could also affect the master as rs485 has a different topology.
I'd guess it'd take some effort to figure it out. For purely stm32, you could make that pin hi-z by simply putting it in INPUT mode. But that interfacing external hardware e.g. MAX232 or MAX485 drivers could mean that more signal lines is needed.