Trouble using 3 UARTs simultaneous on STM32F405
Posted: Fri Aug 01, 2025 4:27 pm
Hey everyone, I've just about ran out of ideas and looked up just about all that I can. I'm using an MKS XDrive Mini motor controller that's using the STM32F405RGT6. I've selected the STM32F405RGTX generic variant in Arduino IDE. I'm using Serial over USB, and I've also added a second Serial2 using
All of that has worked correctly. I'm not attempting to add a third serial. I tried doing
but I would get a compiler error that Serial4 has already been declared. Digging into that, it seems that Serial4 is defined due to this variant having this
which in WSerial.h causes Serial4 to be Serial?
So I then I tried to do
but I don't seem to get any data. I've hooked up a logic analyzer on the pins and verified that data is being sent to it PC11, but I can't read it. I'm not sure how the SerialUSB fits into this. I've also tried doing
which should be USART3 but I still didn't get anything.
I'm fairly new to all this so if anyone has any other ideas, I'd be very grateful!
This is the schematic of the board in case that's helpful https://github.com/makerbase-mks/ODrive ... ematic.pdf
Code: Select all
HardwareSerial Serial2(USART2);
Code: Select all
HardwareSerial Serial4(PC11, PC10);
Code: Select all
#ifndef SERIAL_UART_INSTANCE
#define SERIAL_UART_INSTANCE 4
#endif
Code: Select all
#elif SERIAL_UART_INSTANCE == 4
#define ENABLE_HWSERIAL4
#if !defined(Serial)
#define Serial Serial4
#define serialEvent serialEvent4
#endif
Code: Select all
HardwareSerial SerialOnStep(PC11, PC10);
Code: Select all
HardwareSerial SerialOnStep(PC11_ALT1, PC10_ALT1);
I'm fairly new to all this so if anyone has any other ideas, I'd be very grateful!
This is the schematic of the board in case that's helpful https://github.com/makerbase-mks/ODrive ... ematic.pdf