Arduino_STM32
Arduino_STM32 copied to clipboard
RTS only updates when DTR changes state
I wrote a simple sketch to show the state of RTS and it doesn't work as expected. The RTS state is only updated when DTR changes state. Tested on windows 11 using TeraTerm and RealTerm (RealTerm is easier for this)
#include <Arduino.h>
USBSerial serial;
void setup() {
delay(5000);
serial.begin();
}
void loop() {
if (serial.getRTS()) {
serial.write('R');
} else {
serial.write('r');
}
delay(1000);
}
Details: In usb_cdcacm.c the state variable line_dtr_rts is updated in usbNoDataSetup() and the line control state, but it doesn't look like that callback is being called when RTS changes state. Any ideas?
If this is unavoidable, USBSerial::getRTS() should probably have a comment to the effect of "Note: RTS only update when DTR changes state"