Arduino core for GD32 devices, community developed, based on original GigaDevice's core

Overview

GD32 Arduino Core (New)

Lint Code Base GitHub pull-requests GitHub issues GitHub issues-closed

This is a Arduino core is based off of the original GigaDevice core that was provided by the company in early June 2021 (see https://github.com/CommunityGD32Cores/GD32Core/)

It is currently a work in progress, but believed to be functional on GigaDevice's mBed boards.

The intention is to further develop that original core in an open-source, community-driven manner.

Collaborating

Interested in collaborating? Join our dedicated Discord channel for this at https://discord.gg/59kf4JxsRM.

Media

A GD32F303CC chip (placed on a bluepill PCB) runs its first blinky code with the new Arduino core!

first_blinky_gd32f303cc_1080p.mp4

The same board reading out a DHT11 temperature & humidity sensor and displaying it on an SSD1306 OLED via the Adafruit GFX libraries

dht11_oled_preview

The board runs the Adafruit SSD1306 test sketch

i2c_oled.mp4

And here it is using analogRead() to read the voltage over a potentiomeneter as a 12-bit value.

ADC_OLED_preview

Using this core with PlatformIO

Currently, development of this core is being done using PlatformIO. It uses the custom PlatformIO platform https://github.com/CommunityGD32Cores/platform-gd32.

Using PlatformIO is already possible to very easily edit code in the IDE and even live-debug a chip (with e.g. an ST-Link)

Various example projects for this platform for the SPL framework and this Arduino core are currently hosted at https://github.com/CommunityGD32Cores/gd32-pio-projects.

Using this core with the Arduino IDE

To compile for this core with the Arduino IDE, add the following URL to the boards manager.

https://raw.githubusercontent.com/CommunityGD32Cores/GD32Core-New/main/package_gd32_index.json

This will install the core and compiler toolchain against the 'main' git branch.

grafik

Current state

The gd32-arduino-blinky project compiles for the gd32f307_mbed board and the genericGD32F303CC board and works (see video above).

Multiple more complicated demos work, like an SSD1306 OLED, analog input, Serial, etc. See issue https://github.com/CommunityGD32Cores/GD32Core-New/issues/8 for the latest state of tested components.

Library compatibility list

Legend:

  • ✔️ = working
  • = not working at all
  • ⚠️ = some features not working
  • ⁉️ = untested
Name Works? Notes
Adafruit GFX ✔️ Tested in conjunction with SSD1306 OLED, CP437 symbols works
Adafruit SSD1306 ✔️ Tested on SSD1306 I2C 128x64 OLED, entire extensive demo works
SimpleDHT ✔️ Works with DHT11 (Temp & Humidity) and OLED, demo above

Updates / History

31.05.2021:

Initial contact and thoughts about an Arduino core implementation from scratch for GD32 devices with @kemotz via Email.

02.06.2021:

Creation of the Github project https://github.com/maxgerhardt/gd32-arduino-core/ and a discord channel.

10.06.2021:

A custom dev board has been designed and is in production. The repo with the files for it is at https://github.com/kemotz/GD32F1x0-dev-brd.

board_preview

@obra and @algernon join the project.

GigaDevices is contact with a request for information on a potentially existing in-house developed Arduino core and code licensing questions.

16.06.2021:

GigaDeviecs confirms that there is a internally developed Arduino core, sends it over to use and approves of publishing it. The code is also BSD 3-clause licensed.

The original files for this are found at https://github.com/CommunityGD32Cores/GD32Core.

The focus shifts from creating a new Arduino core from scratch to getting the retrieved one working and expanding upon it.

18.06.2021:

Arduino core:

  • Add package.json for PlatformIO compatibility
  • Add tools\platformio\platformio-build.py PlatformIO builder script
  • gives a successful build for the gd32f307_mbed board
  • gives a successful build for the genericGD32F303CC board (and gives a working blinky!)

19.06.2021:

24.07.2021:

  • moved all relevant projects into the Github org instead of personal accounts, adapted URLs
  • build fixes for Linux
  • added CI to projects repository, now builds 15 projects fully automatically
  • Jesse worked on merging new-style Arduino APIs (https://github.com/arduino/ArduinoCore-API/) to this core
  • Jesse started working on USB support (and USB bootloaders)
  • later that day, the new ArduinoCore-API adoption was successfully merged and tested

ToDo / thoughts

ToDos are now all moved to issues.

Supported boards

Everything is WIP now and no full support can be expected yet.

Planned support:

GD32F303CC based boards

bluepill_f303cc

custom GD32F190 board seen above

the boards previously supported by this core, so GD32F303ZE-EVAL and GD32F307VG-MBED

.. more?

Comments
  • FlashStorage & EEPROM libraries

    FlashStorage & EEPROM libraries

    This is a work-in-progress version of my attempt at a pair of FlashStorage & EEPROM libraries.

    FlashStorage is a lower-level library that abstracts away (most of) the burden of storing and retrieving user data from flash. It simply provides a read() and a write() method, that handle all the pageing, erasing and updating and whatnot behind the scenes, so the end user doesn't have to care about the low level details.

    EEPROM builds on top of that, and provides an Arduino-esque EEPROMClass, with an API similar to the AVR EEPROM. It's more limited than that, because only the basic functionality required for Kaleidoscope is implemented at this point (no C+11 iterators or array access at this point).

    There are a few things I need to work out still, namely:

    • [x] Sane defaults. At the moment, I copied some defaults from 05_USBD_MSC_internal_flash. Ideally, we'd have those defaults come from boards.txt. The major things we need is the size of the storage, where it starts (or where it ends, which is more practical to store in boards.txt in our case), and the page size.
    • [x] Make small operations more efficient. At the moment, all reads and writes require a full page read/write, even if we could do with less. In case of Kaleidoscope, we quite often do much smaller reads and writes.

    For reads, we can be much more efficient, because we don't need any paging there. We just read N byes of data from an address, and done.

    For writes, the most efficient way would be to copy the whole storage to RAM, and only write back on commit(). That'd make writes a lot more efficient, at the cost of ram. Another option would be to have a prepareWrite() function, that tells the library how much data we'll write, and where, so it'll prep that area in RAM, and write it all back in commit(). This, however, would require dynamic memory allocation. There's fmc_word_reprogram(), which should - judging by its comments - reprogram a word at an address without erase. We could use that for more efficient small writes, as we won't have to do full page erase + writes. However, any of these require more thought, and I'll postpone efficient writes 'till a follow-up PR instead. Lets get the very basic functionality working in this one first.

    Meanwhile, I'm submitting this as a draft PR for comments, and perhaps ideas. The code has not been tested on hardware yet, I've only done compile tests with this iteration. Once I got to the "test on hardware" stage, I'll report back too.

    enhancement 
    opened by algernon 33
  • Software Serial example not compiling for f130

    Software Serial example not compiling for f130

    Hey, I'm trying to use software serial with F130 but it is failing to compile in Arduino IDE with the following error.

    SoftwareSerial.cpp:264:5: error: 'noInterrupts' was not declared in this scope 264 | noInterrupts(); SoftwareSerial.cpp:266:5: error: 'interrupts' was not declared in this scope 266 | interrupts();

    Any help is really appreciated. Thanks in advance.

    opened by imeshsps 7
  • Servo code missing original copyright

    Servo code missing original copyright

    The code for the servo class and header are copied from the Arduino AVR source code but the copyright statements have been removed. Please ensure that all copyright material used in this repository include existing copyright statements

    opened by michaelmargolis 6
  • No GD32E23x MCUs in Arduino

    No GD32E23x MCUs in Arduino

    Dear Sir, first of all: Many thanks for your great work! My problem is that although there are lots of GD32XNNN micros supported in Plaformio, there are only around 5 in Arduino. As I tend to prefer to use the Eclipse based Sloeber IDE against the Platformio, I would greatly appreciate if I can program and debug GD32E230 micros there. Unfortunately, the Sloeber plugin only accepts Arduino-style .json file. I would geratly appreciate if you update the Arduino plugin in order to support more MCUs, namely the GD32E230K8T6, should it provided no major difficulty for you. Best regards, Tomáš Jíra

    opened by ospilos 5
  • Need help in understanding the use of

    Need help in understanding the use of "-isystem/include_path"

    Hi All. Have started to develop with GigaDevice chips. I have followed the instructions to use the Arduino Ide and successfully compiled a the "Blink" example for the "GD32F30x MBed Series" The following "blink-build.txt" shows the debug output of a build command.

    blink-build.txt

    I would appreciate it if somebody could explain the use of "-isystem" include paths and where I can find information on it. I have never come across it before. Any help much appreciated I look forward to participating in the Community. Best regards Noel Diviney

    opened by noeldiviney 5
  • Move assembler startup code into variants directory.

    Move assembler startup code into variants directory.

    When this code lived in the ‘core/gd32’ directory, all variants were being automatically compiled and linked in to the resulting ‘core.a’, which resulted in name collisions and symbols not resolving correctly for the target architecture unless you got lucky at link time.

    Moving the startup code into ‘variants’ resolves this issue, as only the code matching the variant currently in use is compiled and linked in.

    opened by bjc 5
  • Bjc/usb fixes

    Bjc/usb fixes

    This covers more bases when the device is reset by hooking into the firmware library's reset hook.

    I've also added a 5ms transmission timeout on flush so things don't hang indefinitely if the host is ignoring that endpoint.

    Tested on macOS UEFI and the real OS, as well as Linux. I don't have access to windows right now, so I can't test that.

    opened by bjc 3
  • The underlying i2c implementation would always block infinitely on reads

    The underlying i2c implementation would always block infinitely on reads

    The underlying i2c implementation would always block infinitely on read events if it didn't get an answer from the i2c device.

    This change adds the same timeout countdown we use elsewhere in the library.

    opened by obra 3
  • Fix race condition causing buffer overrun in tight read loop.

    Fix race condition causing buffer overrun in tight read loop.

    This patch fixes a race condition present when calling ‘USBCore::pop’ in a tight loop, such as in ‘Stream::timedPeek’.

    The issue occurs because, when the USB peripheral gets a packet from the host, it does the following two things, in order:

    1. set a flag on the endpoint to return a NAK status to the host for subsequent OUT packets, and then
    2. set the interrupt pending flag and associated registers indicating that new data is available.

    This is not done atomically, and is handled by the peripheral concurrently with the CPU executing the firmware. As a result, there is a time between steps 1 and 2 where, after the peripheral has set the status flag to return a NAK, firmware code can overwrite that flag to specify that the endpoint is a valid state to receive more data, and then the interrupt is fired. Assuming no other changes are made to the peripheral's registers, after this point, an OUT data packet to the endpoint may come in immediately after current interrupt is serviced and, as a result, continue writing past the end of a full transaction buffer.

    The previous version of ‘USBCore::pop’ blindly set the endpoint status to say that it was available for OUT packets, assuming that as long as its data buffer was empty, and that interrupts were disabled for the duration of its operation, it was in the correct state. However, if host data is coming in fast enough, and the calls to ‘pop’ are also fast enough, then it can trigger this race, because the USB peripheral can change the endpoint status outside of interrupt context and concurrently to firmware code.

    This patch addresses that issue be only setting the endpoint status once, the first time more data is requested after the buffer is empty.

    opened by bjc 2
  • Initial port to the ArduinoCore-API

    Initial port to the ArduinoCore-API

    This gets us a lot of the boilerplate code moved off into a subdirectory maintained by Arduino.

    It also gets us better infrastructure for adding features like PluggableHID.

    It does mean that a couple features Max already implemented may need to be redone.

    opened by obra 2
  • Release working Arduino IDE compatible package

    Release working Arduino IDE compatible package

    Right now this core is primarily built with PlatformIO (see https://github.com/maxgerhardt/gd32-pio-projects).

    Original Arduino-IDE support was probably there as there is a platform.txt, board.txt and a package index at https://github.com/CommunityGD32Cores/GD32Core but it seems slightly incomplete to me (no download URLS?).

    ~~Since development and debugging is a thousand times easier and faster in PlatformIO, Arduino IDE is not a priority as of now.~~

    EDIT: A package json was added with instructions at https://github.com/CommunityGD32Cores/GD32Core-New#using-this-core-with-the-arduino-ide, but uploading does not work yet due to missing uploader packages and logic.

    enhancement Arduino IDE 
    opened by maxgerhardt 2
  • Issue with using UART1 on GD32F130C8

    Issue with using UART1 on GD32F130C8

    I was trying to run the following code to test two serial ports and I was having this issue.

    void setup() { Serial.begin(9600); Serial1.begin(9600); } void loop() { Serial.println("looping S1"); Serial1.println("looping S2"); delay(1000); }

    The issue I'm having is I'm getting the output for both serial print lines on the first serial output.

    debug screen

    Then I tried to run SPL example with changed parameters to check whether it is a issue with my PCB but after I made same changes, I was able to use UART1.

    uart1 settings

    Then I tried to use only Serial1 with the following code and on the debug mode I noticed the following.

    void setup() { Serial1.begin(9600); } void loop() { Serial1.println("looping S2"); delay(1000); }

    2nd serial port

    It seems like it is still passing the same parameters for 1st serial port. Please can you help me to fix this ? Any help is really appreciated.

    Thanks.

    opened by imeshsps 7
  • Add CAN bus libaray

    Add CAN bus libaray

    Many of the GD chips support two or even three can busses. Would be nice to have support for that peripheral. Should be as easy as taking the code from the STM core and moving it to the GD core.

    opened by CzokNorris 2
  • Add Support for BigTreeTech (BTT) TFT Touch Screens

    Add Support for BigTreeTech (BTT) TFT Touch Screens

    Some recent versions of the BTT TFT Touchscreens (https://github.com/bigtreetech/BIGTREETECH-TouchScreenFirmware) make use of the GD32F205VC MCU so this project should consider adding support for these boards. Even though they are not development boards, the number of peripherals they include make them an excellent choice for custom projects. As a matter of fact, we are currently making use of this code base for implementing a custom motor controller on one of these boards (https://www.biqu.equipment/collections/lcd/products/btt-tft35-e3-v3-0-display-touch-screen-two-working-modes). Here is the link to the Github repo for this project (https://github.com/vovan888/ArduinoCore-GD32).

    opened by ns96 2
  • implement noInterrupts/interrupts.

    implement noInterrupts/interrupts.

    https://www.arduino.cc/reference/en/language/functions/interrupts/nointerrupts/ says they're part of the standard API.

    We don't implement them.

    It looks like it they should be implemented as wrappers around __disableIrq and __enableIrq() per https://stm32f4-discovery.net/2015/06/how-to-properly-enabledisable-interrupts-in-arm-cortex-m/ and some grepping of the GD32 code.

    opened by obra 1
  • GD32L23x support

    GD32L23x support

    Depends on https://github.com/CommunityGD32Cores/platform-gd32/issues/21.

    The low-power GD32L23x series of chips should be supported here in ArduinoCore-GD32, with libraries such as LowPower or SleepyDog and friends to take care of the new functionality.

    enhancement board 
    opened by maxgerhardt 0
Owner
A community project to provide Arduino cores for GD32 MCUs.
null
Original hVNC has been recoded to work with all version of windows above XP. Thanks to the original author for this wonderful tool.

hVNC - Recoded This is the recoded version of the hVNC found in TinyNuke trojan. Compiling Compile tested with Visual Studio 2017. No compile errors.

Snow Leopard 8 Jan 22, 2022
Identify I2C devices from a database of the most popular I2C sensors and other devices

I2C Detective Identify I2C devices from a database of the most popular I2C sensors and other devices. For more information see http://www.technoblogy.

David Johnson-Davies 20 Oct 14, 2022
Play Nintendo Switch using an original N64 controller via an Arduino Uno!

N64 -> Arduino Uno -> Nintendo Switch Description By connecting an original N64 controller to an Arduino UNO R3 running this code, and plugging the US

null 19 Oct 24, 2022
This is the Arduino® compatible port of the AIfES machine learning framework, developed and maintained by Fraunhofer Institute for Microelectronic Circuits and Systems.

AIfES for Arduino® AIfES (Artificial Intelligence for Embedded Systems) is a platform-independent and standalone AI software framework optimized for e

null 157 Nov 24, 2022
🗺️ OMAPS.APP — Offline OpenStreetMap maps for iOS and Android. A community-driven fork of MAPS.ME.

OMaps is an open source cross-platform offline maps application, built on top of crowd-sourced OpenStreetMap data. It was publicly released for iOS and Android.

OMaps 4.1k Nov 27, 2022
This repository is to share the EdgeAI Lab with Microcontrollers Series material to the entire community

This repository is to share the EdgeAI Lab with Microcontrollers Series material to the entire community. We will share documents, presentations and source code of two demo applications.

Machine Learning Tokyo 15 Oct 23, 2021
Best Method to get Globally Banned from the cfx.re community

Lua-Executor Best Method to get Globally Banned from the cfx.re community Since cheaters have been going crazy selling 'their' hacks, and often gets d

Scopes 7 Jul 2, 2022
Contains platform and API specific code written by Primal community members.

PrimalPlus Contains platform and API specific code written by Primal community members. How to use The general idea is to simply copy the files from t

Game Engine Series 20 Nov 7, 2022
KeePassXC is a cross-platform community-driven port of the Windows application “Keepass Password Safe”.

KeePassXC KeePassXC is a modern, secure, and open-source password manager that stores and manages your most sensitive information. You can run KeePass

KeePassXC 14.4k Nov 30, 2022
Resources and forum for the Chinese community, maintained and moderated by CoinSummer & PL.

Awesome Filecoin 请注意:本文中的链接并非全部是官方链接,部分链接是第三方链接,有些甚至是收费链接,请大家注意区分。 1. Website 1.1 浏览器 FilFox - 6Block 团队开发的 Filecoin 浏览器 Filscan - IPFS原力团队开发的 Filecoi

Filecoin 401 Nov 16, 2022
PyWinRT is a community-supported fork of the pywinrt tool from the Microsoft xlang project.

PyWinRT is a community-supported fork of the pywinrt tool from the Microsoft xlang project.

null 19 Dec 1, 2022
Project is to port original Zmodem for Unix to CP/M and provide binaries and source code for platform specific modification as needed. Based on 1986 C source code by Chuck Forsberg

Zmodem-CP-M This repository is intended to foster a RetroBrewComputers community effort to port the original Zmodem source code for Unix to CP/M so ev

null 11 Aug 31, 2022
Project is to port original Zmodem for Unix to CP/M and provide binaries and source code for platform specific modification as needed. Based on 1986 C source code by Chuck Forsberg

Zmodem4CPM This repository is intended to foster a RetroBrewComputers community effort to port the original Zmodem source code for Unix to CP/M so eve

null 11 Aug 31, 2022
The function is based on MQTT. When the original serial of ESP8266/ESP32 cannot be used, it can replace serial print.

MqttPrint and MqttMonitor The function is based on MQTT. When the original serial of ESP8266/ESP32 cannot be used, it can replace serial print. MqttPr

fw-box 4 Sep 28, 2022
The v.st Colour Mod - a colour vector generator based on the original v.st

VSTCM - the v.st Colour Mod - a colour vector graphics generator The vstcm is a PCB which can generate colour vector graphics which can then be displa

Robin Champion 29 Nov 28, 2022
Project PLS is developed based on icarus iverilog and will compile verilog into a much faster optimized model.

Getting Started with PLS The project is developed based on icarus iverilog. Special thanks to Stephen Williams ([email protected]). PLS is a Verilog si

null 10 Nov 8, 2022
This package contains the common algorithms in robotic arm, and I have developed it based on universal robot. It will be continuously updateing.

Robotic_Arm_Algorithms It contains the common algorithms in robotic arm, and will be recording the development as soon as I have completed the any one

Mingshan-Beal 87 Nov 22, 2022
Raspberry Pi Pico Arduino core, for all RP2040 boards

Arduino-Pico Raspberry Pi Pico Arduino core, for all RP2040 boards This is a port of the RP2040 (Raspberry Pi Pico processor) to the Arduino ecosystem

Earle F. Philhower, III 847 Nov 25, 2022
Arduino Core for Deneyap DevKits

Deneyap Kart Arduino Core FOR TURKISH VERSION Deneyap Kart, designed and manufactured in Turkey, is a powerful development board with its strong MCU,

Deneyap Kart 36 Nov 20, 2022