Description
Board
Adafruit QT Py ESP32-S3
Device Description
Adafruit QT Py ESP32-S3 with 4MB flash and 2MB PSRAM
Hardware Configuration
ESP32-S3 using hardware UART to interface with a MAX33046E UART / RS485 transceiver. Board is configured as described in documentation.
GPIO 16 (UART RX) -> MAX3304 RO
GPIO 5 (UART TX) -> MAX3304 DI
GPIO 37 (UART RTS) -> MAX3304 DE
Version
v2.0.14
IDE Name
Arduino IDE 2
Operating System
Windows 11
Flash frequency
40MHz
PSRAM enabled
yes
Upload speed
921600
Description
When attempting to initialize the HardwareSerial object and set the mode to RS485_HALF_DUPLEX, the setMode
function returns false. The pin selection looks valid to me which leads me to believe one of the internal pointers is invalid and the underlying HAL implementation is producing an error but I'm not sure how to go about debugging that.
Sketch
#include <HardwareSerial.h>
#define RS485_RX_PIN 16
#define RS485_TX_PIN 5
#define RS485_RTS_PIN 37
HardwareSerial RS485(1);
void setup() {
Serial.begin(9600);
delay(2000);
RS485.begin(9600, SERIAL_8N1, RS485_RX_PIN, RS485_TX_PIN);
if(!RS485.setPins(-1, -1, -1, RS485_RTS_PIN)){
Serial.print("Failed to set RS485 pins");
}
if(!RS485.setHwFlowCtrlMode(HW_FLOWCTRL_RTS)) {
Serial.print("Failed to set flow control");
}
if(!RS485.setMode(MODE_RS485_HALF_DUPLEX)) {
Serial.print("Failed to set RS485 mode");
}
}
void loop() {
if (RS485.available()) {
Serial.write(RS485.read());
}
if (Serial.available()) {
RS485.write(Serial.read());
}
}
Debug Message
No debug messages produced; the sketch output is:
16:08:06.938 -> Failed to set RS485 mode
Other Steps to Reproduce
I thought it might be related to #8755 but I'm not using the Serial
objects provided by Arduino for the RS485 device. Switching the RS485 object to from UART 1 to UART 2 also had no impact.
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.