-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New motherboard YST-DXT-J20 V4 with "ATERY" AT32F403RCT6 #97
Comments
Shoutout to @TomTinkering |
That is exactly my board. The AT32F403 chip is (I think) more or less the same as the GD32F403RCT6, which provides a bit more support/documentation. I have made a schematic of the board. Here are some resources for the GD version of the chip: And for the AT32F403 chip: I have just started working on it, but not much time right now. Pretty sure it will not run the firmware directly, but it should not be too hard to port. I will let you know if I make any progress |
The GD32 and the AT32 are not exactly the same devices, they have some differences, however the footprint is quite the same and the schematic matches my board. I try to compile something for the AT32, hopefully it works. |
Hmm, for the artery chip I could only find a chinese datasheet/reference manual. Do you have more information? My chinese is not great :P |
Some of the stuff is in English and I use the google translator, otherwise, I am also left to guess. If there is some critical stuff I can ask some Chinese friends of mine if they can translate it for me. Somewhere on the bottom of this site are the standard lib, the files for their dev board and some other stuff: I expect them to be mostly compatible to the STM32 stuff to allow for easier migration, GigaDevices did the same. Also I asked on reddit if somebody knows these chips, which brought only little insight: |
Ah that library is great, that will probably answer most of my questions. Thanks, and good luck |
The hoverboard hack firmware uses the ST HAL, which isn't provided by Atery. |
I would start from the 3ADCs_DMA example, get it running, integrate PWM, UART and GPIO and then take all the non hardware related bits from the hoverboard-hack. I don't think you can reuse much hardware related stuff, or at least, it will be easier to start from scratch, using the STM32F103 source as a reference. Then based on an #ifdef or maybe something fancy like a chip-ID at runtime, it should not be too hard to merge the two projects back together. |
Ok. I searched a bit for information about the gate driver and it seems to be a copy of the IR2108S I managed to compile the example code with Keil uVision and upload it with a Segger J-Link, so now I just have to port this to the gcc toolchain |
It was a bit frustrating to be able to flash the AT32 with jlink, as there is little to no information about everything. At this point I found out, that I need a flash loader as the flash is not directly wirtable through SWD. So this is some code that is loaded into ram, then the PC is set to the start of the code, it gets executed and it can copy/verify blocks of code that is also within the RAM, crazy stuff. Luckily everything necessary is within the uVision support package from Atery, so theoretically I have everything to try it. Software side I could get the Buzzer to work with uVision, so using the timers is no problem. There are tons of examples in the StdLib, which should make it somewhat easy to port the firmware. However a lot of bits and registers are named differently, so there will be some work to make it compatible. |
I patched the HAl driver to work with the AT32 and could successfully compile it and upload it. I will test it later today. |
Thanks for posting all the updates here! |
@cloidnerux Nice work! Few questions: |
Currently, I set 72 MHz to use the same frequency the STM32F103 code does, in case there is some hardcoded frequency dependent stuff. The pinout is mostly the same. I use the schematic TomTinkering provided, and it seems that the R_MTR_PHB and R_MTR_PHA are swapped and there are no motor current shunts. Also, the LED is missing or is on one of the auxiliary boards. I had an error in my hardware definition files so my code did not work yesterday, I fixed it but I have to try it today, so hopefully, everything now works as intended and I can test your changes. |
Ok. I am curious if you run it at higher frequency, if you get better performance for the new BLDC control that I made. If no motor current shunts are there, I wonder how do they do the overcurrent protection? |
Currently I try to get it working at all. There are a lot of small details that mess up the port. Maybe later after everything works I try to increase the freqeuncy, however it only helps so much because there is no reason for the MCU to idle for twice the amount of cycles because the control loops are limited by the motor speed. I think they just measure the phase current and use this value but I really don't know. |
Yes! It works now. I ported the HAL libraries, so I hope it is quite easy to use the same code for both MCUs. |
Nice! Let us know the progress. |
The board has a simple circuit that trips an IO pin on overcurrent, but not also an amplifier connected to and ADC like the stm32/older boards |
@cloidnerux The new sinusoidal based BLDC control is committed: Feel free to give it a try...and tell me if you hear the sound of silence :) |
I tried it and it works. The motors weren't terrible noisy before, they are not noisy now. They seem to be faster, that could however also be a different setting in the config.h The wheels seem to "twitch" however in idle. They seem to move a bit forward and backwards. |
At what frequency do you run the controller? You might need to re-adjust the following calibratable in BLDC_controller_data.c : Recalculate (based on your frequency in Hz)
Examples: And you might need some adjustmenst on:
Then it should be ok. Does it run well (silent) for higher speeds?
|
I changed the cf_speedCoef to match the control loop frequency and it worked a bit better. However, after some time of idling it starts to twitching again. Is there some I-loop running wild? |
No, it is all open loop and I do not have any Integral action. Is it possible to make a short movie with the behavior? |
I will make a video as soon as I am able to, unfortunately, this will probably be Tuesday. |
@cloidnerux This is how the motors work for me with the code from my main branch (for reference) And comparison with Commutation method (1st half = commutation; 2nd half = Sinusoidal 3rd harmonic) |
Here is a video of the old bldc controller: Here is a video of the new bldc controller: Here is a video of the wheels jittering while idle: I think I saw some jittering with the old controller too, however not that strong. I also think that the wheels spin faster with the new bldc controller. The new controller seems to be a bit less noisy, however, I not that much. It might be due to the gate drivers, that there is less switching noise. |
@cloidnerux First of all, very nice setup! I like it... It's very nice, especially with those offroad wheels ;)
Overall, I think it is a good behavior. For me looks improved compared to old method. It does not excite those vibrations (at medium speed) as the old controller does. Currently, I am working on improving even further the dynamic behavior, so stay tuned for an update. |
I added a dead band, but it does not help. I don't think it is really a dead band issue, as it only starts after some time stopping. However, it isn't that big of a problem, as it is hardly noticeable during normal operation. |
@cloidnerux I finally had some time to work on my own board. Thanks a lot for sharing the port and info on flashing the chip, that saved me a ton of time. Evenything seems to run (interrupt gets executed, buzzer works, I can step through the code), except for the PWM outputs. pwml/r are being set, and the BLCD step returns with values that seem to make sense, but nothing happens on the PWM outputs. I double checked this with a logic analyzer. Have you maybe run into the same problem? Otherwise I will just continue debugging :) |
Please see below the correct mapping of current phases thanks to STM Studio logging (amazing tool). (The mapping is from my STM32 board). Also the same comment can be found here #41. Data below is real measured data (not simulation). LEFT motor (long wired motor)Mapping: RIGHT motor (short wired motor)Mapping: Important Note: The sign of all phase current measurements is flipped:
|
@TomTinkering / @EmanuelFeru So my question: if you manage to implement FOC control, will it be portable to AT32F403RCT6 (i.e. no hw limitations)? I have ordered 2 YST boards with GD32F103 (according to product photo), but seller sent me AT32F403RCT6... |
Yes, it will be portable. From HW point of view I will use the measured Phase currents, which are available in YST board too. And there will be more calculations, but this was expected. This board that I ordered from Aliexpress was a GD board. Shipping was fast and quality was also good. I recommend. |
Hello, |
Hi, did you read my information in my fork? Lastly you have to hold the power button to not power cycle the system during a MCU reset. |
i have a brige in the power button that is correct? in your fork you write "Or use the Windows ST-Link utility" thats old from the stm32? i have try it with the st tool on windows. |
Just wondering. Is anybody replaced the AT32F403RCT6 |
hi |
I was not able to program the AT32. Like Izidor I am tempted to just replace this AT with an ST chip and be done with it. it's a lot easier for me to do some SMD rework than fight with a chip for which there is little documentation. checking if the pins match .. anyone do this yet ? |
the parts are physically interchangeable. |
Hello! |
Hello! |
Velix762, |
You have to compile your own version of OpenOCD with the path described here: It is not that complicated as there is a makefile for the OpenOCD code. With the patched OpenOCD you can just use |
Hi all, |
I am using this patch with https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC/: Only sinusoidal control is working. Current limiting is not working. |
Hello, still stuck on this! looking foward to solve it. Regards, |
Thanks, Juodumas, for your response. Maybe I'm doing something wrong around openocd. I use a raspberry pi with debian (raspbian) and an ST-link v2 usb stick. So, I downloaded the lastest version of openocd and modified the file stm32f1x.c as describe here. When I try to use openocd I get an error :
Maybe I forgot something ? Thanks for your help. Another point : interface/stlink.cfg : |
@leChrisLessieur what happens when you use
|
Hello Guys, What other programs I need to install and other steps? like gcc, stlink utility, etc... /
|
Guys, 1 - Created folder hoverboard/orig and downloaded the openocd in the link below: 2 - Create folder hoverboard/scr/openocd 3 - Change the file src/flash/nor/stm32f1x.c 4 - go to terminal in the hoverboard/scr/openocd/openocd/0.11.0/ after that execute again the command .configure –enable-stlink Final message will be presented: got the following error after execute the command: anyone knows what to do to move foward? Regards, Bruno Oliveira |
If you have "open failed" maybe that can be because of access rights to the usb device? Maybe there is a specific group you need to be in to access it or you may need to set up UDEV rules? |
yes, exactly I rerun the udev rules. After perform it I'll do a step-by-step to all users won't be stuck on this like I did. Regards, |
Hey Guys, collect2: error: ld returned 1 exit status any insight how to solve it? |
Wondering if this could be the cause ? [image: image.png]
Kind Regards,
Jeffrey Morrison
954.214.6322
…On Sat, Sep 11, 2021 at 4:39 AM Brnpimenta ***@***.***> wrote:
Hey Guys,
trying the next steps.
1 - installed gcc-arm-none-eabi and
2 - downloaded the firmware of
https://github.com/cloidnerux/hoverboard-firmware-hack.
3 - specified the location of gcc-arm-none in the file makefile of
https://github.com/cloidnerux/hoverboard-firmware-hack previoes downloaded
4 - executed the command make AT32, got the error:
collect2: error: ld returned 1 exit status
make: *** [Makefile:224 build/hover.elf] Erro 1
[image: image]
<https://user-images.githubusercontent.com/20492936/132941955-912cf343-1462-4e54-b1d0-9957fe134054.png>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#97 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIW77MCCEM3USACBFAI2KUTUBMIVDANCNFSM4HPUHNJA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
hey @123JRM / jeffrey, the image didn't show up. Regards, Bruno Oliveira |
Ah sorry that seems to happen
I saw the line
" -specs=nano.specs -tat32f403rct
The " t " in front of the processor definition did not look right.
…On Sat, Sep 11, 2021, 8:07 AM Brnpimenta ***@***.***> wrote:
hey jeffrey,
the image didin't show.
Regards,
Bruno Oliveira
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#97 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIW77MD3TMCC3INM3GGC6DTUBNA7XANCNFSM4HPUHNJA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Hello,
I bought a hoverboard mainboard off ebay in order to use this firmware, hover on arrival I realized that this mainboard seems to be newer and different to the ones currently used.

It features a "AT32F403RCT6" which seems to be a Chinese STM32F103RCT6 clone with faster clock speed, a M4F core, more peripherals, and more RAM. As far as I could see it, it should be possible to compile the current firmware for the new controller.
Also, it seems to have dedicated gate driver ICs instead of the discrete ones, some of the connectors are different and the layout changed. They also changed the pinout of the SWD connection. I try to reverse engineer the layout as I could not find anything on the internet at the moment.
Does anybody already have any experience with these boards?
The text was updated successfully, but these errors were encountered: