Open QGB opened 1 year ago
Well technically for Arduino blinky to have the same behavior you would have
#define LED PB9
void setup(){
pinMode(LED, OUTPUT);
}
void loop() {
digitalWrite(LED, LOW);
delay(500);
digitalWrite(LED, HIGH);
delay(500);
}
To reproduce this, I would also need to know which exact board you're compiling for. Please post the exact platformio.ini
.
arduino
[env]
platform = https://github.com/CommunityGD32Cores/platform-gd32.git
platform_packages =
framework-arduinogd32@https://github.com/CommunityGD32Cores/ArduinoCore-GD32.git
monitor_speed = 115200
[env:genericGD32F130C6]
board = genericGD32F130C6
framework = arduino
spl
[env]
platform = https://github.com/CommunityGD32Cores/platform-gd32.git
platform_packages =
framework-spl-gd32@https://github.com/CommunityGD32Cores/gd32-pio-spl-package.git
[env:genericGD32F130C6]
board = genericGD32F130C6
framework = spl
What exact board are you running on? Custom made? Does it have a quartz crystal for HSE?
What exact board are you running on? Custom made? Does it have a quartz crystal for HSE?
NO external quartz crystal
Hm okay that should still be fine because the Arduino system code configures the clock to be sourced from the internal RC 8MHz oscillator.
Can you test this exact code? https://github.com/CommunityGD32Cores/platform-gd32/issues/44#issuecomment-1512875020
If you're uploading via ST-Link, you should also be able to use the Debugging sidebar ("PIO Debug"). Does it get stuck somewhere?
Your code works, How to config Serial1 pin PA2 as RX, PA3 as TX
This should already be the default configuration for Serial1
as set by
And the pin mapping looks good too
When you go back to your original code and debug it in the debugger, do you see it getting stuck somewhere?
#include <Arduino.h>
#define LED PB9
void setup(){
pinMode(LED, OUTPUT);
Serial1.begin(57600);
Serial1.println("Start on Serial1!");
}
void loop() {
digitalWrite(LED, LOW);
delay(500);
digitalWrite(LED, HIGH);
delay(50);
Serial1.println("Serial1 \r\n");
}
gpio OK,spl framework uart OK, but this code no output in serial console . I try switch RX TX cable.also not work
I checked the code again and the macros are named very confusingly indeed.
So you actually need to use Serial2
for TX=PA2, RX=PA3 (board's perspective), using USART1.
#include <Arduino.h>
#define LED PB9
void setup(){
pinMode(LED, OUTPUT);
Serial2.begin(57600);
Serial2.println("Start on Serial2!");
}
void loop() {
digitalWrite(LED, LOW);
delay(500);
digitalWrite(LED, HIGH);
delay(50);
Serial2.println("Serial2");
}
even simple gpio
spl code work well