resume | links | blog | quotes | ascii | tgtimes | gopher | mail

GigaDevice GD32VF103

A RISC-V MCU with many peripheral, a low price tag, featuring hardware support for a CAN BUS (as used in vehicles).

crt.S - running C code

The GD32VF103 has a 32bit RISC-V core Bumblebee, with "vectorised" interrupts: In AVR an interrupt makes the execution jump to a hardcoded address, that usually contains itself a jump instruction of the choice of the developer. It is the jump instruction at that known address that lets the developer where to put an interrupt.

Instead, vectorised interrupts

GPIO - blinking a led

As many MCU that target low-power, the GD32VF103 has most peripherals disabled at startup, including GPIO.

As often, enabling this peripheral goes by starting the associated clock.

The relevant Reset and Clock Unit (RCU) register is RCU_APB2EN.

GPIO is very basic and low-level, but yet there are multiple mode to change pin status.

What we want for blinking a led is port controll (CTL in GPIO_CTL) to be set to pull-up/pull-down, and I/O mode (MD in GPIO_CTL) to "output" with whatever speed.

Finally, the GPIO Bit Operation (GPIO_BOP) register lets us change the value of the individual pin, for instance connected to a LED or multimeter.

--- #draft