Closed gateseee closed 1 year ago
On F103 the usb and CAN share registers. So you can't use those at the same time. It's hardware limitation, so there is nothing you can do for it.
Is there any documentation about that, that i can dig further?
Is there any documentation about that, that i can dig further?
There is something if you google the issue. But also if you carefully read the F103 datasheet from ST, there is indeed some registers that overlap between USB and CAN. Don't remember which ones, because it's so long time since I checked.
Thanks. Got it to work now. I am using an ESP32 to read the Serial data sent from the STM32 until my FTDI breakout board arrives. Flashing is done via STlink.
If someone is going to try the same: In your STM32 code, just change this in the setup, and then print whatever you want
void setup() {
Serial.setRx(PA10);
Serial.setTx(PA9);
Serial.begin(250000);
//.....
}
void loop() {
// do whatever you want...
Serial.println("Test123....");
// do whatever you want...
}
On ESP32 (and i assume on any other Arduino Compatible board) just do this, and then monitor the ESP32's output, which contains the STM32's messages.
// STM32 RX = PIN PA10 connects to ESP32 TX = 2
// STM32 TX = PIN PA9 connects to ESP32 RX = 15
const int TX_PIN = 2;
const int RX_PIN = 15;
HardwareSerial SerialSTM32(2);
void setup() {
Serial.begin(250000);
SerialSTM32.begin(250000, SERIAL_8N1, RX_PIN, TX_PIN);
}
void loop() {
while (SerialSTM32.available() > 0) {
Serial.print(char(SerialSTM32.read()));
}
}
For my tests now it worked fine, but its not the optimal solution of course.
Great to know. I'll close this issue, since there isn't anything we can do for the hardware limitations.
Hello. I struggled a long time now with the STM32 to get it running via standard USB connection without using the STlink. For doing this, i had to add some flags in platformio.ini
If i'm compiling now, as excample this minimal version:
It throw's the following errors:
As soon as i remove the USB build flags, its compiling.
Does anyone have an Idea?
Chris