RolluS Posted July 26, 2016 Share Posted July 26, 2016 I'm following you, but I think you should add the firmware project 1 Quote Link to comment Share on other sites More sharing options...
lizardmech Posted July 28, 2016 Share Posted July 28, 2016 @electric_vehicle_lover How much of the VESC firmware code is actually dedicated to the FOC and motor detection? Is it mainly the pwm_foc files? I found an interesting controller option that can run a full linux install but retains the ADC and realtime functions of a MCU by offloading real time processes to a real time unit. Would it be an advantage if all the parts that aren't real time specific could just be written in high level code in a standard linux environment? There would be no need to constantly flash firmware either, just SSH in and replace the program that configures the realtime units. It would give you a full ARM a9 cpu for running bluetooth, music and anything else anyone can ever think of in the future. 2 Quote Link to comment Share on other sites More sharing options...
electric_vehicle_lover Posted July 28, 2016 Share Posted July 28, 2016 @Lizardmech, Yes, I think is pwm_foc files. I just want to focus on this firmware for motor control and nothing more. Although I use every day and I prefer Linux, I also think is much more complex than I can handle -- I will keep my focus on trying porting VESC/FOC for 30B4 board. Quote Link to comment Share on other sites More sharing options...
lizardmech Posted July 28, 2016 Share Posted July 28, 2016 I don't think you can use stm32f1xxx because they lack the FPU that VESC firmware uses. 1 Quote Link to comment Share on other sites More sharing options...
electric_vehicle_lover Posted July 28, 2016 Share Posted July 28, 2016 4 hours ago, lizardmech said: I don't think you can use stm32f1xxx because they lack the FPU that VESC firmware uses. Seems we are reading the same messages on VESC forum ;-) Quote Link to comment Share on other sites More sharing options...
lizardmech Posted July 29, 2016 Share Posted July 29, 2016 19 hours ago, electric_vehicle_lover said: Seems we are reading the same messages on VESC forum ;-) Someone tried to use it on stm32f1 for quadcopters a while ago. Even on the ST motor control solution the F1 is very limited you have to calculate all the motors electric and magnetic specifications using something else and then code them directly into the firmware. I don't think anyone would use this MCU for new projects, only when you have existing firmware to reuse. 1 Quote Link to comment Share on other sites More sharing options...
esaj Posted July 29, 2016 Share Posted July 29, 2016 On 28.7.2016 at 1:08 PM, lizardmech said: I don't think you can use stm32f1xxx because they lack the FPU that VESC firmware uses. Does that mean that floating point calculations are completely impossible with it, or does it just do it "in software"? Is it too slow without a real FPU? Old 286's and 386's (except the "DX" / so-called "387") didn't have FPUs either (if memory serves), but you could still do floating point calculation with them? Maybe it was something like fixed-point integer maths behind the scenes to "emulate" floating point calculations? If I have the time and interest, I might take a look how Arduino handles this, you can use floats in code (and doubles, but they're just the same as float, ie. no more precision) but the ATMega328's don't have separate FPUs as far as I know. Quote Link to comment Share on other sites More sharing options...
lizardmech Posted July 29, 2016 Share Posted July 29, 2016 You can always perform these sort of things via software, dedicated silicon will often be 1000x faster. If it were cheap to make low volume chips you would see all kinds of application specific hardware. FPGA are the closest you can get but they're still slower than dedicated silicon. FPGA are actually very good for motor control, you can run multiple different motors off one FPGA and they have lower latency, higher reliability and can manage 100khz+ switching speeds. Some MCUs can run multiple motors but they usually have to share the same specifications and all the MCU does is change the timing. 2 Quote Link to comment Share on other sites More sharing options...
electric_vehicle_lover Posted July 29, 2016 Share Posted July 29, 2016 I think @lizardmech is correct, also because the VESC developers told that on their forum. Also, please see here the guy that optimized the STM32F103 code for FOC (but doesn't share it): http://scolton.blogspot.pt/2011/11/ah-software-optimization-my-old-friend.html Open BLDC uses also STM32F103 (I think) but I guess doesn't FOC, nayway, I want to read the code to learn more: https://github.com/open-bldc/open-bldc/blob/master/source/firmware/src/ 1 Quote Link to comment Share on other sites More sharing options...
esaj Posted July 29, 2016 Share Posted July 29, 2016 (edited) Of course I had to look it up (in ATMega-cases), the AVR libc ( http://download.savannah.gnu.org/releases/avr-libc/ ) contains the floating point library code ( avr-libc-2.0.0\libm\fplib ), although I didn't delve much deeper as it's pure assembler... I'd expect that a floating point library (or several) exists also for STM32F1xx's, but it might be too slow for timing sensitive real-time stuff... EDIT: Here's a thought: do external FPU-chips still exist? Maybe you could add a separate FPU and offload the calculations to that? Don't know if moving data back and forth between the *PU's then becomes the next bottleneck... Edited July 29, 2016 by esaj 1 Quote Link to comment Share on other sites More sharing options...
electric_vehicle_lover Posted July 29, 2016 Share Posted July 29, 2016 Yes gcc arm compiler implement float operations, I did that on the GEN1 boards firmware with the same STM32F103. This STM do integer hardware multiplications and people suggest to use that but VESC firmware heavily use float operations. 1 Quote Link to comment Share on other sites More sharing options...
lizardmech Posted July 29, 2016 Share Posted July 29, 2016 I have seen people make FOC controllers with 8-bit MCUs, but there is a big difference between getting FOC running on one motor you know the exact specifications for and run at constant speed. Compared to running it with unknown motors, getting decent low speed rotor estimations, violently changing speed and braking is going to be very different to a basic FOC setup. 2 Quote Link to comment Share on other sites More sharing options...
Sindijs Posted July 30, 2016 Share Posted July 30, 2016 Hi all. Very interesting project. You guys are amazing to write this from scratch. As im not strong skills I tried to use instrcuctions to compile and flash the code. But didnt find makefile. Could you please share it as i coudnt write it by myself. It could be very belpfull! Thanks! 1 Quote Link to comment Share on other sites More sharing options...
electric_vehicle_lover Posted July 31, 2016 Share Posted July 31, 2016 @Sindijs The makefile I use and the OpenOCD scripts are here: https://github.com/casainho/casainho-generic_electric_unicycle Just checkout that repo and put inside the firmware folder. You can inspect the Makefile and see the firmware sources are expected to be here: generic-electric-unicycle/firmware/src/ 1 Quote Link to comment Share on other sites More sharing options...
Sindijs Posted July 31, 2016 Share Posted July 31, 2016 Thank you ! Quote Link to comment Share on other sites More sharing options...
Sindijs Posted July 31, 2016 Share Posted July 31, 2016 1 hour ago, Sindijs said: Thank you ! Got error: GNU ld (2.26-4ubuntu1+8) 2.26 generic-electric-unicycle/firmware/src/IMU/imu.o: In function `IMU_read': /home/user/generic-electric-unicycle/firmware/src/IMU/imu.c:113: undefined reference to `atan2' Makefile:53: recipe for target 'main.elf' failed make: *** [main.elf] Error 1 Any suggestions ? Quote Link to comment Share on other sites More sharing options...
lizardmech Posted July 31, 2016 Share Posted July 31, 2016 Do you have the ARM compiler installed? Quote Link to comment Share on other sites More sharing options...
Sindijs Posted July 31, 2016 Share Posted July 31, 2016 (edited) 2 minutes ago, lizardmech said: Do you have the ARM compiler installed? Mean this one? : gcc-arm-embedded Have this: gcc-arm-none-eabi is already the newest version (15:4.9.3+svn231177-1) Edited July 31, 2016 by Sindijs Quote Link to comment Share on other sites More sharing options...
electric_vehicle_lover Posted July 31, 2016 Share Posted July 31, 2016 (edited) I already saw that error of atan2. Maybe I didn't comkit my chabges to make filé. It is something with libmat that you need to include in the makefile Edited August 1, 2016 by electric_vehicle_lover Quote Link to comment Share on other sites More sharing options...
Sindijs Posted July 31, 2016 Share Posted July 31, 2016 41 minutes ago, electric_vehicle_lover said: I already saw that error of atan2. Maybe I didn't comkit my chabges to make filé. It is something with libmat that you need to include in the makefile Could you please just copy content of your makefile here to see difference? Quote Link to comment Share on other sites More sharing options...
electric_vehicle_lover Posted July 31, 2016 Share Posted July 31, 2016 I deleted by accident. I will try later to and update, I will post here. Quote Link to comment Share on other sites More sharing options...
electric_vehicle_lover Posted July 31, 2016 Share Posted July 31, 2016 @Sindijs Done. Please checkout. Also please see the last code is on the branch "balance_control-1". Quote Link to comment Share on other sites More sharing options...
RolluS Posted July 31, 2016 Share Posted July 31, 2016 On 26/07/2016 at 7:44 PM, RolluS said: I'm following you, but I think you should add the firmware project @electric_vehicle_lover you need to add/link your projects so I can pay you some beer Quote Link to comment Share on other sites More sharing options...
electric_vehicle_lover Posted July 31, 2016 Share Posted July 31, 2016 (edited) The app now shows the speed and current :-) @Rollus, see now here: https://beerpay.io/casainho?page=1 Edited July 31, 2016 by electric_vehicle_lover 1 Quote Link to comment Share on other sites More sharing options...
Sindijs Posted August 1, 2016 Share Posted August 1, 2016 13 hours ago, electric_vehicle_lover said: @Sindijs Done. Please checkout. Also please see the last code is on the branch "balance_control-1". Thanks! Will try! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.