AlkaMotors / f051bldc

brushless motor control stm32f051
67 stars 24 forks source link

fw testing #1

Closed adrianmiriuta closed 5 years ago

adrianmiriuta commented 5 years ago

@conuthead I tested the new fw ( I gave it the name wraith32_v1)

  1. it is better than last one
  2. motor starts reliable at 1027 signal (should be at 1001 like the KISS ESC's)
  3. motor start speed is fairly high , too high for my taste ... (higher than last fw)
  4. when raising signal motor speed does not change until 1057 (it should be linear)
  5. it looses sync above 1700 ( at the moment i test without prop , I need a test bench !!!)
  6. I changed the motor with a ZMX FinX23 it sounds better (the other one may have had bad bearings ...)
  7. can you please push your last changes to the repo (I can help with PR's)
  8. the actual repo version does not work (no PROSOT no DSHOT) then i tried PWM and the motor spins full thrust at 0 PWM signal !!!!
AlkaMotors commented 5 years ago

Ok, this is great feedback , thanks, its a step in the right direction. I will make sure the code is up to date tomorrow morming on github when i get the eeprom stuff cleaned up. The old one should still work fine though, have been using dshot and proshot with it, but there is no 3d or eeprom. I might have messed something up in that version though.. Some of the issues are simple adjustments. The motor start speed and power are adjustable but I had no other esc's around to see what they did so my threshold numbers were mostly just picked out of the air for now, so I can make sure that it is the same as the was a KISS esc behaves . I had originally just set it so that the default idle throttle would get it going at a normal speed. I had not fully considered nor understood what kind of threshold's are needed for 3d flight. The bigger issue is a desync over 1700. That is concerning. I have only tested to 4s with a 2300kv and not had issues but i am going to order some higher kv to start working with. I have tested the firmware with about 15 motors so far but have all been lower kv and in-runners. Once again thanks for your help!

AlkaMotors commented 5 years ago

@adrianmiriuta ok, had some time this morning to work on the issues ( i like the way you list things so i will addresss it the the same way). 1): I hope this one is better still! 2): Lowered motor start threshold to start at dshot/proshot signal of 48 ( 1 on the betaflight tab). 3): Lowered motor power on start (I had messed this up when I played with ranges yesterday). 4): Motor power is linear from start. 5): I can confirm there was issues above certain rpm ,Reduced filter level at high rpm, tested at 4s 2300kv. Will have to wait for some higher kv motors to go further for now ( go carefully !) 6): Pushed changes to the repo, I am using some of st micros cubemx generated code on that page so I included their copyright info in main.c

adrianmiriuta commented 5 years ago

@conuthead

First some things to Architecture and structure

  1. object binary and other compiled files do not belong into the repository.
  2. you need to install Attolic to work on the project.
  3. the main program needs some serious restructuring.

If you agree I would like to start including your work into a clean framework. self contained with tools, target definitions, git friendly ... (like Betaflight, Butterflight ...)

Do you have a good name for the Project ? Do you have a pinout or schematic for the WRAITH ?

To the new fw.

  1. the motor now starts to shake at 1001
  2. it starts to spin reliable above 1060
  3. it desyncs above 1880 (later than wraith32_v1 )
AlkaMotors commented 5 years ago

I think you want me to change something that is done intentionally. Are you saying that when the esc is given a minimum power level that it should be enough to start the motor turning? To me that's what idle throttle is for in betaflight. If I were to take any motor and give it 1 percent power I would not expect it to start spinning. If I make the motor spin at 1 signal then the default idle throttle value of 3.5 would be very fast. Do you have to turn yours way down for KISS? Setting a fixed minimum throttle power at 1 percent signal has its dangers. If someone tries a higher voltage there is now no way to lower this number or if someone tries a lower voltage the motor still wont be getting enough power to spin. Do you see the problem? I could set a power level that's high enough to start all motors for sure but then some motors will be starting way to fast. The flight controller should be the one to impose a minimum throttle (which it does) to reliably start the motor / prop combination that you have, not the esc. The esc should just regulate power to the motor. We could just set a minimum throttle variable on the ESC that is user settable but I did not want to do that. Any arbitrary power can be decided on as the minimum throttle easily if we have to so I can't really consider this an issue.

What motor and voltage are you using?
The desync issue is a major problem! but I cant re-create it.. I still have to wait for some higher kv motors. This project started just over a year ago from a blinking light tutorial! To work on this all you need to do is install Attolic and open the directory as a project.. This seems very simple to do. Is there a more accessible way? I want this to be as simple as possible for others to get started with. There is also a betaflight-esc project . have you looked at that? Its structure is more like what you are expecting.. That code does not spin a motor yet though and I don't know how to start working on it. I got the pinout from the wraith off of other projects (the betaflight-esc code has it). https://github.com/betaflight/betaflight-esc/blob/master/src/main/target/WRAITH32/target.h

adrianmiriuta commented 5 years ago

@conuthead

  1. I didn't know that is intentionally I only compared it with other ESC's I use

    • blheli_s starts spinning reliable about 27
    • blheli32 starts spinning reliable about 13
    • kiss 32A starts spinning reliable at 1 From the point where the motors start spinning, you can hear the increments for each step up. I assume the RPM increase is linear. Kiss spins very smooth even at lowest RPM.
  2. I use 3s 1550mAh Tatu Lipo, ZMX FinX23 2700KV motor

  3. I looked at the betaflight-ESC project , I like its structure ! but they are very far away from the goal. I noticed that their RED led is wrong in the WRAITH32 target, and I didn't know if there are other errors too.

  4. Yes there are always many other ways I thought at structuring the project like betaflight-ESC.

  5. I have a major crush on linux, and really hate eclipse ... I think that is why I like projects with a Makefile where the coders can use the editors they are used with. Do you use Windows or Linux ?

  6. Do you have a god name for it ?

AlkaMotors commented 5 years ago

1) They should all start spinning at all different values depending on the motor, prop and voltage. If its spins at 27 on 4s then it might not spin to 40 on 2s or it might start spinning at 10 on 5s. The Esc does (should) not do any sort of speed control loop it just blindly sends the power to the motor. I like to have mine start at pretty much the lowest power possible instead at zero signal and go up from there. Anyway changing that is just a matter of defining what power level you want to start at. We'll make it a use settable option so that if you want to have the motor start at a signal of 1 you can do that ( probably somewhere around 5-8 percent actual power to the motor). What do you set your idle throttle amount to on a KISS esc? 2) I will get a motor with similar specs so I can see what's happening here, right now I am blindly guessing at settings that will work. I suspect that a motor like this might need more aggressive timing advance.

3,4,5) I like linux too. The issue here is I am completely out of my element when it comes to programming anything! I don't have the knowledge to set up the environment and I am really going into this with zero experience. I have to look up how-to on everything ! I literally learned what an include was a couple weeks ago. I also use cubemx to set up peripherals and it can auto generate the atollic project file from there and I am worried about losing that option (for better or worse I am used to it) . I think I can get by without it though now. So really the big issue there is: it intimidates me and I am scared to learn new things LOL. I have some pc's here with linux here and I am willing to put some time into learning!

6) Not yet! you have any suggestions ? How about USCS, (universal speed control system)?

adrianmiriuta commented 5 years ago
  1. on blheli_s , blheli32 I noticed differences between 3s and 4s , with the Kiss ESC not. 1.1 I use butterflight and set the idle to 5.5 %
    I fly LOS and AIRMODE feels beter with a little higher default.

  2. I will do the project integration.

  3. I thought at a more catchy name , google alphabet acronyms are ... well ... do you know USCSS Nostromo (from the Alien movie ?) what do you think of Nostromo_USCS.

AlkaMotors commented 5 years ago

1) interesting ! That seems like a big flaw in the KISS esc you can not go any lower than the predefined power level? If you are running a 2000 kv motor and it starts at a good speed .. then with a 4000kv it would start twice as fast with no way to slow it down? They must have a min power setting on the kiss then? Or they are running a PID speed control loop at low rpm, (that can cause major problems!!) The blheli way seems the better way to go as there is a a little headroom around the start value. With a 2300kv motor and 4s my firmware starts at about 1010 right now for me. We can make "KISS mode" a setting for people who are used to them heh which lowers the start value but then the esc would either need to be calibrated or settings changed when a new motor is used ( instead of just setting the idle value to the appropriate number in betaflight. 2) Sounds good, my concern is solely to keep the ease of development, I can change a settings and load it to the esc and test within a few seconds while using ststudio to view variable information real time, Its a very easy environment to work on function with. The entire programming and testing environment I can include with the ESC hardware by just bundling attolic and cubemx ( which are both free) and don't need to worry about pc setup. This has major advantages, that's why I use diptrace too, I can put a freeware binary of diptrace in the folder where my files are and know that I can always get developing within a few mins anywhere, with the same version of the software that made it originally. I would love to see the linux light though! if there was a way to keep things fast and easy!

The desync is bugging me , i have run the 2300kv up to 35000 rpm so the 2600 on 3s should be under that (34k rpm at full charge) . I don't want you to damage your stuff, a desync at 90 percent throttle can smoke a motor pretty fast! I have ordered some 2600, and 2800 kv motors but they are on the slow boat from china so it could take a while to get here.

adrianmiriuta commented 5 years ago

@conuthead

  1. I do not think so, the starting RPM on KISS is much lower than blheli and your implementation I think they use a different approach.

  2. I am not familiar with cubemx , and ststudio. I just installed Atollic for about 3 days. I use Eagle for PCB design.

  3. Yea I got some magic smoke , but the motor survived ... If it gets worse I will rewind it (no problem there).

  4. I ordered a "RC Benchmark Thrust Stand" to do some performance testing.

AlkaMotors commented 5 years ago

1) I agree, I use a input proportional to output power (not rpm) , all the esc changes is power and the motor spins as fast as it does. Blheli does it this way too except for maybe a very small startup boost. In order to maintain a constant speed under varying voltages and kv motors KISS esc's must have an ESC side speed control loop at low input levels. Otherwise at the same voltage different KV motors would start at different speeds. So maybe we will implement it for KISS mode lol (it does look cool starting with a low prop speed ). It can cause its own set of problems but we can just use speed control, instead of power control, for very low power levels ( below idle throttle). For now, I will settle with a use defined min throttle value on the ESC so people can set it if they want. otherwise the power starts at basically zero power and goes up from there.

4), Awesome! no performance testing has been done yet! Just real world testing in vehicles. I really think the timing needs adjusting for that motor but it might be better with prop on.

adrianmiriuta commented 5 years ago

@conuthead

  1. I started Integration , I think it will take a wile.
  2. What do you think about the name nostromo_USCS?
adrianmiriuta commented 5 years ago

@conuthead running at 1104 input , has breaks from time to time (motor stops spinning for ca 120ms) if you spin slightly higher or lower it does not happen !

DS6_QuickPrint9

DS6_QuickPrint8

yellow is proshot imput light blue is computeProshotDMA (at function begin) magenta is calcCRC == checkCRC dark blue is motor output

Linjieqiang commented 5 years ago

@adrianmiriuta I want to join with you to develop this esc firmware.

adrianmiriuta commented 5 years ago

@Linjieqiang it is @conuthead 's project , please ask him.

brucesdad13 commented 5 years ago

Following! 👍

AlkaMotors commented 5 years ago

Ok, I have been chasing some issues down, I have had issue with mine as the motor commutation frequency is approaching the pwm frequency. As it gets close a harmonic starts and the motor want to lock phases with pwm. This harmonic seems to start about 220k - 240k erpm. There is other sub harmonics of the pwm frequency that can also cause issue. So maybe the option is a pwm shift to a higher frequency in general ( 36khz) , or a pwm shift around these harmonics. Anyone who wants to help is welcome to! I tested at 4s with a 5 inch prop on and it seems better, The motor seemed less likely to suffer harmonic effects.

AlkaMotors commented 5 years ago

@adrianmiriuta , thanks for the scope traces. I will look into that , I don't know why it is stopping at that input level. that is weird! Anyway I was hoping that some skilled people can use this as a prototype/ framework for writing something better , maybe fork a clean-code version of this.

adrianmiriuta commented 5 years ago

@conuthead First draft of a structured cleaned up project based on your code and betaflight ESC is ready. 2 targets available WRAITH32, WRAITH32MINI (both working with base features 4K PROSHOT, SERVOPWM only for Thrust testing) here: https://github.com/3x8/nostromo

AlkaMotors commented 5 years ago

@adrianmiriuta

Fanatastic, that looks great!. There have been some changes to the timers and input capture but nothing major. I have finally got to test the 2800kv motors and have got them spinning fine up to max rpm on 4s without prop so that's about 260k erpm. I will push those changes when I do some more flight testing.

The input capture uses a reset mode so it only captures half the buffer for proshot and dshot. The pwm is now edge aligned to give twice the throttle resolution. The adc is read each pwm period and there is a raw reading of current, voltage and temperature ( just the raw output) Also new firmware for the F031 has been done, one that uses the ADC so it can work on even bluepill stm32 without comparators. The other uses the op-amps of the stspin32f0a. Also a F3 version is done too. Also a test quad was put together with 4 esc's on it for flight testing. Works great so far! I will start using learning your code structure today .. this is really great! I was hoping that once I got the base function going someone with more coding skill can take it to the next level. I want to get some testing done then I can close some of these issues.

AlkaMotors commented 5 years ago

Fixed in version 2