ArduinoModbus icon indicating copy to clipboard operation
ArduinoModbus copied to clipboard

ModbusRTUClient does not work on STM32F030C8

Open rikka0w0 opened this issue 2 years ago • 0 comments

Hardware: STM32F030C8T6 custom board, internal clock source, MAX485 chip (DE, RE connected together, DI and RO connected to PA8, half-duplex USART1)

I got "Connection timeout" for any operation. With the help of a hardware logic analyzer, I could see that the Arduino board successfully sent the request and the correct response from the device on the DI pin of MAX485 appeared on PA8. Further investigation shown that the library does not enable Rx after sending the request.

My proposed solution was to append _serial->enableHalfDuplexRx(); to void RS485Class::receive() in "RS485.cpp":

void RS485Class::receive()
{
  if (_rePin > -1) {
    digitalWrite(_rePin, LOW);
  }
  _serial->enableHalfDuplexRx();
}

rikka0w0 avatar Jun 07 '22 09:06 rikka0w0