Alternative ESC firmware (reflashing)

sim
Posts: 18
Joined: Tue Oct 18, 2011 11:40 pm

Re: Alternative ESC firmware (reflashing)

Post by sim »

Hi, Heiko!

I didn't realize you saw problems even with slow throttle increases. Does this also happen with my tree? I thought it was only a fast response change problem. This is with a 14" APC prop?

It's possible that the motor is just saturating due to too much current. It's rated for 14.5A and 200W according to http://www.rctigermotor.com/show.php?contentid=142 , and you are seeing the problem start at around 16A @ 16V (256W). I wish there was some simple way to collect a full high speed log of the whole drive and zero-crossing detection, like a 4-channel oscilloscope with long buffer. Hmm, perhaps it would work to trigger the scope from one of the unused pins when commutation loss is detected? At least then we could look at what is happening right around when it failed, on a digital scope.

Those scope pictures I posted were not from full load, but if you look at a shorter timescale, the noise patterns change as the motor current increases. The kick-back takes longer to demagnetize and so this affects the noise at the comparator -- the swing back to high stays high longer until the current stops and the undriven phase sees just backEMF. It's almost like a current sense by pulse length. The high part stays high longer based on current, while the lower part is just the length of the PWM ON cycle (and this is proportional to drive voltage). This scope screenshot is just one phase, not at the comparator which has the neutral subtracted, but if you imagine noise each time the signal changes, you can see how picking up a valid zero-crossing can be difficult: http://0x.ca/sim/tmp/motor_phase_zoom.png

If the motor saturates, I would expect the current to start spiking excessively at the end of the PWM ON cycle. I'm not quite sure what would happen next, however. :)

Cheers,
Simon-

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi Simon,

I was just thinking: Maybe we are looking in wrong direction? Maybe something wrong with this "virtual" charge pump on this boards? As I remember you mentined that Plush is working just fine for you?
Can I also ask you to check voltage on charge pump capacitor with your scope? ;)
regards,
ziss_dm

funth1ngs
Posts: 68
Joined: Tue Aug 09, 2011 8:37 pm

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi simon and ziss_dm,

sim wrote:I didn't realize you saw problems even with slow throttle increases. Does this also happen with my tree? I thought it was only a fast response change problem. This is with a 14" APC prop?

Yes, I didn't notice that before, it only occurs on a fully charged 4S. With your current tree, I can't reach full throttle at all. The prop was a EPP 13x4.5".

sim wrote:It's possible that the motor is just saturating due to too much current.

I switched to a Graupner 11x5" E-Prop today, and it's way better. I still can't reach full throttle with your tree, but with ziss_dm's version it works quite well. There is still some noise, but it's only a very short click. So you are right, the 13" prop is causing too much load on a 4S.

ziss_dm wrote:I was just thinking: Maybe we are looking in wrong direction? Maybe something wrong with this "virtual" charge pump on this boards?

This made me to open another ESC ;). Unfortunately it looks like that is's also using a charge pump. I tried it anyway and figured out that it has the same pin assignment than the BlueSeries ESCs. To my surprise it works with the Mystery20A.inc without any changes :). Compared to the HK BlueSeries all nFet ESC it's even a little bit better (the clicks are quieter and nearly gone) (11x5" E-Prop and 4S)). The 2 capacitors are 330uF/25V, on the my BlueSeries board are currently 2x220uF/35V. Do you think if I increase them to maybe 2x470uF/25V can help?

Cheers,
Heiko.
Attachments
Turnigy TY-P1 25A
Turnigy TY-P1 25A
Last edited by funth1ngs on Sat Oct 29, 2011 9:28 am, edited 1 time in total.

sim
Posts: 18
Joined: Tue Oct 18, 2011 11:40 pm

Re: Alternative ESC firmware (reflashing)

Post by sim »

Well, there are a couple of problems here. I saw your problem originally on Plush at 15.8V, with a 10x4.7 prop on the MT3506. I made some changes, and it was totally fixed for me, so I was happy, and posted, and you said it didn't fix it. So, I ordered a BlueSeries 20A and 30A. The stock firmware seemed to work with them and the MT3506 at 15.8V, but with slow throttle response, as expected. I was surprised to see that they went with 16kHz PWM for startup but defaulted to 8kHz for run mode. Anyway, when I tried my tree, I noticed that the backEMF sense either has differently-timed noise or is for some reason more noisy/less sensitive, since driving any of my motors with my tree is much worse than the Plush at slow speeds. Also, it missed like the Plush did when accelerating quickly to full throttle, even though that was fixed for me on the Plush. D'oh! :) Finally, it suffers from resets at high current even though this never happens on the Plush.

I haven't tried >15.8V on the Plush since the capacitor that they shipped with it is only 16V, even though they rate it for 16.8V. I need to swap it for a 25V cap and compare. Also, I haven't tried removing the BlueSeries backemf sense capacitors yet, but I just got an smd rework station today, so I can try that, but I'm really not expecting it to make much difference. I also don't have a high-ampere 16.8V source to compare with, just an 18V supply at about 5A, so I probably need to order a 4S lipo to see exactly what you are seeing.

Newer ESCs, in particular the TowerPro "type 3" boards, are switching to gate drivers (finally), with a charge pump for the gate drive. The nFETs are inverted on those boards, but it seems that Turnigy TY-P1 25A HexFET ESC is yet another variant without inverted drive. It's weird that they went with the original Mystery pin configuration, hmm. :) Using both sides of the comparator allows the ACME to be turned off and the ADC during that cycle, so they can sample voltage/temperature without having to stop sensing timing, but the original and all-nfet Mystery pin configuration requires ACME and ADMUX to always be on. Also, you can't do any simplifications with a single out to turn off all NFETs regardless of commutation stage, etc.

Anwyay, there is no charge pump on my BlueSeries 30A, but there is a small 7805 type regulator just for VCC, separate from the BEC, and even though it has a regulation output capacitor, I see voltage across that comparator drop below 2.7V when the AVR resets. I'll take a scope screenshot so you can see what I mean. I'm thinking the sense noise might be a lot more difficult when combined with the fact that there is also this pulse noise on A(VCC) as well.

With gate drivers, I would really be inclined to PWM switch on the high side instead of the low side. I did this even on the Plush and it worked surprisingly well, especially considering that it only had transistors for gate drive and it was actually switching the pFETs. I even tried a variant which switched high and low at the same time. In theory, if the fets turn on and off at the same time, the motor voltage average always stays in the middle and the comparator does not even need a neutral reference, it can just use half of the input voltage. I figured backEMF sampling noise would thus be lower, but alas the fets of course turn on and off at different times, so I didn't notice any improvement at the time. Also, I didn't do any load tests and I figure that without gate drivers, it would probably behave badly at higher currents. But with all nFET boards, maybe..

Too many things to try at once as usual. ;)

marbalon
Posts: 107
Joined: Thu Aug 18, 2011 10:59 am

Re: Alternative ESC firmware (reflashing)

Post by marbalon »

Hi again,
So I tried this software with Mystery 20A (nFet + pFet) and KDA 20-22L but have some problems. I tested revision 44, 65, 79, 82, 106 and first version from this topic attached to this post:
http://www.multiwii.com/forum/viewtopic.php?f=13&t=516&start=20#p3044
All version was compiled with pwm_arduino_250.inc, and of course I've changed MWC code to use extend resolutions. All version have a huge problem with motor startup, motor shaking about 3-5s then start working normally - all version except this attached to post above. It works without any problems. So I think changes related with Mt motors is not good for other motors... But I can still use first version compiled int this topic ;).

I have some question for Mystery 20A users. I had some crashes when testing this software (because testing to high PID values, and landing in a grass, on the wall etc ;) but luckily didn't burn any mosfet, so did you guys burn anyone when you stop propellers ?

Cheers,
Marcin.

funth1ngs
Posts: 68
Joined: Tue Aug 09, 2011 8:37 pm

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi ziss_dm,

today I played again with my MT3506 ;). I limited MAX_THROTTLE to 185 steps, and with the BEMF feedback capacitors removed the "screams" are completely gone, even with a 13x4.5 prop and a fully charged 4S battery. So I must retreat my previous statement that the behavior is the same with or without capacitors, it's a little bit better without them.

Code: Select all

                ror     temp1
.endif
                cpi     temp1, POWER_RANGE - 1 - 15
                brcs    eval_rc_p10
                ldi     temp1, POWER_RANGE - 1 - 15
eval_rc_p10:   
                mov     ZH, temp1

The only remaining problem are the resets which happen sometimes when idle throttle is increased too fast. So i recorded this short video. In the first half of the video the software is untouched, in the second half I flashed a modified version with resets disabled.

Code: Select all

run_to_start:   sbr     flags2, (1<<STARTUP)
                cpi     ZH, PWR_PCT_TO_VAL(PCT_PWR_MAX_STARTUP)
                ; brcs    run_to_start_2
                ; rjmp    restart_control
run_to_start_2:               
                rjmp    wait_for_power_on

I noticed with resets disabled that the motor nearly stops for a very short time, then immediatly accelerates to full speed. Do you know how to get rid of these resets in a proper way :)?

Cheers,
Heiko
Attachments
UL_01.jpg
UL_02.jpg
UL_03.jpg

funth1ngs
Posts: 68
Joined: Tue Aug 09, 2011 8:37 pm

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi Marcin,

All version have a huge problem with motor startup, motor shaking about 3-5s then start working normally - all version except this attached to post above. It works without any problems. So I think changes related with Mt motors is not good for other motors...


just checked that with 4 different motors (without propeller):

RCTimer A2830/14
RCTimer BC2836/11
RCTimer BC3536/11
HK NTM 28-30

Startup worked very well with every motor.

You can try to increase PCT_PWR_STARTUP and PCT_PWR_MAX_STARTUP to:

Code: Select all

#define    PCT_PWR_STARTUP     20
#define    PCT_PWR_MAX_STARTUP 25

and/or RPM_STEP_INITIAL and RPM_STEP_MAX to:

Code: Select all

#define    RPM_STEP_INITIAL    70
#define    RPM_STEP_MAX        250

Cheers,
Heiko.

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi,

@marbalon: Can you try the latest 0.11 tag? For my setups it is finally better or equal to the original one. ;)

I have some question for Mystery 20A users. I had some crashes when testing this software (because testing to high PID values, and landing in a grass, on the wall etc but luckily didn't burn any mosfet, so did you guys burn anyone when you stop propellers ?

The latest versions should be quite safe. I'm doing stop tests from half throttle. The erly ones may or may not burn FET's, depends on luck.

@Heiko:
I limited MAX_THROTTLE to 185 steps

But you are "loosing" 45W of power (according to the graphs), so maybe smaller prop is better? ;)
I also noticed that you always start ramping from different RPM. Can you try to fix initial RPM to fixed value? Maybe we have some treshhold, after which it start resetting? Would be fun if it is 1200 RPM ;)
BTW: How you generating input? Manually?

I noticed with resets disabled that the motor nearly stops for a very short time, then immediatly accelerates to full speed.

This is quite explainable: it goes to startup, performs pre-align (motor stops), starts and than slowly ramping to full power.

Code: Select all

#define    RPM_STEP_INITIAL    70
#define    RPM_STEP_MAX        250

Sadly enough, I've made same mistake. There are limits for lower RPM value, due the 17bit timer we using. ;(
The limits are:
~75 rpm for 8mhz boards and ~150 rpm for 16mhz boards. In case you setting lower than that, it is overflowing and rpm would be actually higher than intended.

regards,
ziss_dm
Attachments
bldc.0.11.zip
(64.68 KiB) Downloaded 270 times

marbalon
Posts: 107
Joined: Thu Aug 18, 2011 10:59 am

Re: Alternative ESC firmware (reflashing)

Post by marbalon »

ziss_dm wrote:@marbalon: Can you try the latest 0.11 tag? For my setups it is finally better or equal to the original one. ;)
The latest versions should be quite safe. I'm doing stop tests from half throttle. The erly ones may or may not burn FET's, depends on luck.


Will try on my backup motor and ESC. This will be a little hard in my quad because I need to disassemble it to get an access to ESC (I have ESC between centerplates - foto here). But I found that sometimes motor don't have a problem with startup without propeller but with propeller situations maybe be different. Will try to give you feedback soon.

Cheers,
Marcin.

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: Alternative ESC firmware (reflashing)

Post by crashlander »

funth1ngs wrote:Hi simon and ziss_dm,
...
This made me to open another ESC ;). Unfortunately it looks like that is's also using a charge pump. I tried it anyway and figured out that it has the same pin assignment than the BlueSeries ESCs. To my surprise it works with the Mystery20A.inc
...
Heiko.

Hello,
can you please post a picture of how-to connect Tgy TY-P1 for flashing.
Subquestion ;) does this ESC originally works with MultiWii (with original firmware)?

Regards
Andrej

funth1ngs
Posts: 68
Joined: Tue Aug 09, 2011 8:37 pm

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi Andrej,

here is the picture with the ISP pins. I have only one TY-P1, so I never used it in a copter.

Cheers,
Heiko
Attachments
Turnigy_TY-P1_ 25A.jpg

funth1ngs
Posts: 68
Joined: Tue Aug 09, 2011 8:37 pm

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi ziss_dm,

But you are "loosing" 45W of power (according to the graphs), so maybe smaller prop is better? ;)

Yes and no, it's all about efficiency at hover throttle ;). For example, with a 11x5" the max thrust is 800g and with a 13x4.5" it's 1100g. If the max thrust of the 13x4.5" needs to be limited to 800g, but the efficiency at hover throttle is better, I prefer to use the bigger prop.

I also noticed that you always start ramping from different RPM. Can you try to fix initial RPM to fixed value? Maybe we have some treshhold, after which it start resetting? Would be fun if it is 1200 RPM ;)
BTW: How you generating input? Manually?

I use an AVR development board with a poti and a self written software to generate a 400Hz PWM signal. Unfortunately, there is no constant treshold. The higher the voltage, the higher must be the RPM. And even at a fixed voltage the treshold fluctuates around 100-200 RPM:

3S 10,6V -> almost no problem
3S 12,4V -> ~850 RPM
4S 15,4V -> ~1050 RPM

But thats no problem, because I always use some idle throttle. It just needs to be high enough to prevent resets. As long it's below hover throttle, everything is fine ;). For the MT3508 the min idle throttle generates a thrust of 40g, what makes 240g on a hexa. Compared to the hexa weight of 1500g it's OK. I only thought it would be more fool proof if the resets could be prevented at all.

Another question: Is it possible to have the full POWER_RANGE between PCT_PWR_MIN and 100% (or even better PCT_PWR_MAX ;)) and start the motor always at MIN_RC_PULS?

Example (POWER_RANGE=200): At the moment with PCT_PWR_MIN=15 the "real" resolution would be 200-0,15*200 = 170 steps. The required pulse length to start the motor is 1100+(1900-1100)*0,15 = 1220us. It would be easier to understand, if the motor always starts at MIN_RC_PULS=1100, but with a start duty cycle of PCT_PWR_MIN=15. And the 200 steps POWER_RANGE are aligned to the remaining 75%.

But I think the resoultion of the timers is a problem, and maybe the math gets to complicated for the AVR.

Cheers,
Heiko.

marbalon
Posts: 107
Joined: Thu Aug 18, 2011 10:59 am

Re: Alternative ESC firmware (reflashing)

Post by marbalon »

Hi,

ziss_dm wrote:Can you try the latest 0.11 tag? For my setups it is finally better or equal to the original one. ;)


I've just made some tests on one motor and ESC - this is not good test because sometimes one pair in my quad (motor+ESC) works fine with one firmware but other pair (of course the same models) have a problem with startup. But back to test results. I've uploaded version r82 and have huge problem with startup. Then uploaded version from tag 0.11 and motor make few rotation with some problems (a little noisy) but then works fine. Then I've added modifications suggested by Heiko:

#define PCT_PWR_STARTUP 20
#define PCT_PWR_MAX_STARTUP 25

And motor start with a short grind but much better then on original 0.11. But it is far away startup comparing this to original or Quax version (first working in this topic) - this firmwares start smoothly and without any any problems. I 'ca try to upload this firmware to all ESC but do your think you can try to tune startup procedure to work better?

Thanks for help,
Marcin.

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi marbalon,

What motors/props are you using? And have you removed back EMF feedback capacitors?
And if you like experiments, you can try to adjust STRT_ZC_FILTER_DELAY in core\str_zc_filter.inc. I think, you can lower it little bit.

regards,
ziss_dm

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi Heiko,

I use an AVR development board with a poti and a self written software to generate a 400Hz PWM signal.

And to generate step, you just rotate pot fast? And it depends on idle rpm?

can you try to LOWER the second power curve point?

Code: Select all

PWR_CURVE_POINT(01, 3500, 25)
PWR_CURVE_POINT(02, 5600, 50)


The idea is:
- When you rotate pot, it can change fast but not immidiate, so motor can keep up and everythingis fine
- When RPM is low, the limiter limiting power to 50% and this is good, but than motor reaches treshhold RPM it can generate "step" change in power

regards,
ziss_dm

marbalon
Posts: 107
Joined: Thu Aug 18, 2011 10:59 am

Re: Alternative ESC firmware (reflashing)

Post by marbalon »

ziss_dm wrote:Hi marbalon,

What motors/props are you using? And have you removed back EMF feedback capacitors?
And if you like experiments, you can try to adjust STRT_ZC_FILTER_DELAY in core\str_zc_filter.inc. I think, you can lower it little bit.

regards,
ziss_dm


Hi,
My setup is KDA 20-22L + Mystery 20A (old version with p+nFet) + prop 10x4.5. And I like experiments so If you tell me what defines should I try to change I can make some test. I prepared one arm with motor + prop + ESC with soldered ISP so testing is easy now. Will try to tune STRT_ZC_FILTER_DELAY and will give you feedback when I get home.

Cheers,
Marcin.

funth1ngs
Posts: 68
Joined: Tue Aug 09, 2011 8:37 pm

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi!

@Marcin:
marbalon wrote:Will try to tune STRT_ZC_FILTER_DELAY and will give you feedback when I get home.

If this will not fix your problems, try to remove the BEMF capacitors on one ESC as the next step. It's possible that your capacitators have a greater capacitance what affects BEMF meassurement in a negative way. And you can try to increase PCT_PWR_STARTUP and PCT_PWR_MAX_STARTUP even more.

@ziss_dm:
ziss_dm wrote:And to generate step, you just rotate pot fast?

Yes, in all my tests I used the poti to set the PWM, so it was never set "immediately".

ziss_dm wrote:And it depends on idle rpm?

Sorry, i don't get it. What do you mean :)? I mean with idle throttle, that my motors are always spinning, even with the throttle stick in the lowermost position. I start/stop the motors with throttle off and yaw left/right (OP CopterControl).

ziss_dm wrote:Can you try to LOWER the second power curve point?

Code: Select all

PWR_CURVE_POINT(01, 3500, 25)
PWR_CURVE_POINT(02, 5600, 50)

The idea is:
- When you rotate pot, it can change fast but not immidiate, so motor can keep up and everythingis fine
- When RPM is low, the limiter limiting power to 50% and this is good, but than motor reaches treshhold RPM it can generate "step" change in power


I will try that, but as far as I understood you when you explained the settings, the RPM values are electrical RPM. Idle throttle on the MT3508 is arround 800-1000 "mechanical" RPM, and if I convert that to electrical RPM it's 5600-7000 RPM (electrical rpm = mechanical rpm * poles / 2). If this is right, PWR_CURVE_POINT 01 is never reached. But maybe I'm wrong ;)?

EDIT: OK, now I got it. That's exactly what you want me to test.

Cheers,
Heiko.
Last edited by funth1ngs on Fri Nov 04, 2011 11:09 am, edited 2 times in total.

marbalon
Posts: 107
Joined: Thu Aug 18, 2011 10:59 am

Re: Alternative ESC firmware (reflashing)

Post by marbalon »

funth1ngs wrote:If this will not fix your problems, try to remove the BEMF capacitors on one ESC as the next step. It's possible that your capacitators have a greater capacitance what affects BEMF meassurement in a negative way. And you can try to increase PCT_PWR_STARTUP and PCT_PWR_MAX_STARTUP even more.


You think about three caps on the top right side on this foto?

Image

funth1ngs
Posts: 68
Joined: Tue Aug 09, 2011 8:37 pm

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi!

marbalon wrote:You think about three caps on the top right side on this foto?

Yes.

Cheers,
Heiko.

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi Heiko,

In Rev 115, I have added support for "Complimentary" PWM (for n-fet boards, and it is disabled by default). It would be interesting to hear, how it performs on your setup. And it would be interesting to see acceleration/deceleration profiles, as it actively breaking.

regards,
ziss_dm

funth1ngs
Posts: 68
Joined: Tue Aug 09, 2011 8:37 pm

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi ziss_dm,

Can you try to LOWER the second power curve point?

Code: Select all

PWR_CURVE_POINT(01, 3500, 25)
PWR_CURVE_POINT(02, 5600, 50)


The idea is:
- When you rotate pot, it can change fast but not immidiate, so motor can keep up and everythingis fine
- When RPM is low, the limiter limiting power to 50% and this is good, but than motor reaches treshhold RPM it can generate "step" change in power


Tried it, but it had no affects on the resets.

In Rev 115, I have added support for "Complimentary" PWM (for n-fet boards, and it is disabled by default). It would be interesting to hear, how it performs on your setup.

OK, but I don't know what it should do ;). At first looking, I didn't see any difference with or without COMP_PWM.

Code: Select all

And it would be interesting to see acceleration/deceleration profiles, as it actively breaking.

Breaking is active with COMP_PWM, or needs something else to be activated (for what is CHARGE_BOOTSTRAP?)? This time, I used a timer to change the PWM:

Code: Select all

5sec - 1300us
2sec - 1900us
2sec - 1400us
2sec - 1200us

For both meassurements CHARGE_BOOTSTRAP was activated and HIGH_SIDE_PWM disabled.

Cheers,
Heiko
Attachments
UL_06.jpg
UL_07.jpg

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi Heiko,

OK, but I don't know what it should do . At first looking, I didn't see any difference with or without COMP_PWM.

So, resets still happening?

CHARGE_BOOTSTRAP - to pre-charge bootstrap capacitors (apparently this is official name) before start.
And yes, braking is always active with COMP_PWM.

Graphs are look cool: Looks like down slopes are shorter now and it is charging battery (which is strange).

regards,
ziss_dm

funth1ngs
Posts: 68
Joined: Tue Aug 09, 2011 8:37 pm

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi ziss_dm,

So, resets still happening?

Unfortunately, yes. I noticed that with HIGH_SIDE_PWM enabled the ESC resets on any throttle change from 1300us to 1900us, while it's working up to 95% with HIGH_SIDE_PWM disabled. So I meassured RPM at 1300us an got:

HIGH_SIDE_PWM enabled: 1680 RPM
HIGH_SIDE_PWM disabled: 2050 RPM

Graphs are look cool: Looks like down slopes are shorter now and it is charging battery (which is strange).

Yes, this is very handy for heavy props. Nice feature!

Cheers,
Heiko.

marbalon
Posts: 107
Joined: Thu Aug 18, 2011 10:59 am

Re: Alternative ESC firmware (reflashing)

Post by marbalon »

ziss_dm wrote:Hi marbalon,

What motors/props are you using? And have you removed back EMF feedback capacitors?
And if you like experiments, you can try to adjust STRT_ZC_FILTER_DELAY in core\str_zc_filter.inc. I think, you can lower it little bit.

regards,
ziss_dm


Hi,
I tried to tune this valune but don't see the difference. So I only change this values:
#define PCT_PWR_STARTUP 20
#define PCT_PWR_MAX_STARTUP 25

And noe all my ESC and motors don't have a problem with startup. thanks for help.

Regards,
Marcin.

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi Heiko,

Could you please try this version? The idea is simple: to have different ZC filter for low and high RPM. The question is: Is it worth to integrate it into main branch? ;)

regards,
ziss_dm
Attachments
bldc.ZCFastSlow.zip
(33.16 KiB) Downloaded 199 times

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi Quax, Rob, Sim,

Looks like I finally understand what is happening with zero crossing in case of low RPM and high voltage. Whe RPM is low, the BEMF voltage is really low and have really flat slope, as a result even small amount of ringing noise would cause comparator to switch especially around zero crossing. The usual way to prevent it from happenning is to create some positive feedback to the comparator, to create hysteresis. Unfortunately AVR comparator does not have this setting, and looks like it has 0 hysteresis. So I was thinking, if we can mirror comparator value to one of the free GPIO pins, it should be possible to feed it to the positive comparator input (in our case this is virtual common point) and this should create some hysteresis and reduce noise.

Any thoughts why it would not work? ;)

regards,
ziss_dm

User avatar
Rob
Posts: 77
Joined: Sun Apr 03, 2011 4:40 pm

Re: Alternative ESC firmware (reflashing)

Post by Rob »

Ziss,

- With 3 cels I don't have any problems.... Every combination have a nice startup and runs well.

- As I understand the only problem is a unwanted reset?

- if you want a hysteresis I can test it.

- Maybe the problem is not the software but the hardware :)

I'm going to read the previous posts and look to the schematics looking voor hardware "bugs"

If there is no problem in the software, even you can't find it :)

Rob

User avatar
Rob
Posts: 77
Joined: Sun Apr 03, 2011 4:40 pm

Re: Alternative ESC firmware (reflashing)

Post by Rob »

@all,

I'm looking for the Turnigy TY-P1 schematic...... (to find the hardware problem?)

thanks,


Rob

funth1ngs
Posts: 68
Joined: Tue Aug 09, 2011 8:37 pm

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi ziss_dm,

ziss_dm wrote:Could you please try this version? The idea is simple: to have different ZC filter for low and high RPM. The question is: Is it worth to integrate it into main branch? ;)

I can't test it before the weekend because I'am not at home.

Cheers,
Heiko.

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: Alternative ESC firmware (reflashing)

Post by crashlander »

funth1ngs wrote:Hi Andrej,

here is the picture with the ISP pins. I have only one TY-P1, so I never used it in a copter.

Cheers,
Heiko

Hi!
What input and hw files have you used? I have tried with Mystery20A and pwm_fast_125, with additional #define MINTHROTTLE 1220 and 1150 in MultiWii and the motor doesn't start properly (it only goes around slow and jerky).
I'm using http://www.hobbyking.com/hobbyking/stor ... duct=14847.

Regards
Andrej

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi Andrej,

You can try to increase startup power:

Code: Select all

#define PCT_PWR_STARTUP 20
#define PCT_PWR_MAX_STARTUP 25


regards,
ziss_dm

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi,

Just a quick update on the progress:
  • new dynamically adjusted ZC filter
    • less chances of misfire
    • one filter for all modes: startup/slow/fast
  • reviewed lost ZC recovery strategy. Now it recovers pretty much in all cases.
  • Support of Complimentary PWM for n-FET boards
regards,
ziss_dm
Attachments
bldc.0.12.zip
(26.74 KiB) Downloaded 453 times

funth1ngs
Posts: 68
Joined: Tue Aug 09, 2011 8:37 pm

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi all!

@ziss_dm
While with the ZCFastSlow branch the ESC was still resetting, the v0.12 always recovers. Well done =)!

@Andrej
I used Mystery20A and pwm_fast_200 with the TY-P1. Which revision/tag are you using?

Cheers,
Heiko.

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: Alternative ESC firmware (reflashing)

Post by crashlander »

funth1ngs wrote:Hi all!

@Andrej
I used Mystery20A and pwm_fast_200 with the TY-P1. Which revision/tag are you using?

Cheers,
Heiko.

I did svn checkout last saturday (I'm not sure about revision tag).
Andrej

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: Alternative ESC firmware (reflashing)

Post by crashlander »

ziss_dm wrote:Hi Andrej,

You can try to increase startup power:

Code: Select all

#define PCT_PWR_STARTUP 20
#define PCT_PWR_MAX_STARTUP 25


regards,
ziss_dm

Hello,
tested today with r139 + your suggestion and it still doesn't work!

Regards
Andrej

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi Andrej,

Even without prop? Have you removed BEMF caps?

regards,
ziss_dm

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: Alternative ESC firmware (reflashing)

Post by crashlander »

ziss_dm wrote:Hi Andrej,

Even without prop? Have you removed BEMF caps?

regards,
ziss_dm

Hello,
my tests are without props, but haven't removed BEMF caps. If you please mark them on the picture (TY-P1), I can do that.

Regards
Andrej

funth1ngs
Posts: 68
Joined: Tue Aug 09, 2011 8:37 pm

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi Andrej,

crashlander wrote:Hello,
my tests are without props, but haven't removed BEMF caps. If you please mark them on the picture (TY-P1), I can do that.

Regards
Andrej

Just tested my ESC with the attached version and it works very well (the BEMF caps are not removed).

Did you set the fuses to ext. crystal / high frequency?
Can you confirm that your ESC is 100% identical to the one shown on the pictures?
Do you have another motor to test with?

Cheers,
Heiko.
Attachments
Mystery20A.zip
(2.45 KiB) Downloaded 349 times

691175002
Posts: 1
Joined: Wed Nov 23, 2011 8:39 pm

Re: Alternative ESC firmware (reflashing)

Post by 691175002 »

Does a given firmware work for all models in a familly of ESCs?

Can I flash the Hobbyking SS 40-50A?
http://www.hobbyking.com/hobbyking/stor ... A_ESC.html

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: Alternative ESC firmware (reflashing)

Post by crashlander »

funth1ngs wrote:Hi Andrej,

Did you set the fuses to ext. crystal / high frequency?
Can you confirm that your ESC is 100% identical to the one shown on the pictures?
Do you have another motor to test with?

Cheers,
Heiko.

Hello,
- I did not set any special stuff (apart from what ziss_dm suggested).
- It looks pretty similar (apart from missing cap. from your picture), pleas check my picture.
- I've tested with 3 motors (heavy 910rpm/V, lighter apr. 2000rpm/V and small Hacker 4100rpm/V) all have sam issues.
- I've tested with your hex and issues are still here.
Attachments
TY-P1
TY-P1

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi crashlander,

Forget my question about BEMF caps, somhow I have missed that you are talking not about Mystery ESC.
But another question still remains: Is it starting motor(s) without props?

@Heiko
So, this board has all n-FETs but they are not inverted?
Why it is neccesary to change fuses?
Maybe it is better to pre-charge bootstrap capacitors for this board?

regards,
ziss_dm

funth1ngs
Posts: 68
Joined: Tue Aug 09, 2011 8:37 pm

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi ziss_dm,

ziss_dm wrote:@Heiko
So, this board has all n-FETs but they are not inverted?
Why it is neccesary to change fuses?
Maybe it is better to pre-charge bootstrap capacitors for this board?


yes, this ESC has all nFETs (IRF IRLR7843) and works with the Mystery20A hw target. Somehow it uses 6 dual transistors (SMD code H11: CHUMH11PT) plus 6 other transistors (SMD Code Y1: ROHM EMY1 / UMY1N / FMY1A), but I don't have a schematic.

It's not neccesary to "change" the fuses, I just thougt maybe he didn't set them proper after the avr reset. We can try to pre-charge the capacitors, but this board works really well for me on all my motors. I have no startup problems at all, I can't imagine what's causing Andrej's problems.

Cheers,
Heiko.

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: Alternative ESC firmware (reflashing)

Post by crashlander »

ziss_dm wrote:Hi crashlander,

Forget my question about BEMF caps, somhow I have missed that you are talking not about Mystery ESC.
But another question still remains: Is it starting motor(s) without props?

@Heiko
So, this board has all n-FETs but they are not inverted?
Why it is neccesary to change fuses?
Maybe it is better to pre-charge bootstrap capacitors for this board?

regards,
ziss_dm

The motors don't start even without props!
@Heiko
I have not intentionally change fuses (I'm so fresh in AVR programing) so I'm using ziss_dm's manual how to upload using Arduino as ISP programer and modified _make.cmd form SVN (I'm Mac user that's why modified).
Regards.

funth1ngs
Posts: 68
Joined: Tue Aug 09, 2011 8:37 pm

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi Andrej,

crashlander wrote:I have not intentionally change fuses (I'm so fresh in AVR programing) so I'm using ziss_dm's manual how to upload using Arduino as ISP programer and modified _make.cmd form SVN (I'm Mac user that's why modified).
Regards.


try to reset the AVR and set the fuses:

Code: Select all

avrdude.exe -C avrdude.conf -v -p m8 -P comX -c avrisp -b 19200 -e
avrdude.exe -C avrdude.conf -v -p m8 -P comX -c avrisp -b 19200 -U lfuse:w:0x3f:m -U hfuse:w:0xcf:m

After that, reflash the software. If that doesn't work, please post the avrdude output.

Cheers,
Heiko.

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi Andrej,

Is it beepeng after power-up?

regards,
ziss_dm

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: Alternative ESC firmware (reflashing)

Post by crashlander »

ziss_dm wrote:Hi Andrej,

Is it beepeng after power-up?

regards,
ziss_dm

Yes it plays boot-up melody!? And after that it is quiet.

@Heiko
Thank you I'll try during weekend.

Regards

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: Alternative ESC firmware (reflashing)

Post by crashlander »

Hello,
I just tried Heiko's fuse settings (my original was different only in brown-out voltage). Since the symptoms are still present I'm posting avrdude output.
Regards, Andrej

========

./Mystery20A.cmd

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.04s

avrdude: Device signature = 0x1e9307
avrdude: reading flash memory:

Reading | ################################################## | 100% 14.53s

avrdude: writing output file "flash-orig.hex"
avrdude: reading eeprom memory:

Reading | ################################################## | 100% 20.93s

avrdude: writing output file "eeprom-2011-11-27-135619.hex"

avrdude: safemode: Fuses OK

avrdude done. Thank you.


avrdude: Version 5.4-arduino, compiled on Oct 9 2007 at 11:20:31
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

System wide configuration file is "/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf"
User configuration file is "/Users/andrejj/.avrduderc"
User configuration file does not exist or is not a regular file, skipping

Using Port : /dev/tty.usbmodem621
Using Programmer : avrisp
Overriding Baud Rate : 19200
AVR Part : ATMEGA8
Chip Erase delay : 10000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :

Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 4 20 128 0 no 512 0 0 9000 9000 0xff 0xff
flash 33 10 64 0 yes 8192 64 128 4500 4500 0xff 0x00
lfuse 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00
lock 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00
calibration 0 0 0 0 no 4 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

Programmer Type : STK500
Description : Atmel AVR ISP
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.04s

avrdude: Device signature = 0x1e9307
avrdude: safemode: lfuse reads as 3F
avrdude: safemode: hfuse reads as CF
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "bin/Mystery20A.hex"
avrdude: input file bin/Mystery20A.hex auto detected as Intel Hex
avrdude: writing flash (2074 bytes):

Writing | ################################################## | 100% 3.23s

avrdude: 2074 bytes of flash written
avrdude: verifying flash memory against bin/Mystery20A.hex:
avrdude: load data flash data from input file bin/Mystery20A.hex:
avrdude: input file bin/Mystery20A.hex auto detected as Intel Hex
avrdude: input file bin/Mystery20A.hex contains 2074 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 3.73s

avrdude: verifying ...
avrdude: 2074 bytes of flash verified

avrdude: safemode: lfuse reads as 3F
avrdude: safemode: hfuse reads as CF
avrdude: safemode: Fuses OK

avrdude done. Thank you.
============

funth1ngs
Posts: 68
Joined: Tue Aug 09, 2011 8:37 pm

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi Andrej!

I just tried Heiko's fuse settings (my original was different only in brown-out voltage). Since the symptoms are still present I'm posting avrdude output.

Hm, the log looks OK to me. Did you reset the AVR with the "-e" switch? Please connect one ESC directly to a reciever and try to start the motor this way. You can also record a short video that we can see/hear the problem ;).

Cheers,
Heiko.

wektorx
Posts: 8
Joined: Sat Aug 27, 2011 8:08 pm

Re: Alternative ESC firmware (reflashing)

Post by wektorx »

I have problem with AVRootloader. I flashed ESC with software form first post on this site viewtopic.php?f=13&t=516&start=160 and set fusebits to High-Fuse: 0xCC and Low-Fuse: 0x2E
Now i can connect with flash software, write and read EEPROM, erese FLASH. But if i want to write flash there is problem.

logs:
01.12.11-00:22:16-157 > Connecting on port COM11...
01.12.11-00:22:16-332 > Switch to 1-Wire mode
01.12.11-00:22:16-335 > Device connected
01.12.11-00:22:16-335 > Program...
01.12.11-00:22:16-340 > execute compiled data
01.12.11-00:22:16-340 > selected options in compiled file:
01.12.11-00:22:16-340 > - programming FLASH
01.12.11-00:22:16-341 > - erase FLASH during programming
01.12.11-00:22:16-342 > - full verify FLASH after programing
01.12.11-00:22:16-900 > Cmd.WriteFlash.ResCheck() Error: Verify failed
01.12.11-00:22:16-941 > Device disconnected

Maybe some one have the same problem and can help me.

Thx
wektor

funth1ngs
Posts: 68
Joined: Tue Aug 09, 2011 8:37 pm

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi wektorx,

wektorx wrote:...
01.12.11-00:22:16-900 > Cmd.WriteFlash.ResCheck() Error: Verify failed
...


I guess AVRRootloader is compiled without Flash verify:

Code: Select all

.equ   UseVerify         = 0         ; Verify FLASH command (FLASH write/erase have implicit verify, can be deactivated)

Because the write command has implicit verify, you can uncheck "Verify device after programming" in the GUI.

Cheers,
Heiko.

Post Reply