Candas1 / Sideboard-Arduino

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sideboard-Arduino

Why yet another repository ?

There are custom firmwares available for Hoverboards sideboards.
The challenge is that there is a separate firmware for different chip brand/families using different drivers (SPL for GD32F130C8/C6 or STM32 Hal for STM32F103C8/C6 and GD32F103C8/C6).
This duplicates the effort for any enhancement.
This firmware is a tentative to unify the code, using the Arduino platform on Platformio thanks to projects like STM32duino and CommunityGD32Cores.

Benefits

  • Being able to run the same firmware on most of the sideboards, and potentially on Arduino boards/ESP8288/ESP32 with small changes
  • Arduino code would make this firmware more inclusive for contributions, and would leverage a bigger community
  • Many available librairies that can help extend the support of new IMUs,sensors,encoders,displays,....
  • Possibility to later extend this firmware with SimpleFOC motor control for splitboards ( Can be GD32F130C8/C6, STM32F103C8/C6, GD32F103C8/C6, GD32F130K6, GD32E230K6 )

How to use

I am only using Platformio, I cannot support other IDEs.

  • Install Vscode
  • Install Platformio from the website or from VSCODE's extensions
  • Download the project or use git to clone this repository in VSCODE
  • Select the environment that matches with your chip in platformio's bottom bar (For GD32F108C8 and STM32FEBK chips, STM32F103 should work)
  • Unlock the chip
  • Press the 'PlatformIO:Upload' button (bottom left in vscode) to build and upload the firmwware

Debug

Enable debug by uncommenting DEBUG_SERIAL in the config.h file.
SEGGER RTT let's you debug without the need for an USART to USB bridge. It uses the STLINK and the programming pins.
Only downside is that you need to make sure you stop the rtt connection before flashing.
This video shows how to use it for monitoring in Platformio.
The debug menu options depend on what features are enabled in config.h.
Type ? and enter in the serial monitor.

Remote

Some of the sideboards have a 433Mhz receiver and a remote.
You can enable this feature by uncommenting REMOTE in the config.h file.
To identify the code of each remote button, enable DEBUG and use the r command to see the remote output.
Update the button codes in the config.h file.

#define REMOTE_BUTTON1 6637793        // Switch to FOC control type
#define REMOTE_BUTTON2 6637794        // Switch to SIN control type
#define REMOTE_BUTTON3 6637796        // Switch to COM control type
#define REMOTE_BUTTON4 6637800        // Does nothing for now

IMUs

I aim with this firmware to support more IMUs by only retrieving raw data and doing the angle calculation on the MCU, so no DMP features will be supported. This should be enough for balancing use cases.
I also would like to implement a test mode to identify the IMU like this project does as the writing on the chip is not always accurate.

Status:

This is a very early development so it requires more testing and documentation.

STM32F103C8 GD32F130C6 Comment
Leds ✔️ ✔️
Sensors ✔️ ✔️
Segger RTT debug ✔️ ✔️
Simplefoc Commander ✔️ ✔️
Usart command send ✔️ ✔️
Usart feedback receive ✔️ ✔️
433mhz remote ✔️ ✔️
MPU6050 raw data ✔️ Not working with GD32
MPU6050A raw data Different WHOAMI
MPU6050C raw data ✔️
MPU6052C raw data Requires I2C single byte
ICM-20X raw data Try this
Pitch/Roll angle calculation 🚧 🚧 Use this?
SimpleFOC trapezoidal Needs a new GD32 driver (work in progress here)
Should already work on STM32 splitboards
SimpleFOC Sinusoidal Needs sensor smoothing, already in dev branch of SimpleFOC
SimpleFOC FOC Needs a new GD32 driver for current sensing

About


Languages

Language:C++ 79.9%Language:C 18.3%Language:Python 1.8%