eferu / hoverboard-sideboard-hack-gd Goto Github PK
View Code? Open in Web Editor NEWHoverboard sideboard hack for GD32 boards
License: GNU General Public License v3.0
Hoverboard sideboard hack for GD32 boards
License: GNU General Public License v3.0
Hi,
I have a few sideboards lying around and was wondering if I could repurpose these boards for other projects, like a simple Neopixel controller or similar applications. Essentially, Iโd like to use them as an Arduino alternative.
I have a few questions:
Thanks in advance for your help!
Dear Teacher,
_ Between DMP, Kalman Filter and Complementary filter which way you think that is the most stable and reliable.
_ How can we add bias in the DMP (i saw that there are dmp_set_bias_...() functions but can we set bias for each axis?)
_ There is gyro calib feature in DMP, but it only works after 8 secs of no motion, so can we save the bias for the next time?
Thank you very much my teacher.
My sideboard chipset is GD32F130C8T6 different from yours (C6T6). I have flashed your firm ware to my chip success but it can't read MPU data. Do you know what i have to do to make project is suitable with C8T6 chip
Hey @EmanuelFeru,
I followed all the steps to get sideboard data (GD32F130C6T6 with MPU-6050A).
I unlocked the board and got it flashed. However, when I monitored Euler value I got only zeros.
Command = e
Roll:0 Pitch:0 Yaw:0
Roll:0 Pitch:0 Yaw:0
Roll:0 Pitch:0 Yaw:0
Roll:0 Pitch:0 Yaw:0
Roll:0 Pitch:0 Yaw:0
Roll:0 Pitch:0 Yaw:0
When I run a self-test, I get this result
accel: 319802219 -323885 134236467
gyro: -1743067344 1087314292 -1256236507
Gyro failed
Accel failed
Compass failed
Any idea what's causing this ?
Thanks for your help
Cheers ๐
PS: After the flash, I have a steady green LED light.
Hi, I'm obviously missing something since make fails with errors.
Help, please?
Ubuntu 16.04
stlink installed from stlink-1.6.1-1_amd64.deb
VARIANT_DEBUG selected
Makefile: added -std=gnu99 (else I get "'for' loop initial declarations are only allowed in C99 or C11 mode")
Result:
(...)
arm-none-eabi-gcc build/gd32f1x0_adc.o build/gd32f1x0_can.o build/gd32f1x0_cec.o build/gd32f1x0_cmp.o build/gd32f1x0_crc.o build/gd32f1x0_dac.o build/gd32f1x0_dbg.o build/gd32f1x0_dma.o build/gd32f1x0_exti.o build/gd32f1x0_fmc.o build/gd32f1x0_fwdgt.o build/gd32f1x0_gpio.o build/gd32f1x0_i2c.o build/gd32f1x0_ivref.o build/gd32f1x0_misc.o build/gd32f1x0_opa.o build/gd32f1x0_pmu.o build/gd32f1x0_rcu.o build/gd32f1x0_rtc.o build/gd32f1x0_slcd.o build/gd32f1x0_spi.o build/gd32f1x0_syscfg.o build/gd32f1x0_timer.o build/gd32f1x0_tsi.o build/gd32f1x0_usart.o build/gd32f1x0_wwdgt.o build/system_gd32f1x0.o build/main.o build/util.o build/systick.o build/mpu6050.o build/mpu6050_dmp.o build/setup.o build/i2c_it.o build/gd32f1x0_it.o build/startup_gd32f1x0.o -mcpu=cortex-m3 -mthumb -specs=nano.specs -TGD32F130C6T_FLASH.ld -lc -lm -lnosys -Wl,-Map=build/firmware.map,--cref -Wl,--gc-sections -o build/firmware.elf
(...)
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/armv7-m/libc_nano.a(lib_a-errno.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: build/firmware.elf section .rodata' will not fit in region
FLASH'
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: region `FLASH' overflowed by 684 bytes
collect2: error: ld returned 1 exit status
By the way, EmanuelFeru/hoverboard-firmware-hack-FOC (the mainboard) builds successfully.
Used hoverboard-firmware-hack-FOC. In complete delight. Thanks to the author.
I wanted to have fun with the side boards of the hoverboard. Create a theremin device.
When the board is tilted, it emits a sound of varying frequency.
Instead of LED1, I connected a speaker.
Using the STM32 ST-LINK Utility program, change Option Bytes Protection - Disabled, apply,
then check the box WDG_SW, apply.
The programmer gives errors, but changes the settings.
Download the program from ARM Keil v5.37
Create project, change compiler options c90 to gnu90 , No Warning
Debug Use options: ST-Link Debugger
file config.h
#define VARIANT_HOVERBOARD
file systick.c
// if (SysTick_Config(SystemCoreClock / 1000)){
if (SysTick_Config(SystemCoreClock / 200000)){
file mpu6050.c
// delay_ms(100);
delay_ms(20000);
file gd32f1x0_it.c
void SysTick_Handler(void)
{
tick_count_increment();
delay_decrement();
sound();
}
file util.c
extern MPU_Data mpu;
volatile int32_t x,x1;
void sound2(void) {
mpu_get_data(); x= mpu.euler.pitch >>2; if (x>1000) x=1000;
}
void sound(void) {
x1--; if (x1<1) {x1=x; toggle_led(LED1_GPIO_Port, LED1_Pin);}
}
file main.c
while(1) {
delay_1ms(100);
sound2();
// delay_1ms(DELAY_IN_MAIN_LOOP);
// handle_mpu6050();
// handle_sensors();
// handle_usart();
// handle_leds();
// main_loop_counter++;
Alternatively, you can compile with gcc-arm-none-eabi,
then rename the output file from proj.elf to proj.axf
and substitute in ARM Keil. And from it to load into the controller.
Hi Emanuel,
I have two sets of sideboards one of each shown below. One set has GD32F103C8T6 and the other set has GD32F130C6T6.
Programming the GD32F130C6T6 fails usually after writing somewhere between 4 and 12 pages and this is consistent for both sideboards in the pair. They unlock and erase / erase verify ok. I think there was another issue already open where people had experienced the same problem but no solution yet.
Programming the GD32F103C8T6 boards always succeeds, however the code does not appear to run properly, LED 4 or 5 turns on and nothing further happens, no communication with main board. Have you ever successfully run on this MCU? I suppose it is not working because of unsupported MPU 6052C?
Do you have any experience with either of these issues or any idea where to start to look to debug?
On my hoverboard sideboards the SWD programming pins differ from the ones specified in sideboard pinout. From top -> bottom mine go:
It took a while to figure out since I thought there was something wrong with my STLINK/V2 programmer, so it might help others with the same board to add a notice in the readme for that.
I tried forking the code and when I try and upload firmware.bin it will not download, ST-Link is saying "warning core is locked up." It will download firmware.elf (idk what that is) and when I power the board it beeps in sets of three. I am attempting to use US_ARtT variant. When I hook it to an Arduino it seems to have no effect.
I tried with keul uvision5 and st-link software. Keul gives error about missing packet (i installed GD32F130 package). St-link detect chip as some st version and start to flash it, but stops at beginning. I can disable read out protection.
Do i have to install some button to put chip in programmin mode like mainboard (must hold power button while flashing)?
So I've cracked an old hoverboard containing these identical 2 pcbs. It uses GD32F130C6T6 (reports 32k, I was able to upload the whole bin file, I had to hold the power button during flash)
And I was able to compile & flash the DEBUG example without the MPU_SENSOR definition
Any help of the pinout of where is that UART that I can hook and observe/send commands?
One additional question - with that VARIANT_DEBUG can I send commands to move the motor? and what I should use if that's not the right variant (not interested in MPU sensor just sending command to move in specified direction and speed)
Disable WDG_SW for correct operation. Put a tick in the options in the programmer ST-LINK. It took a lot of effort to solve the problem.
I have a new variant of sideboard with 2 led headers and a slightly changed pinout. I will update with the pinout I find.
So far, a lot of the pins line up for the sensors and battery meter pins. One notable difference is that this board is fed +36V instead of +15V, so the LEDs are most likely a different voltage config. There is also 3 colors in the front lights, so they are potentially RGB. will update!
I tried forking the code and when I try and upload firmware.bin it will not download, ST-Link is saying "warning core is locked up." It will download firmware.elf (idk what that is) and when I power the board it beeps in sets of three. I am attempting to use US_ARtT variant. When I hook it to an Arduino it seems to have no effect.
Hello, I am having some problems in getting data from the IMU with an Arduino via Serial. First I have to say that im new to this kind of projects, so I apologize if can't explain properly.
I have a sideboard with a GD32F130 C6T6 and a MPU-6050A. I have unlocked the micro and then flashed it (with lot of difficulties because most of the time I get errors meanwhile writing the pages). Before flashing, I modified config.h to have the Hoverboard Variant because it includes the Serial Control via serial port (I have also tested with Serial Feedback deactivated).
Then, I modified this Arduino program to define the same Feedback struct that is sent via serial by the Sideboard.
And finally, I connected the 3.3V and GND pins from the SWD programming pins to power the board, and the GND and RX (pin number 2) pins from Arduino have been connected to GND and TX from the connector that connects the Mainboard with the Sideboard.
However, Arduino does not receive anything via serial. In fact, I have enabled DEBUG_RX in the Arduino program and I only receive 0s.
I have also tested to disable DMP as said in this comment, but again nothing happens.
I don't know what is wrong and I don't have more ideas. Any help would be appreciated.
Thanks
Can this side panel support PWM? Or can it be updated to support PWM?
Hi!
I'd like to use sideboard as UART-driven sensor, i.e. the goal is to read gyro/accelerometer data via UART.
Had some problems flashing the GD chip using ST-link utility, but solved them with st-flash.
Connected sideboard to external power source with 15V and connected it via USB-TTL adapter to PC's USB port (this have worked earlier with main board)
Tried different variants and noticed the following:
But values in the buffer are all zeroes.
Again, this setup worked normally when used with gyro's mainboard (sending commands, reading feedback).
I'm out of ideas. Maybe serial setup is different for sideboard?
HANDLE serialHandle = CreateFile("COM4", GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
DCB serialParams = { 0 };
serialParams.DCBlength = sizeof(serialParams);
GetCommState(serialHandle, &serialParams);
serialParams.BaudRate = CBR_115200;
serialParams.ByteSize = 8;
serialParams.StopBits = ONESTOPBIT;
serialParams.Parity = NOPARITY;
SetCommState(serialHandle, &serialParams);
while (true)
{
static char buf[16];
memset(buf, 0xcc, sizeof(buf)); // just to make sure that zeroes comes from serial port
DWORD bytesRead;
ReadFile(serialHandle, buf, sizeof(buf), &bytesRead, NULL);
std::string str;
for (int i = 0; i < bytesRead; ++i)
{
str += format_string("%02x ", buf[i]);
}
log_msg("[%u] %s", bytesRead, str.c_str());
}
Hi,
sometimes the mu_init() and mpu_config() fail. When I power cycle the board it's good again for some time.
Any help is appreciated,
Lieven
I saw that Euler angles that calculate from DMP are so wrong.
When i checked with 3D Visualization Demo, the angle rotated more about 8 times than reality.
I saw your clip upload on Telegram, it's so cool and smooth.
Have you ever meet that behavior? Please help me teacher.
I have sent you a short clip on telegram, please accept my request (https://t.me/tonvanhieu)
Here is a picture of the Windgoo sensorboard that was inside my Hoverboard. The SWD programming pins are directly below the connector for the mainboard. I have measured the pins and added them to the picture.
Connecting the board through ST-Link utility and unlocking the flash went okay. No errors.
After that I tried to install uVision and open the .UVPROJ file but I get a lot of errors about missing files for the M3 Cortex boards. Probably the custom algorithm for the flashing utility. I have tried to install the legacy database but not sure what to do next.
The Hex file that is already in the build folder of the repository doesn't flash with ST-Link utility. Is it possible to get a pre-build bin file of the Hoverboard version?
i've tested couple of such devices, and it seems that internal watchdog reset device in 300-500 ms
i've solved it by adding fwdgt_counter_reload(); inside delay_1ms while in systick.c , but not sure this is correct place for it
Hi, could you add an abstract to the readme, pointing out what this firmware does, e.g. does it reimplement the original behavior? Thanks.
Hello, i'm trying to compile a debug variant, however i get the following error:
/usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: build/firmware.elf section .rodata' will not fit in region
FLASH'
/usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: region `FLASH' overflowed by 2696 bytes
so it seems it's bigger than flash region on the GD chip.
Hello.
Would you share a code to control this board via UART?
Thank you.
Theoretically, you can make a self-balancing robot. This will be your cool project. For example, like Ninebot mini
When opening project in Keil you get errors for missing devices.
Devices are installed but still give issue.
Solution is to rename uvproj to uvprojx
Is this firmware compatible with my GD32F130C8T6 board? It looks like this chip has double the flash and ram, but otherwise the same as the 6T6.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.