platform-gd32 icon indicating copy to clipboard operation
platform-gd32 copied to clipboard

Serial1 for genericGD32F130C6 and Arduino not working

Open QGB opened this issue 1 year ago • 9 comments

even simple gpio

#define LED PB9

void setup(){
    pinMode(LED, OUTPUT);
    digitalWrite(LED, LOW);
    delay(500);
    digitalWrite(LED, HIGH);
    delay(500);
    Serial1.begin(57600);
}

spl code work well

#include "gd32f1x0.h"

#define LEDPORT     GPIOB
#define LEDPIN      GPIO_PIN_9
#define LED_CLOCK   RCU_GPIOB

int main(void){
    systick_config();
    rcu_periph_clock_enable(LED_CLOCK);

    gpio_mode_set(LEDPORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, LEDPIN);
    gpio_output_options_set(LEDPORT, GPIO_OTYPE_PP, GPIO_OSPEED_2MHZ, LEDPIN);

    while (1){
        gpio_bit_reset(LEDPORT, LEDPIN);//buzzer
        delay_1ms(100);

        gpio_bit_set(LEDPORT, LEDPIN);
        delay_1ms(500);
    }
}

QGB avatar Apr 18 '23 01:04 QGB