Open RoboDurden opened 1 month ago
Concerning clock speed, this might help:
build_flags =
-g -ggdb
-D __PIO_DONT_SET_CLOCK_SOURCE__
-D __SYSTEM_CLOCK_48M_PLL_IRC8M_DIV2=48000000
-D $PIOENV
Getting Error: This board doesn't support spl framework!, someone can help?
My platformio.ini file: [platformio] src_dir = Src include_dir = Inc
[env] platform = https://github.com/CommunityGD32Cores/platform-gd32.git platform_packages = framework-spl-gd32@https://github.com/CommunityGD32Cores/gd32-pio-spl-package.git
[env:genericSTM32F103C8] platform = ststm32 board = genericSTM32F103C8 framework = spl build_flags = -D GD32F130 -D TARGET=1 -D USE_HSI_CLOCK -DSTM32F100xB -DSTM32F10X_MD
well i guess that if you change the platform to stm32, you should also overwrite the platform_packages ?
Maybe try this blink first to reslove the STL error: https://github.com/platformio/platform-ststm32/tree/master/examples/spl-blink
Yes and you have it already selected in your [env] section. But in the (overwriting ?) [env:genericSTM32F103C8] section you switched back from gd32 to stm32 :-/
Did you test my links for the original platfromio.ini , that works for me:
https://github.com/platformio/platformio-home/issues/42 https://github.com/platformio/platformio-home/issues/1859
I'm trying to
"Please specify platform for 'genericGD32F130C8' environment"
If you are running Windows, check your platformIO folders. Mine are found in
C:\Users\PAN CF-LX6.platformio\packages C:\Users\PAN CF-LX6.platformio\platforms
Installed package but i still don't know how do i 'specify platform'?
can you send me the gd32 file inside platform folder and the framework one?
https://robosoft.de/forums/hover/
but these files should be auto downloaded when you compile the project. Try to clear and clean the project..
will we get online editor for gen2 anytime soon
Can't even clean because of this "Please specify platform". Sorry if I'm not understanding something
I have to go. If you find a solution...
I am not at all experienced with PlatformIO. I also only used it for one project two years ago. If you do no longer use PIO for this other project of yours, i would uninstall and reinstall PIO..
ok
and google your errors. https://www.google.com/search?client=firefox-b-d&q=%22Please+specify+platform+for
alredy tried that
@Electron-py actually i do not understand why you want to compile for a [env:genericSTM32F103C8] . You have a Gen2.1.1 which is GD32F130
When i add for the Gen2.2.t boards
[env:genericSTM32F103C8]
platform = ststm32
board = genericSTM32F103C8
framework = spl
build_flags = -D GD32F103
-D TARGET=1
-D USE_HSI_CLOCK
-DSTM32F100xB -DSTM32F10X_MD
i get the Error: This board doesn't support spl framework!
that might help: https://github.com/platformio/platform-ststm32/issues/13#issuecomment-378051575
my genericSTM32F103C8.json
is in C:\Users\PAN CF-LX6\.platformio\platforms\ststm32\boards
But i failed at step 2. This is my stm32f1 folder:
the startup file needs to be changed in target.h line 48
#include "startup_stm32f10x.c"
//#include "gd32f10x.h"
But that is not working
Src\../Inc/../Inc/target.h:48:11: fatal error: startup_stm32f10x.c: No such file or directory
#include "startup_stm32f10x.c"
^~~~~~~~~~~~~~~~~~~~~
And as a Keil/PIO beginner i do not really know how #include "gd32f10x.h"
works successfully..
I made it work. Now i have an error when compiling about RemoteCallback being defined more times.
I made it work.
What did you make work ? And how did youmake it work ??
RemoteCallback is declerated in remote.h once.
I found a pakcage for gd32 and now i don't have enviroment errors anymore
this is not very instructive :-( You found the package under your kitchen table ? Still trying to compile stm32f103 ?? platformio.ini ???
build_flags = -g -ggdb -D PIO_DONT_SET_CLOCK_SOURCE -D __SYSTEM_CLOCK_48M_PLL_IRC8M_DIV2=48000000 -D $PIOENV
I tried this
[env:genericGD32F130C8]
board = genericGD32F130C8
framework = spl
build_flags = -D GD32F130
-D TARGET=1
-g -ggdb
-D __PIO_DONT_SET_CLOCK_SOURCE__
-D __SYSTEM_CLOCK_48M_PLL_IRC8M_DIV2=48000000
-D $PIOENV
and this:
[env:genericGD32F130C8]
board = genericGD32F130C8
framework = spl
build_flags = -D GD32F130
-D TARGET=1
-D USE_HSI_CLOCK
-DSTM32F100xB
-DSTM32F10X_MD
but the beeper tones are still lower than they should be
you need to use proper stm32f103 core if you want to set system clock
based on
//----------------------------------------------------------------------------
// SysTick_Handler
//----------------------------------------------------------------------------
void SysTick_Handler(void)
{
msTicks++;
}
in it.c
you should be able to let the buzzer beep (or let red led blink) in 10 second intervals. Then measure the time it really takes and we might be able to see at how many Mhz the cpu is running.
This might give us a clue why the clock is wrong.
And if the motor is still running nicely, we might live with the wrong cpu clock and scale the beeper tone .. But i guess that the uart baud rate would also have to bee scaled :-/
This platformio.ini did make the GD32F130 run with correct clock. Serial communcation was working. https://github.com/RoboDurden/Split_Hoverboard_SimpleFOC/blob/main/platformio.ini
it is very clear, you are using gd32f103 core, its normal that clock cannot be configured, its same for mm32f103, the clock will be lefty as default
I installed this: https://github.com/CommunityGD32Cores/platform-gd32 in PlatformIO for GD32 support and this is my platformio.ini file: [platformio] src_dir = Src include_dir = Inc
[env] platform = https://github.com/CommunityGD32Cores/platform-gd32.git platform_packages = framework-spl-gd32@https://github.com/CommunityGD32Cores/gd32-pio-spl-package.git
[env:genericGD32F130C8] board = genericGD32F130C8 platform = gd32 framework = spl build_flags = -D GD32F130 -D TARGET=1
Now the enviroment works. The error that I have is that the RemoteUpdate function is defined multiple times: One in remoteUartBus.c and one in remoteUart.c . When Platform IO tries to link those files gives errors because when it links them there are two RemoteUpdate functions. It needs to be defined only once or, if they are two separate functions, to rename it in one file.
I made it compile! I simply renamed the conflicting functions in remoteUart adding a 2 and now it compiles.
But the beeping is wrong.
based on
//---------------------------------------------------------------------------- // SysTick_Handler //---------------------------------------------------------------------------- void SysTick_Handler(void) { msTicks++; }
in
it.c
you should be able to let the buzzer beep (or let red led blink) in 10 second intervals. Then measure the time it really takes and we might be able to see at how many Mhz the cpu is running. This might give us a clue why the clock is wrong.And if the motor is still running nicely, we might live with the wrong cpu clock and scale the beeper tone .. But i guess that the uart baud rate would also have to bee scaled :-/
I added some logic to turn on the led for 50ms every 5 seconds: https://github.com/hoverboardhavoc/Hoverboard-Firmware-Hack-Gen2.x-GD32/tree/hoverboardhavoc/debug_clock
In the videos below which show hoverboardhavoc/debug_clock running, you can see the LED flashing every five seconds but the behavior of the motor and buzzer is different. The tones are different pitch and the motor makes a kind of metallic sound on the Platform IO build
Keil:
https://github.com/user-attachments/assets/103863e0-74b4-4327-a064-ee0be5972f09
Platform IO:
https://github.com/user-attachments/assets/05b87db9-5f98-4c3c-9b65-fb16dd42c303
@hoverboardhavoc i can confirm. Don't know why it makes that metallic sound.
Maybe it's a different implmentation for PWM. idk
One in remoteUartBus.c and one in remoteUart.c .
As I said, you must only uncomment ONE RemoteXy in config.h
Is uart working with 19200 baud ?
Bldc is running from a 16 kHz interrupt that is triggered when ADC dma has finished, if I remember correctly.
Add a counter and blink led every 160000 counts to that function in bldc.c to verify that it is indeed 16 kHz...
This firmware has the very simple block communication only. If you set the speed to 1000 = 100% pwm duty cycle, then the 16 kHz is the only thing that should affect motor sound.
I think that the buzzer tone is also generated in that calculateBldc function !
One in remoteUartBus.c and one in remoteUart.c .
As I said, you must only uncomment ONE RemoteXy in config.h
Right, sorry. Now it compiles with the original void names.
What am I doing wrong? Using REMOTE_DUMMY
https://github.com/user-attachments/assets/b6eadf11-398a-4bf0-8ed2-0a405b0f0ff2
Looks like not all three hall sensors working . Are the three led blinking with always two overlapping ?
But it might be the wrong 16 kHz timing of calculateBldc that needs your push with a hand at low speed to make the motor start spinning
But even when it starts spinning it doesn't want to. It seems like there are only two fases. And my hoverboard has only red and green light, not orange.
With a Gen2.1.1 you should have a two color led module and a three color led module. And if not you could reasign the up-led or down-led to be the orange one in your defines file. Was the motor spinning correctly with the precompiled dummy ? does it spin correctly with remoteUart and arduino/esp spinning forward and backwards ?
I'll try with uart
nope. still wrong
i can not really help you. With all your short one liners i never really know what you are doing :-(
Thanks @hoverboardhavoc for his pull request https://github.com/RoboDurden/Hoverboard-Firmware-Hack-Gen2.x-GD32/pull/3
Maybe adding stm32F103 support now has become closer. adding this to platformio.ini might somehow do the trick:
taken from https://github.com/RoboDurden/Split_Hoverboard_SimpleFOC/blob/main/platformio.ini