Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*confusion of demag process #63

Open
garlinplus opened this issue Dec 6, 2022 · 0 comments
Open

*confusion of demag process #63

garlinplus opened this issue Dec 6, 2022 · 0 comments

Comments

@garlinplus
Copy link

garlinplus commented Dec 6, 2022

Describe the issue

When one commutation is finished,the timer2 counter is set with Wt_ZC_Tout_Start, in order to know whether zero cross check is timeout.
But when a new zero cross point checking start,Flag_Demag_Detected is set.
And if there is a wrong comparator output, in the function comp_read_wrong_extend_timeout,the timeout check counter timer2 is reset as followed:

comp_read_wrong:
    jb    Flag_Startup_Phase, comp_read_wrong_startup
    jb    Flag_Demag_Detected, comp_read_wrong_extend_timeout

    inc    Temp3                    ; Increment number of OK readings required
    clr    C
    mov    A, Temp3
    subb    A, Temp4
    jc    comp_check_timeout            ; If below initial requirement - take another reading
    sjmp    comp_start                ; Otherwise - go back and restart

comp_read_wrong_startup:
    inc    Temp3                    ; Increment number of OK readings required
    clr    C
    mov    A, Temp3
    subb    A, Temp4                    ; If above initial requirement - do not increment further
    jc    ($+3)
    dec    Temp3

    sjmp    comp_check_timeout            ; Continue to look for good ones

comp_read_wrong_extend_timeout:
    clr    Flag_Demag_Detected            ; Clear demag detected flag
    anl    EIE1, #7Fh                ; Disable Timer3 interrupts
    mov    TMR3CN0, #00h                ; Timer3 disabled and interrupt flag cleared
    jnb    Flag_High_Rpm, comp_read_wrong_low_rpm    ; Branch if not high rpm

    mov    TMR3L, #0                    ; Set timeout to ~1ms
    mov    TMR3H, #-(8 SHL MCU_48MHZ)

As above description, if a wrong comparator out is got when Flag_Demag_Detected is set,the timeout check time must be reset.So whether the timeout check time of Wt_ZC_Tout_Start is not need,it's can be directly set as the value of what comp_read_wrong_extend_timeout set.

Bluejay version

0.16

ESC variant

ah5

PWM frequency

24

DShot bitrate

150

Bidirectional DShot

Off

FC firmware

4.2.9

Motor size

0802

Configurator debug log

no

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant