I have a Arduino code working on a Adafruit Feather STM32F405 Express, and as long as I test it with Arduino serial Monitor, everything works perfect. As I want to use a serial terminal (a C# application, or the "Terminal Br@y++") through the same COM port, then I can write my commands, there are executed (output pins send expected signal), but I don't received the serial feedback.
My Arduino code :
void setup() {
Serial.begin(115200); // initialise USB Serial Port
pinMode(pumpP, OUTPUT); // Pump Pin is an output
}
void loop() {
if (Serial.available() > 0) {
command = Serial.readStringUntil('\n');
}
if (command == "do-it"){
digitalWrite(5, HIGH);
Serial.println("did it!");
}
}
In my Arduino Serial Monitor, I write "do-it", and I recieved "did it!" and I can see the Pin 5 changing level. In all serial application I could use, I can see the pin 5 changing level, but not the "did it!".
I configured Arduino as described on this Adafruit page : https://learn.adafruit.com/adafruit-stm32f405-feather-express/arduino-ide-setup [ summary: use STM32F4 library, board number = "Adafruit Feather STM32F405", USB support = "CDC ( Generic Serial supercedes USART)", upload method = "STM32CubeProgrammer (DFU)" ] And I connect the DFU pin to 3,3V during upload, and reset the board after it.
The worst in this story, is that at first time, it worked OK. Since a week or two, I don't get it to work again.
-
That sounds like a problem with the Serial Terminal programs. In the end they should exactly do the same: Connect to the COM port, configuring it and listening/sending on it. So if they don't work, but the Arduino Serial Monitor works, that would mean that they are doing something wrong.chrisl– chrisl2021年09月28日 14:18:36 +00:00Commented Sep 28, 2021 at 14:18
-
4Check that your serial terminal program is asserting the DTR and RTS flags of the CDC/ACM port.Majenko– Majenko2021年09月28日 14:30:45 +00:00Commented Sep 28, 2021 at 14:30
-
It "kind of work". I have to connect without RTS function, and after connection, I click on the RTS button and it works. When I connect with the RTS function on, then it does not get any message. Seems a bit strange and not stable working thing. Does the DTR should be actively put on/off before each expected message ? when I kept it high, it did not work (except for one or 2 messages)2diabolos.com– 2diabolos.com2021年10月04日 09:20:07 +00:00Commented Oct 4, 2021 at 9:20
1 Answer 1
Thank you @Majenko, you gave the solution : I checked the box "RTS/CTS" in the "handschake" section of Terminal by Bray, and I got all my serial message back from the STM32.
I guess this is a common think on more that stm32? how did you know, is that somewhere written in Arduino documentation?
for people like me who do not know what is RTS/CTS, here you are: http://www.brainboxes.com/faq/items/what-is-rts--cts-hardware-flow-control- or not so straight-forward https://en.wikipedia.org/wiki/RS-232#RTS,_CTS,_and_RTR
Funny to figure out that this "5 pin communication" is virtualise in USB.
@Majenko: if you want to "own" the solution, I let you do write it yourself, I will set your answer as solution.
-
I had a similar issue on the Adafruit Feather M0 Express, which uses an ATSAMD chip, and enabling DTR (DtrEnable of the SerialPort class) in my C# program fixed the issue for me.drojf– drojf2022年01月05日 03:06:24 +00:00Commented Jan 5, 2022 at 3:06