Alternative ESC firmware (reflashing)

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

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi ziss_dm,

I just tried your latest software. It seems that the motor is not switching from startup mode into running mode. The motor starts spinning very smoothly, but when it should switch into "running mode" the ESC resets. If needed, I can make a video.

I don't think it's a FET issue, because with some older versions of the tgy code the startup was working.

Cheers,
Heiko.

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

Re: Alternative ESC firmware (reflashing)

Post by Rob »

I have test the new software and I had also startup problems, but........
I have it fixed with 10N capacitors in the feedback.

I have fly with it and everyting looks ok.

Even with bad bearings(for test) Startup no problem and no smoking fet's


Rob

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

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi,

@Rob
I have it fixed with 10N capacitors in the feedback.


Removing or adding them? ;)

@Heiko
That means it loosing sync for some reason.. You can try new version (I have adjusted ZC filter).

regards
ziss_dm
Attachments
bldc.0.4.zip
(33.42 KiB) Downloaded 312 times

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

Re: Alternative ESC firmware (reflashing)

Post by Rob »

@ziss_dm

adding them, 1N to less (do nothing) 47N start OK but with high speed losing sinc.
10N ok, smooth start and current ok.

try tomorrow the adjusted ZC filter, may be I can remove the caps.....

this evening I post my schematic.

For my quad board this ESC software works very well......... :D


Rob

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

Re: Alternative ESC firmware (reflashing)

Post by Rob »

Test software rev3

ESC test, (with 10N caps added to the feedback)
Last edited by Rob on Fri Sep 23, 2011 12:05 am, edited 3 times in total.

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

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi ziss_dm,

some new test results with v0.4 :D.

8V PSU:
The motor starts spinning smoothly at arround 1,12ms (min = 1,00ms / max = 2,00ms). But I need to set throttle to 1,20ms to get the motor into running mode. So, if I set throttle immediately to 1,20ms or above it always switches from starting into running mode, below 1,20ms it starts spinning but it switches not succesfully into running mode.

3S Lipo:
Same behavior as above, but throttle needs to be at 1,35ms or above.

4S Lipo:
No startup possible, even if I set throttle to 100% (2,00ms).

With v0.3 startup was not possible at all, so you are on the right way :).

Thanks for your help,
Heiko.

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

Re: Alternative ESC firmware (reflashing)

Post by Rob »

Schematic Qynx ESC

original designed for pwm on positive site and RC_PWM on ICP input

The 3 10N caps in the feedback are placed extra for working with rev. 3 of Ziss dm version......

Maybe not needed in rev.4 , have to test this tomorrow.



Rob Keij
Attachments
Qynx.zip
HW file for Qynx esc. in bldc.asm must external interrupt 0 replaced by external interrupt 1
(939 Bytes) Downloaded 311 times

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

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi Rob,

About your test fligh: Is it with standard RC range or with extended range? ;)

The 3 10N caps in the feedback are placed extra for working with rev. 3 of Ziss dm version......

I think, it is better to check with scope ;) It is always better to have signal conditioning in HW regardless of software filter ;)

regards,
ziss_dm

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

Re: Alternative ESC firmware (reflashing)

Post by Rob »

About your test fligh: Is it with standard RC range or with extended range? ;)


I have changed my software to extended for the test, but I think 100 steps is enough, if I can make some time I make a
good test (outdoor with wind).

The 3 10N caps in the feedback are placed extra for working with rev. 3 of Ziss dm version......

I think, it is better to check with scope ;) It is always better to have signal conditioning in HW regardless of software filter ;)

I know, but why most? of the reflash guys want them removed? I like a clean board with less components. but 3 caps is no problem.




Rob Keij

regards,
ziss_dm[/quote]

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

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi Rob,

You can try only one filter cap on the neutral point (MIDEN).

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,

What HW do you using?

regards,
ziss_dm

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

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi,

what do you mean by hardware, ESC and motor?

It's a 20A HobbyKing BlueSeries with all n-Fets and removed caps in BEMF feedback. The Motor is a T-Motor MT3506 650KV.

I think someting is diffrent with this motor, because your software is working great with my other motors (RCTimer A2830-14 750KV).

Cheers,
Heiko.

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

Re: Alternative ESC firmware (reflashing)

Post by Rob »

ziss_dm wrote:Hi Rob,

You can try only one filter cap on the neutral point (MIDEN).

regards,
ziss_dm



I have try but even a 1N capacitor is not working......

I have test version 4 and this is ok without caps :D works ok, smooth start, zero problems.....

On the scope everyting looks good, nice spikes (not dirty) so in my opinion no caps needed. (it depends wich hardware is used)


And I have fly with 250 steps and 100 steps, I dont feel the difference, steady as a rock with High PID settings
sometimes I forgot that I fly in acro mode it looks like level mode, so for sure........ 100 steps steps is enough

Best regards,

Rob Keij

Kayle
Posts: 141
Joined: Sun Feb 13, 2011 6:45 pm

Re: Alternative ESC firmware (reflashing)

Post by Kayle »

Hi,

I am new in reflashing esc's. I have some blackmantis 12a esc. They are similar to the mystery 12a. When i flash the mega8 with 0.4 version, how can i do throttle range setting ? How do i set lipo voltage cutt off ..... ?

Thanks
Kayle

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

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi Kayle,

The throttle range is hard coded and depends on input method. And it does not have voltage protection at all...

Throttle range for standard RC: 1100-1900
Extended throttle range: 18-2016 (More details on page 3)

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,

You can try to play with:

Code: Select all

.if CLK_SCALE==2
  .macro __waitp
                nop
                nop
                nop
                nop
                nop
                nop
  .endmacro
.else
  .macro __waitp
                nop
                nop
                nop
  .endmacro
.endif


Add or remove nop's (more likely to add).

regards,
ziss_dm

Kayle
Posts: 141
Joined: Sun Feb 13, 2011 6:45 pm

Re: Alternative ESC firmware (reflashing)

Post by Kayle »

Hi,

Thanks for reply. When it is hardcoded, i can set minimum throttle a little bit above 1100 in multiwii sketch? When i use your software on my black mantis 12a, do i have to remove some caps or something?

Kayle

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

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi,
Yes you need to set it little bit lower to have relieble arm. It is really difficult to say without knowing schematics. But usually it is better to remove caps.

regards.

Kayle
Posts: 141
Joined: Sun Feb 13, 2011 6:45 pm

Re: Alternative ESC firmware (reflashing)

Post by Kayle »

Hi,

Thanks, what is the reason for removing the caps? The original firmware is also running with caps.

Kayle

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

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi ziss_dm,

for a very smooth startup I need 16 nops on a 3S and arround 32 nops on a 4S.

To set more than 7 nops I had to "adjust" the "brcc wait_for_low" command:

Code: Select all

brcs continue_wait_for_low
rjmp wait_for_low
continue_wait_for_low: ret

There is one problem left: On 4S and fast throttle changes the motor screams and the ESC resets.

Cheers,
Heiko

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

Re: Alternative ESC firmware (reflashing)

Post by Rob »

video of test with 100 steps resolution

After many flights today one of the test motor (the one with the bad bearings) burned out after landing , ESC was ok.



Rob Keij

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

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi Heiko,

funth1ngs wrote:for a very smooth startup I need 16 nops on a 3S and arround 32 nops on a 4S.
To set more than 7 nops I had to "adjust" the "brcc wait_for_low" command:

Code: Select all

brcs continue_wait_for_low
rjmp wait_for_low
continue_wait_for_low: ret

There is one problem left: On 4S and fast throttle changes the motor screams and the ESC resets.


Could you also try this ZC filter:

Code: Select all

.macro __wait_for_filter
                clc
                sbis    ACSR, ACO
                sec
                brcc    wait_for_filter_1
                inc     temp2
wait_for_filter_1:
                rol     temp1
                brcc    wait_for_filter_2
                dec     temp2
wait_for_filter_2:
.endmacro
                               
wait_for_low:   
                ldi     temp1, 0xFF
                ldi     temp2, 8
wait_for_low_loop:
                sbrs    flags0, OCT1_PENDING
                ret
                __wait_for_filter
                cpi     temp2, (8-3) + 1
                brcc    wait_for_low_loop
                ret
                               
wait_for_high:   
                ldi     temp1, 0x0
                ldi     temp2, 0
wait_for_high_loop:
                sbrs    flags0, OCT1_PENDING
                ret
                __wait_for_filter
                cpi     temp2, 3
                brcs    wait_for_high_loop
                ret

Basically it is the same majority filter, but with sliding window. You also can play with filter constant (you have to change it in 2 places)

Code: Select all

..
                cpi     temp2, (8-7) + 1
..
                cpi     temp2, 7
..


I think, range should be 2-7. Smaller constant - faster response, but less "filtered" result. ;) We also can try to change it depending on RPM..




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 Rob,

Would you be able to test this version (the support of the Qynx20A is inluded)? ;)
And also new ZC filter for Heiko.

regards,
ziss_dm
Attachments
bldc.0.5.zip
(21.34 KiB) Downloaded 279 times

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

Re: Alternative ESC firmware (reflashing)

Post by Rob »

@ Ziss,

Great, now nothing have to be changed to test it....


ziss_dm wrote:Hi Rob,

Would you be able to test this version (the support of the Qynx20A is included)? ;)
And also new ZC filter for Heiko.

regards,
ziss_dm



Yes, I have test it....

I program with AVRStudio so I need to include:

Code: Select all


.include "m8def.inc"
.include "M:\source\sourceasm\ziss\0.5\hw\qynx20A.inc"

.include "M:\source\sourceasm\ziss\0.5\input\pwm_fast_100.inc"
//.include "M:\source\sourceasm\ziss\0.5\input\pwm_fast_200.inc"



before:

Code: Select all

#if defined(_include_ppm_inc_)
  .include "ppm.inc"
#endif


It works without problems...... :D

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

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi,

@Rob: Tnx

@Heiko: Looks like I found startup issue. ;)

regards,
ziss_dm
Attachments
bldc.0.6.zip
(25.43 KiB) Downloaded 231 times

User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

Re: Alternative ESC firmware (reflashing)

Post by EOSBandi »

Hi Ziss_dm,
I suppose that the Mystery_20A_nFET is for this http://www.armokopter.at/forum/viewtopic.php?f=9&t=1529 type of Mystery Blue ESC's
(Seems that latest orders from DealExtreme are fulfilled with this new version. Still Atmega proc, but all nFet's)
Regards,
EOSBandi

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

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi!

@EOSBandi
Yes, it's tested with the newest version (all nFETs) of the HobbyKing 20A BlueSeries.

@ziss_dm
I just tried v0.5 and 0.6 on 4S:
v0.5: very good startup, some resets during fast throttle changes, but way better than v0.4.
v0.6: startup not as good as on v0.6 (throttle needs to be set over 1.20ms or ESC resets while switching into runnning mode), maybe less resets during fast throttle changes than v0.5.

I couldn't find a pattern for the resets during the fast throttle changes, sometimes I can do 20-30 without a reset and sometimes it resets 3 times in a row after the first fast throttle change (but this happens very rarely).

I will do some more tests on the weekend!

Thank you for you very good work,
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 v0.6 I have changed 2 things:
- Reduced ZC timeout from 4 commutation cycles to 1. So now, it should detect fault much faster and motor should not scream.
- I also found that there was no ZC blanking interval in transition from start to run. As a result it was high chance of misfire on first run cycle. (I hoped that this would fix your startup issues ;( )

You can try to increase ZC timeout, to see how it would change behavior:

Code: Select all

update_t99:     lds     temp1, timing_acc_l
                add     temp1, temp3
                sts     timing_acc_l, temp1
                lds     temp1, timing_acc_h
                adc     temp1, temp4
                sts     timing_acc_h, temp1
                lds     temp1, timing_acc_x
                adc     temp1, ZL
                sts     timing_acc_x, temp1

                lsr     ZL                      ; a 16th is the next wait before scan
                ror     temp4
                ror     temp3

                sts     zc_wait_time_l, temp3   ; save for zero crossing timeout (Expected time +90 deg)
                sts     zc_wait_time_h, temp4

                lsr     ZL
                ror     temp4
                ror     temp3
                               
                lsr     ZL
                ror     temp4
                ror     temp3
                lsr     ZL
                ror     temp4
                ror     temp3

                sts     zc_blanking_time_l, temp3
                sts     zc_blanking_time_h, temp4

        ; use the same value for commutation timing (15-)
                sts     com_timing_l, temp3
                sts     com_timing_h, temp4

                ret

If it helps, we can do it only for transition start->run. ;)

But... Simpliest solution would be to replace resistors in ZC attenuator ;) Looks like this esc's not really designed for 4s.

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,

Could you also try this version? Nothing really changed, but I have removed re-initialization of the Comparator, which also could reduce noise a little bit.

EDIT: I actually found small hichup: during start->run transition, the zc timout was set 15deg earlier than needed and was 15deg jump in timing calculation due phase shift. I hope it would finally resolve startup issues even with short ZC timeout.

BTW: I have created project: http://code.google.com/p/wii-esc/

@Quax: I hope you do not mind. ;)

regards,
ziss_dm
Attachments
bldc.0.7.1.zip
(21.47 KiB) Downloaded 239 times
bldc.0.7.zip
(21.46 KiB) Downloaded 263 times

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

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi ziss_dm,

I tried v0.6 with the increased ZC timeout and startup was working very well, but it's causing resets during fast throttle changes. Then I tested r32 from svn, and I couldn't notice any diffrence to unmodificated v0.6.

ziss_dm wrote:But... Simpliest solution would be to replace resistors in ZC attenuator ;) Looks like this esc's not really designed for 4s.

But maybe it's just the MT3506, because it seems to work with RCtimer A2830-14 750kV motors. Can you please tell me which resistors should be replaced (and the value)? I will give it a try.

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,
Looks like I was wrong about resistors.. ;( They are already quite low. So another attempt to solve it by software. ;)

Changes list:
- ZC window increased up to 75 deg. This helps for transition from startup to run. My HDD motor now starts. (finally)
- In case of missed ZC, attempt to recover using previous timing information

regards,
ziss_dm
Attachments
bldc.0.8.zip
(27.43 KiB) Downloaded 266 times

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

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi ziss_dm,

it's weird. Throttle needs to be over 15% to successfully switch into running mode. The problem with the fast throttle changes is still there, it's a little bit worse than before.

Cheers,
Heiko.

User avatar
quax
Posts: 47
Joined: Mon Mar 14, 2011 12:28 pm
Contact:

Re: Alternative ESC firmware (reflashing)

Post by quax »

funth1ngs wrote:Hi ziss_dm,

it's weird. Throttle needs to be over 15% to successfully switch into running mode. The problem with the fast throttle changes is still there, it's a little bit worse than before.

Cheers,
Heiko.


Hi,

I told you something about fast throttle changes here:
viewtopic.php?p=3164#p3164

If the BLC performes a reset, then it means, that the current was to high and the voltage dropped down. Additionally there is a big loss of energy, if the motor PWM does not fit with the motor RPM. The only thing a software can do against it, is to slow down the reaction from input value to motor PWM. But that is not good for the attitude control.

Again: don't perform useless throttle changes.

Regards,

quax

EDIT: There is a way to avoid these overcurrent situations, if we add a current measurement device with a fast evaluation time. e.g. a configurable comparator. If we always switch PWM off, if the current limit is exceeded, we can change the throttle without limits. This would also provide the fastest motor reaction as possible.

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

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi Quax,

I know what you have written, and I'm not setting throttle from 0 to 100% anymore ;). As I mentioned before, the ziss_dm modification works great on a RCTimer 2830-14 750KV motor. I only have these problems with a RCTiger MT3506 650KV motor. And by fast throttle changes I mean setting throttle from 40% to 60% with a potentiometer by hand. That shouldn't be to fast? Sometimes the motor resets even if I slowly ramp up the throttle from 0 to 100%. I don't know much about all this stuff, but I seems that this motor is somehow different.

EDIT: Here is a video (not mine) with the MT3506 on BL Ctrl 1.2. The strange sound you can hear sometimes is what i mean with "screaming". In newer versions of the ziss_dm modifications the "screaming" is gone and the motor resets instead.

Cheers,
Heiko.
Last edited by funth1ngs on Mon Oct 03, 2011 3:20 pm, edited 1 time in total.

User avatar
quax
Posts: 47
Joined: Mon Mar 14, 2011 12:28 pm
Contact:

Re: Alternative ESC firmware (reflashing)

Post by quax »

Ok, you are right, that should work.

How many lipos do you use? Maybe I never tested such low kv motor with 2S or 3S lipo.

Regards
quax

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

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi,

it seems the problem increases with the voltage, it's bigger on a 4S than on 3S.

Cheers,
Heiko

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

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi Quax,

Just a little bit history of changes we made to your firmware.. ;)
I was testing behavior in case sudden motor stop and found 2 issues here:
1) In case af lost Sync, previously fw was trying to re-start motor. But in case you have throttle high it was pretty much like starting with full throttle ;). So 2 things was changed:
- In case lost sync now it resets itself
- I also added power ramping in transition from start to run (using sys_control)
2) The ZC window was set to the 240 deg (4 comm cycles). As a result in some conditions ZC was wrongly detected. The symptoms was: you stop motor by hand and instead of reset it starts screaming with high current. So I have reduced
it initially to 60 deg (which, I think, should be sufficient). After that all screaming stopped.

After that we started discovering other issues ;)
1) In some setups transition from start to run is not always succesful. The motor immidiatelly looses sync after switching to run mode. You set ZC window 240 deg - everything fine, ZC window 60 deg - immidiate reset after switch to run.
After small investigation I have found the following:
- Was no ZC blanking interval in transition
- In startup mode timing is calculated immidiatelly after ZC, but in run mode it is calculated after commutation delay (ZC + 15 deg) as a result in transition we have slight bump in timing
After this modifications percent of bad starts was sugnificantly reduced (I was able to reproduce it with HDD motor). But to make it 100% starting I had to increase ZC window to 75 deg (which is still inside correct phase, which not too bad).
But, as I understand Heiko's setup still have problems. So any your comments or suggestions would be really appreciated!!! ;)
2) We also discovered that ZC filter improoving situation with 4S setups, so I have slightly redesigned it to have sliding window of 8 measurements.

So, currently we have one remaining problem - occasional lost sync with 4S (which I cannot reproduce so far ;)) It would be nice to understand why it is looses sync, but also would be nice to have ability to recover from the lost sync in FW. So currently I'm trying different recovery strategies and testing them, simulating loosing sync in one comm phase.. The last one:
- To have ZC window 75 deg
- In case of lost sync:
1) Power off (to reduce PWM noise)
2) wait another 75 deg (using last known timing) (total wait would be 180 deg)
3) skip 2 comm phases
4) wait for ZC up to 150 deg (using last known timing)
5) In case ZC detected, this would be 4 comm phases since last successful ZC, so we can just use this interval as a new timing_. If not, we probably cannot recover - reset
Also your input would be really much appreciated!! ;)

@Heiko: Could you please try rev 35.?

regards,
ziss_dm

User avatar
quax
Posts: 47
Joined: Mon Mar 14, 2011 12:28 pm
Contact:

Re: Alternative ESC firmware (reflashing)

Post by quax »

Hi ziss_dm,

ziss_dm wrote:Hi Quax,

Just a little bit history of changes we made to your firmware.. ;)
....

First I want to say thank you for your improvements and your google project: http://code.google.com/p/wii-esc/
For years I maintenanced the software nearly alone and after a while I think I got routine-blinded ;)
So I'm really happy that you and also Simon Kirby make contructive changes, improve the bldc-software. I think, the software will become ours, not only mine :)
In the moment I'm absolutely happy with my MWC and use my free time to fly and to fly and to fly.
The remaining time in my hobby room is reserved for my next MWC and on the other hand side, I have a job, I'm married, I have children and a house ( and I am old ;) ), so that I had no time to follow all your changes by my own tests.

But I can see the improvements 8-)

ziss_dm wrote:....
2) The ZC window was set to the 240 deg (4 comm cycles). As a result in some conditions ZC was wrongly detected. The symptoms was: you stop motor by hand and instead of reset it starts screaming with high current. So I have reduced
it initially to 60 deg (which, I think, should be sufficient). After that all screaming stopped.
....

The window of more than one commutation time was a suggestion in a TI paper, to smoothen differences of the motor properties, like solenoid position and windings. For me, it seemed to be a good idea to follow the suggestion. I never tried to use only one commutation time, so I don't have any experience there.

ziss_dm wrote:....
So, currently we have one remaining problem - occasional lost sync with 4S (which I cannot reproduce so far ;)) It would be nice to understand why it is looses sync, but also would be nice to have ability to recover from the lost sync in FW. So currently I'm trying different recovery strategies and testing them, simulating loosing sync in one comm phase.. The last one:
- To have ZC window 75 deg
- In case of lost sync:
1) Power off (to reduce PWM noise)
2) wait another 75 deg (using last known timing) (total wait would be 180 deg)
3) skip 2 comm phases
4) wait for ZC up to 150 deg (using last known timing)
5) In case ZC detected, this would be 4 comm phases since last successful ZC, so we can just use this interval as a new timing_. If not, we probably cannot recover - reset
Also your input would be really much appreciated!! ;)
....


I'm not sure, if it's a good idea, to repair a lost sync. If the open phase doesn't reach the expected level (not the transition is detected), then there is a significant failure. I also thought about it, but could not find an other plausible solution as to shut down.

Again, thank you for your work for improvements, I hope, you won't lost the interest in this project.

Regards,
quax

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

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi Heiko,

Would you be able to test this version? ;)


Changes list:
- Lost ZC recovery
- Refactored startup, to use filtered comparator value (instead of end of PWM cycle)
- Smoother power ramp after startup (I can safely start with WOT on 4s (1100kv, 10x6 prop))

regards,
ziss_dm
Attachments
bldc.0.9.zip
(29.25 KiB) Downloaded 226 times

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

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi ziss_dm,

sorry for my late reply. Here are some test results with the MT3508:

r35,r38: The startup is very smooth, no problems anymore. The resets caused by the throttle changes are gone, sometimes the motor "screams" for 1-3 seconds before it reaches the desired speed. The motor finally becomes usable. Thanks again for your very good work =).

v0.9: The startup is not as smooth as with r35 and r38 (it's more "aggressive" on lower voltages), the rest is the same as with r35 and r38.

trunk (r55): same as v0.9

Cheers,
Heiko

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

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi ziss_dm,

funth1ngs wrote:r35,r38: The startup is very smooth, no problems anymore. The resets caused by the throttle changes are gone, sometimes the motor "screams" for 1-3 seconds before it reaches the desired speed. The motor finally becomes usable. Thanks again for your very good work =).

v0.9: The startup is not as smooth as with r35 and r38 (it's more "aggressive" on lower voltages), the rest is the same as with r35 and r38.

trunk (r55): same as v0.9


some feedbach on r70 and r71.

r70: Transition from starting into running mode was not possible.

r71: Startup works again, and the "screaming" caused by the throttle changes is vastly reduced from 1-3 seconds to not more than 0,5 second. I haven't had time for extensive tests yet, but it seems that this is the best revision for the MT3506 so far :D.

Cheers,
Heiko.

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

Re: Alternative ESC firmware (reflashing)

Post by sim »

Hi, ziss_dm, quax, Heiko, all!

It looks like ziss_dm and I have been doing a lot of the same stuff. :)

When Heiko was reporting the same problem with the fork of quax' tree that I have been maintaining at https://github.com/sim-/tgy , I came up with the following which solved the problem on my Plush test board:
https://github.com/sim-/tgy/commit/8f64 ... 9eb09754fb

All that does is move the commutation timing wait into wait_for_low/wait_for_high, and restarts the commutation "timer" if it determines that a false crossing was detected. It uses the comparator value saved from the PWM off interrupt only when looking for false crossings ("acsr_save" register in my tree), but the crossing is picked up with the same old wait_if_spike code, so it shouldn't matter if the motor is spinning fast enough that there are too few PWM cycles within the ZC window.

However, my BlueSeries board arrived the other day, and the problem still occurs there, including the AVR actually resetting if I increase the throttle too quickly, which I have never seen on the Plush board. The only thing I could think of is that the voltage is dropping and the AVR is resetting, since there are no reset paths in my tree and it doesn't happen on the Plush board. Anyway, it's interesting that this patch seemed to solve the problem except on the BlueSeries board, but it might be worth trying. I have a setup that should pretty much be the same as Heiko's (MT3506, 15A bench supply that goes to 15V, no 4S LIPO yet though), so I'll compare ziss_dm's tree and mine.

Wouldn't narrowing the window on both sides hurt the ability to track (de)acceleration, and cause other problems?

Anyway, looking forward to testing out your tree tonight, ziss_dm. :)

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,

All that does is move the commutation timing wait into wait_for_low/wait_for_high, and restarts the commutation "timer" if it determines that a false crossing was detected. It uses the comparator value saved from the PWM off interrupt only when looking for false crossings ("acsr_save" register in my tree), but the crossing is picked up with the same old wait_if_spike code, so it shouldn't matter if the motor is spinning fast enough that there are too few PWM cycles within the ZC window.

I think, this is just another way of filtering Comparator values. In wii-esc, we using majority filter, but result should be quite close.

Wouldn't narrowing the window on both sides hurt the ability to track (de)acceleration, and cause other problems?

Currently we are narrowing only end. And usually motor accelerating faster. ;)

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 Simon,

How was your test? ;)

regards,
ziss_dm

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

Re: Alternative ESC firmware (reflashing)

Post by sim »

ziss_dm wrote:Hi Simon,

How was your test? ;)

regards,
ziss_dm


Hello! With r72, the MT3506 motor actually seems to run quite well, without losing timing (or recovering well, I can't tell :)) better than my current tree. However, I can still cause resets on this BlueSeries 30A all-nFET board while accelerating, on 15V 20A supply and on a 3S LIPO. I see VCC drop on the scope, so I'm pretty sure it's to do with the board design more than the code, perhaps intentional. Anyway, the startup seems very clunky, and often gets into a false timing situation where the motor screams due to it timing from its own inductance rather than backEMF. The whole startup stage seems to be clunk-on or clunk-off, so I'm not quite sure what is happening there. Also, it seems to reset quite often just during startup, so it seems like perhaps a low side FET is being left on unintentionally, or something.

Ah, I see there have been several commits since then. :)

Looking at r73: Hey, I was actually just in the process of trying the same idea last week, but I did it as a 24 bit timer instead and tried to make everything 24-bit, and it got so complicated that I backed it out for now. However, I can see it would be useful for starting all but lighter motors at 16MHz. I see an issue with your implementation -- it is quite difficult to work with OCR1L and OCR1H while emulating higher bits because of the races between setting and triggering. The set of the OCR1L/H registers is buffered and happens atomically when set in the H, L order, but the timer continues to increment, so values like 65536 may actually end up not triggering until 131072. I tried to work around this by setting carry flag outside of the critical section, then changed the first add to adc, so that the result was always starting at 1 higher than the desired interval. This means that if the clk increased by 1 between the sample and the OCR set, it wouldn't miss the comparison, and the first interrupt to decrement the high byte (or clear the MSB) won't be missed. This didn't matter before because intervals were always higher than 0, but you'll probably want a similar adjustment. I suppose it's only for startup..

r75: btw, you can use movw temp1, temp3, instead of the two movs, when the registers are in order. Also, there is a redundant sei near the top of update_timing.

Trying r84, startup seems much better, but I'm not quite sure why. Is that just the MSB change? I can't start the HD on this BlueSeries 30A board because it keeps getting false timing and makes tones instead of turning, but I can't start the HD with my tree either on this board unless I give it a bit of a push. Starting with 3 props on one motor doesn't work reliably and not at all unless I have at least 13V input voltage. Motor drive is still good and seems to be quite usable overall. Pretty nice once it's going! I wonder how this one works for Heiko? I'm surprised that you actually got it to work so well considering that there does not seem to be any alignment to PWM. Hmmm. :)

Cheers!

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

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Hi,

r73 introduced some startup problems. With r84 everything works very well again.

I only have resets when throttle is realy low (below 30% (1,30ms) on 4S) and changed rapidly. If the throttle is above 30%, I can change it as fast as I want without any reset.

I have timing problems (screams) on the first 3-4 fast throttle changes, but then they are gone until the ESC is restarted. Is it possible to make a special version which writes the working timing values into the eeprom, then we can read the eeprom an use them as start values in the normal version?

Here are my settings for the MT3506 and 20A all nFet ESC:

Code: Select all

;*************************
; Power curve            *
;*************************
PWR_CURVE_POINT(01, 1500, 25)
PWR_CURVE_POINT(02, 3700, 50)

;*************************
; Startup settings       *
;*************************
#define    RPM_STEP_INITIAL    90
#define    RPM_STEP_MAX        250
#define    PCT_PWR_STARTUP     15
#define    PCT_PWR_MAX_STARTUP 20
#define    RPM_START_MIN_RPM   950 ; 4200
#define    ENOUGH_GOODIES      20

;*************************
; Run settings           *
;*************************
#define    RPM_RUN_MIN_RPM     750 ; 3200


Cheers,
Heiko.

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

Re: Alternative ESC firmware (reflashing)

Post by funth1ngs »

Today I played with my old UniLog (MT3506 on 4S). Unfortunately, the capture frequency is only 16 Hz. But maybe someone is interested...

Cheers,
Heiko.
Attachments
UniLog_MT3506_4S.jpg

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

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi Heiko,

Looking at this graph I was thinking: Have we tried to increase input capacitors? I think, 2x220ms/30v, low ESR would be more appropriate. ;)

regards,
ziss_dm

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

Re: Alternative ESC firmware (reflashing)

Post by sim »

Are you concerned about the input voltage dropping causing the resets? I was seeing VCC drop to below 2.7V on the scope, but only for about 100ns, and it's an oscillating impulse at about 10MHz. Some kind of miller effect or noise is causing the resets, not the input voltage, since the input voltage would have to be well below 7V before the 5V regulator for the VCC would be affected.

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

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi Sim,
I was thinking, that it would help to "discharge" inductive kick after commutation.

regards,
ziss_dm

Post Reply