Coder Social home page Coder Social logo

communitygd32cores / arduinocore-gd32 Goto Github PK

View Code? Open in Web Editor NEW
85.0 8.0 33.0 3.81 MB

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

License: Other

C 92.86% C++ 3.42% Assembly 3.50% Processing 0.05% Python 0.11% Smarty 0.06% Makefile 0.01% Batchfile 0.01%

arduinocore-gd32's Introduction

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 #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?

arduinocore-gd32's People

Contributors

algernon avatar arcayi avatar bjc avatar bmourit avatar bnmguy avatar djix123 avatar maxgerhardt avatar obra avatar robodurden avatar wherearebugs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduinocore-gd32's Issues

install package issue

OS: macOS12.6.6
IDE: vscode with arduino-cli

[Starting] Install package - GD32Community...
GD32Community:gd32:0.0.1
Invalid argument passed: Found 0 platform for reference "GD32Community:[email protected]":

[Error] Exit with code=7

When I add the url to Arduino settings and want to install this package some problems occurred like above.
image
I have googled it but nothing found, so how to aim the problem and shoot it down?

Fix linter errors

As introduced with #22, we now have a Python, C and C++ linter active in the project.

It already throws quite a bit of errors and has suggestions for code improval.

Some errors are wrong however, the linter just does not know about SCons / PlatformIO specifics.

For now it has been temporarily disabled to mark the linter errors as run errors per 240b9d7, so that we don't get spammed with failure emails.

The code needs to be progressively improved and the linter settings need to be tweaked so that we have sensible output and good linting.

A list of all previous errors can be found in https://github.com/CommunityGD32Cores/GD32Core-New/actions/workflows/linter.yml.

A sample file is attached

4_Lint Code Base.txt

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).

Support questions: upload methods

Hello, i have a question about device support for this boards package. How well is the serial upload support? Do i need to download any external software to use this feature, or is it built-in to the package? I am not able to use external software for safety reasons, so i need to know if it will work without or if there is an alternative method for serial upload. Thank you for your help.

Add USB DFU upload method

Flashing a GD32F303CC board with the popular STM32Duino USB DFU bootloader, e.g. https://github.com/rogerclarkmelbourne/STM32duino-bootloader/blob/master/binaries/generic_boot20_pc13_fastboot.bin, shows that this exact binary works without problems on the board, although it's meant for a STM32F103C8 (which seems to be register-compatible for the USB and GPIO side)

grafik

The device is being recognized via USB and opens the Maple serial as expected.

This should make it possible to add USB DFU uploads for those chips having USB but no built-in USB bootloader, that is for F30x series the 303 chips.

grafik

Important logic in PlatformIO

https://github.com/platformio/platform-ststm32/blob/38e325b59c165c954f6f69c70e0299d36f3b9225/builder/main.py#L206-L265

probably also needs LDScript changes to respect the offset.

Also needs to be implemented for the Arduino IDE.

It should also be investigated what other boards can make use of this USB bootloader.

Expose PWM functions via `analogWrite` and friends

Currently calling analogWrite will attempt to write the value into the DAC peripheral, producing an exact analog voltage.

https://github.com/CommunityGD32Cores/GD32Core-New/blob/92bdf02a90e61e9a2b20ffc1adf81671175fbdc5/cores/arduino/wiring_analog.c#L127-L135

The regulard Arduino API analogWrite would start a PWM output with some default parameters (e.g., PWM frequency, PWM resolution etc.) on that pin.

The functionality should be changed so that analogWrite also starts a PWM wave and friend functions for setting resolution and frequency should be added.

Currently, PWM functionality is available via the PWM class

https://github.com/CommunityGD32Cores/GD32Core-New/blob/92bdf02a90e61e9a2b20ffc1adf81671175fbdc5/libraries/pwm/examples/pwmoutput/pwmoutput.ino#L1-L11

(and is partly not working, see #4)

The DAC functionality should still be accessible of course -- it has to be thought to which API it should be moved, or if an "auto-detection" between PWM and DAC should be made.

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

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.

CDCACM_::available() returns the count of what's already been read

This is not an issue in the current core, but in @bjc's bjc/gd32usb-test branch. As issues aren't available in the fork, and the feature will - hopefully - make it back here in the not too distant future, I'm opening the bug here.

The core of the issue is that CDCACM_::available() returns the count of what's already been read into the buffers, rather than what's really available, rendering the function almost useless.

To showcase the problem, use the following sketch:

#include "Arduino.h"

void setup() {
  Serial.begin(9600);
};

void loop() {
  if (Serial.available()) {
    uint8_t b = Serial.read();
    Serial.println(b);
  }
}

Feeding data onto the serial port from one terminal, and reading from the other, this currently never outputs anything.

If we change the sketch, and do a read before calling .available():

#include "Arduino.h"

void setup() {
  Serial.begin(9600);
};

void loop() {
  uint8_t b = Serial.read();
  if (Serial.available()) {
    b = Serial.read();
    Serial.println(b);
  }
}

And then feed the port with two bytes written at a time (eg, echo a >/dev/ttyACM1, which will send a newline along), we'll quickly discover that the first byte is read, and because we read more than one byte at a time into an internal buffer, .available() will return 1 too, and we'll read the second byte too.

Make sure `Serial` doesn't lock up

A previously noted issue was that if something like

Serial.println("ABC");
Serial.flush();

was done it would hang up the MCU in an infinite loop. This was fixed in 3770a80 by marking the member variables of the ring buffer implementation as volatile, forcing them to be reloaded from RAM very time for a check. The original problem being, that the compiler optimized away further loading of this variable since it didn't see how it could be modified, although it was being modified in the ISR.

Fixing the ringbuffers was one part but there could potentially be another source of hangup through missing volatile in

https://github.com/CommunityGD32Cores/GD32Core-New/blob/92bdf02a90e61e9a2b20ffc1adf81671175fbdc5/cores/arduino/HardwareSerial.cpp#L221-L235

through the .tx_state member.

However, marking that as volatile resulted in lots of compiler errors.

It should be investigated whether it possible to trigger this bug (lockup) and then fix it.

There may be other places where volatile is missing, causing potential lockups.

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.

Increase exposure

Once the core has reached a certain level of stability and maturity, it should be thought about how to "get the word out" about this new core. This would attract new users and contributers for sure.

Some thoughs:

  • Hackaday article
  • blog posts
  • YouTube videos
  • Great example projects which use exclusive GD32 features
  • ...

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.

(Master Issue) Test which components work or don't work

This is a master issue regarding the testing of all the components that were already in the core. It should be noted what features were tested, which worked, which did not work, and which features were not present. If a feature is marked with tickmark, it means it was working, otherwise it is untested, or tested to be non-working if there is a comment below it.

  • GPIO
    • Output working
    • Input working
    • Input with pullup working
    • Input with pulldown working
  • Interrupts
    • attachInterrupts() works in all cases (FALLING, RISING, CHANGE, NONE)
      • FALLLING works
    • noInterrupts() and interrupts() work
  • ADC / Analog in
    • basic analogRead() on a channel
    • analogReadResolution() works
    • all ADC channels work
    • read V_REF (analog voltage reference)
    • read V_TEMP (internal temperature sensor)
  • Serial
    • Baud rate setting
    • Basic println() with all data types
    • Parity (Even / Odd / None)
    • Data bits (7 / 8 / 9)
    • Stop bits (1,2)
    • Flow control
    • RS485 mode
  • I2C / Wire library
    • Basic I2C transfers as master
    • Wire.setClock() function implemented (88d1cd7) but not measured / verified to be correct (100kHz, 400kHz,..)
    • different I2C address sizes (7/8/10 bits?)
    • I2C slave
    • Bug #3
  • PWM
    • working on some pins correctly
    • Bug #4
    • Needs enhancement #1
  • Timers
    • HardwareTimer works
  • tone() / noTone()
  • SPI
    • basic SPI transfers
    • all SPI modes work
    • all supporte clock settings work
    • SPI slave
    • Hardware NSS
  • DAC
    • setting output voltage works
  • SoftwareSerial library
    • works at comon baudrates
    • supports common UART formats (databits, parity, ...)

Add CI

The core should be built automatically on a new commit and tested against reference projects.

One could probably set up a Rasberry Pi with an actual board to act as a CI host (instead of using probably paid-for Github CI actions).

Conflicting `Serial` definitions

#if defined(USE_USART0_SERIAL)
extern HardwareSerial Serial;
#define HAVE_HWSERIAL
#endif
#if defined(USE_USART1_SERIAL)
extern HardwareSerial Serial;
#define HAVE_HWSERIAL1
#endif
#if defined(USE_USART2_SERIAL)
extern HardwareSerial Serial2;
#define HAVE_HWSERIAL2
#endif

If a board enables both UART0 and UART1 there would be two Serial objects. Needs to be fixed.

Use Upload Offset in DFU Upload

The Keyboardio board added in #39 defines one possible upload method for the board as DFU, with an flash_offset of 0x2000.

This is however not respected in the platform.txt DFU upload method. It is respected when building the firmware through relocating the vector table etc. See #39 (comment).

compiler.c.elf.flags=-mcpu={build.mcu} {build.flags.fp} -mthumb {build.flags.optimize} {build.flags.ldspecs} -Wl,--defsym=LD_FLASH_OFFSET={build.flash_offset} -Wl,--defsym=LD_MAX_SIZE={upload.maximum_size} -Wl,--defsym=LD_MAX_DATA_SIZE={upload.maximum_data_size} -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common

tools.serial_upload.upload.params.verbose=-d
tools.serial_upload.upload.params.quiet=n
tools.serial_upload.upload.pattern="{path}/{cmd}" {serial.port.file} {upload.altID} {upload.usbID} "{build.path}/{build.project_name}.bin"

We need to very / fix the workings of the DFU upload methods in regards to the upload offset.

Linked to PlatformIO board definition (PR CommunityGD32Cores/platform-gd32#15) too, since DFU upload is also done there but without an upload offset (since the board definition file doesn't have one).

Add I2S library

Since the boards do have an I2S peripheral it would be nice to have a library that makes use of it, with audio examples.

Add FreeRTOS library

The core should have a builtin FreeRTOS library, akin to STM32FreeRTOS.

This additionally requires that the core allows hooking of the SysTick function and possibly other functions.

Add documentation or Wiki

As this core grows and gains its own set of functionality, there should be a documentation that users can refer to.

We may think about using DoxyGen or create Wiki pages for several topics (e.g., libraries, core features, ...)

Convert ARM assembler startup files to GCC-compatible during build

As I understand it, the board startup code in https://github.com/CommunityGD32Cores/ArduinoCore-GD32/tree/main/system/CMSIS/GD/GD32F30x/Source/GCC is being generated by hand run sed scripts from the upstream firmware library source in GD32F30x_Firmware_Library_V2.0.2/Firmware/CMSIS/GD/GD32F30x/Source/ARM (which is missing in this repository).

In order to better support drop-in firmware library upgrades, the GCC-compatible startup code should be generated as part of the build process, with the relevant translation scripts checked in to the source tree.

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

Make clock source selectable

Currently the system_gd32f30x.c has a hardcoded clock source of HSE+PLL to 120MHz.

This should be changable via defines (in the Arduino IDE: via a menu selection) to be able to boot from

  • IRC8M (internal 8MHz clock)
  • IRC8M + PLL
  • XTAL + PLL (current standard)
  • external clock (XTAL in bypass mode)
  • external clock (XTAL in bypass mode) + PLL

Equalize include flag and warning flags with platform.txt

PR #43 changed some -I includes to -isystem includes so that we don't get warnings from the SDK and ArduinoCore-API code that we don't touch.

Further, the Arduino core builds with warning flags (-Wall -Wextra) that PlatformIO doesn't use.

All these flags should be equalized.

A possible caveat with changing -I to -isystem flags in the PlatformIO system is however that when moving folders from the CPPPATH to CCFLAGS (-isystem flags), they might disappear from the include search directory in generated IntelliSense configuration files (c_cpp_properties.json). This would greatly limit IDE usefullness when using PlatformIO. If that is the case, an issue in the PlatformIO core must be opened (or accepted that we can't change -I to -isystem comfortably yet).

Firmware hangup in `i2c_stop()` and other I2C functions

I observed it multiple times in a hardware configuration with a SSD1306 I2C OLED display that reflashing the firmware at specific points would cause the new firmware to hangup in the i2c_stop() function (as I observed in the debugger).

https://github.com/CommunityGD32Cores/GD32Core-New/blob/88d1cd79e196e13deaa67faeb7aea008f10157fd/libraries/Wire/src/utility/twi.c#L144-L155

This code does not have timeouts (as opposed to other I2C functions) and in case the I2C peripherhal wants to assert a STOP condition but the bus just doesn't let it be driven that way (some other device is interfering?) this hangs up forever.

This should be investigated and fixed.

Can't upload in the Arduino IDE

Refer #6.

The platform.txt etc. is referencing a missing upload package

https://github.com/CommunityGD32Cores/GD32Core-New/blob/462ceb8ab5894d6a2e9d6239a4cc206ba8f45172/platform.txt#L112-L121

It is partly available from https://github.com/CommunityGD32Cores/GD32Core (JLink & Serial but no GDLink).

However, I don't like this particular setup of calling into a batch file for multiple different OSes and then having helper scripts there. Also I don't like that the upload method uses .bin files, this is missing a potential upload offset if one is used (e.g., for bootloaders). At least for SWD / JTAG based uploads, we should be able to directly reference OpenOCD as a package and call into it with the right flags, just like I do in PlatformIO. (

An OpenOCD upload via a ST-Link (SWD) e.g. looks like

openocd -d2 -s C:\Users\Max\.platformio\packages\tool-openocd/scripts -f interface/stlink.cfg -c "transport select hla_swd" -c "set CPUTAPID 0x2ba01477" -f target/stm32f1x.cfg -c "program {.pio\build\genericGD32F303CC\firmware.elf} verify reset; shutdown;"

And similiarily for the GDLink (which is a cmsis-dap -- and actually the STLink can be treated as a cmsis-dap.cfg as well).

I see a custom OpenOCD version being developed at https://github.com/GigaDevice-Semiconductor/openocd/ but actually I did not have the need to use it since it also works well-enough treating the chips as STM32 chips in regards to uploading to flash.

Add USB functionality

The currently does the original GD32 USB libraries (https://github.com/CommunityGD32Cores/GD32Core-New/tree/main/system/GD32F30x_firmware/GD32F30x_usbd_driver) but these are not used.

No USB functionality is available, e.g. USB CDC, USB HID, etc.

It should be thought out very carefully how USB support is added.

The ArduinoCore-API repo has the PluggableUSB class which is e.g. used in the ArduinoCore-mbed USB implementation.

Other cores use something like e.g. tinyUSB (Adafruit fork).

Since I'm no expert on USB, design thoughts & implementation help is appreciated.

Right now USB seems like a complex feature and maybe other smaller features can take precendence first.

Add support for low-power modes

The core, or a library, should be able to expose the low-power functionality of the chip, such as

  • a low-power run
  • deep sleep
  • standby (only wakeup through pin or reset, ..)

(I have not checked that these are the low-power modes available, just a guess from STM32 chips)

It should also be supported to put every known peripheral to sleep, or better yet, automatically put it to sleep if not needed.

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

Add SD card library

This core should have a SD library like https://github.com/arduino-libraries/SD to be able to access SD cards.

Along this should probably be some sort of file and filesystem support, like with the ESP32.

Note that our boards do have a SDIO peripheral which is meant to interface with SD cards. But I guess it also works in SPI mode.

It should be investigated how the library can be ported or support for it can otherwise be sensibly added.

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.

PWM does not work on pins needing pin remapping

the PWM class / timer functionality seems to have a problem if the output pin requires a function remap. e.g.,

  • PB4 with TIMER2_CH0 - GPIO_TIMER2_PARTIAL_REMAP does not work (no PWM wave visible on pin)
  • PA6, TIMER2_CH0 - Default does work

Test code

#include <Arduino.h>
PWM pwm_output(PA6);

void setup() {
    pwm_output.setPeriodCycle(500, 250, FORMAT_MS);
    pwm_output.start();
}

void loop() {}

and change PA6 to PB6 to observe the difference. Tested on a GD32F303CC board.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.