Page 1 of 3

VESC, and B-G431B-ESC1 and stm32g4xx development progress...

Posted: Sun Nov 24, 2019 9:48 pm
by jscott
I just got a couple of the ST B-G431B-ESC1 eval boards and I am getting ready to start playing with them using the ST Motor Lib, and notices that there seems to be some work going on here for the st32g4xx chip.

How is the progress going on the hal?

JMifune, any progress on porting VESC? It would be great to run Chibios-VESC on the B-G431B-ESC1!

I can help do some testing through ChibiStudio if needed...

-John Scott

Re: VESC, and B-G431B-ESC1 and stm32g4xx development progress...

Posted: Mon Nov 25, 2019 11:02 am
by Giovanni
Hi,

STM32G4 support is in progress, in trunk there are already demos and many drivers are functional.

Giovanni

Re: VESC, and B-G431B-ESC1 and stm32g4xx development progress...

Posted: Mon Nov 25, 2019 2:02 pm
by rreignier
jscott wrote:JMifune, any progress on porting VESC? It would be great to run Chibios-VESC on the B-G431B-ESC1!


I was not aware of this WIP port.

The first time I have seen B-G431B-ESC1, my first though was that it would be nice to port VESC on it.

If the porting effort is made publicly available, I might help working on it.

Re: VESC, and B-G431B-ESC1 and stm32g4xx development progress...

Posted: Mon Nov 25, 2019 3:26 pm
by Giovanni
Hi,

The effort is public, you need to checkout the trunk code. It is basically done except ADC and CANFD which require new drivers.

Giovanni

Re: VESC, and B-G431B-ESC1 and stm32g4xx development progress...

Posted: Mon Nov 25, 2019 4:17 pm
by rreignier
Giovanni wrote:The effort is public, you need to checkout the trunk code. It is basically done except ADC and CANFD which require new drivers.


Sorry, I was talking about the VESC port.

Thank you

Re: VESC, and B-G431B-ESC1 and stm32g4xx development progress...

Posted: Mon Nov 25, 2019 5:09 pm
by jscott
The stm32g431 port is really the key item to porting VESC to the B-G431B-ESC1.

Of course it uses both the ADC and the CAN interface. Although it can work without the CAN for starters, It needs the ADC.

I will start looking at the ADC drivers, but I haven't done any driver work on Chibios...

-John Scott

Re: VESC, and B-G431B-ESC1 and stm32g4xx development progress...

Posted: Mon Nov 25, 2019 6:41 pm
by Giovanni
Hi,

The ADC driver is quite complex, the G4 ADC should be a modification of the F3/L4 driver so it should happen soon enough.

Giovanni

Re: VESC, and B-G431B-ESC1 and stm32g4xx development progress...

Posted: Thu Mar 05, 2020 2:27 pm
by rreignier
Hi jscott,

For your information, I have been working on porting the VESC firmware on the B-G431B-ESC1.

I had planned to do it on several steps:

  1. Update ChibiOS to get G4 support
  2. Switch to ST LL Driver instead of stdperiph F4 to get G4 support
  3. Make the VESC hardware work with it
  4. Shrink the FLASH and ROM footprint to fit in the G431
  5. Create a G431 hardware configuration
  6. Create a driver for the MOSFET drivers, different from the ones used in the VESC project

For now, I am still in steps 3 and 4 and will not have much time to continue soon.

Currently I have some timing issues and watchdog reset after updating to new ST libs, I need to investigate further the ADC part.

About the RAM and FLASH usage, the major consumers are the threads stacks and buffers for communication. I did not tried yet to reduced them but for now, the firmware does not fit in the B-G431B-ESC1, even by removing most features like IMU, NRF and even CAN and USB. And if the threads stacks are this big, maybe it was needed.

My work-in-progress is on my Github account here: https://github.com/romainreignier/bldc

  • branch update_libs: I used a script provided by ST to switch to LL driver
  • branch stm32g4_port: I did the port to ST LL Drivers manually
  • branch reduce_size: Some attempts to reduce the size of the firmware
  • branch minimal: I have deleted all unneeded features in order to reduce the firmware size

But I am not sure I will be able to update them soon, because I need a working BLDC controller for a project so I will either use original VESC or use ST Motor Workbench on the B-G431B-ESC1.

Re: VESC, and B-G431B-ESC1 and stm32g4xx development progress...

Posted: Thu Mar 05, 2020 2:47 pm
by Giovanni
Hi,

Have you considered NIL? it could help with memory usage.

Giovanni

Re: VESC, and B-G431B-ESC1 and stm32g4xx development progress...

Posted: Thu Mar 05, 2020 3:12 pm
by rreignier
Hi,

No, I did not consider NIL because I though that the OS was not the culprit for the memory usage.
If I find the time to investigate further, I might try it.
I think that the first step would be to try to reduce the stack size of the several threads, maybe they are big just to be comfortable and and the current target (F405TG) has plenty of memory.

Does the stack size should be a power of 2, like 2048 or 4096 or there is no problem to set a value between the two?

Thank you.