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

Initialize uart first, then enable interrupt #213

Merged
merged 3 commits into from
Aug 21, 2024

Conversation

ligenxxxx
Copy link
Member

@ligenxxxx ligenxxxx commented Aug 9, 2024

This PR is used to solve the OSD freeze problem after VTX is powered on.

  • Cause:

    • The initial baud rate of VTX is 230400 and that of FC is 115200.
    • After power-on, CPU_init() will initialize the uart to 115200 and immediately enable interrupt.
    • VTX executes Init_HW(). During this period, the serial port receives some msp packages (115200) from FC.
    • VTX sets the baud rate to 230400(eeprom saved) at the end of Init_HW().
    • VTX enters the while(1) loop and parses the complete msp package, mistakenly thinking that the baud rate of FC is 230400.
    • After that, VTX can no longer receive the correct msp package due to the baud rate mismatch.
  • Solution:

    • Do not enable interrupts during CPU_init().
    • Initialize the uart bardate(eepram saved) earlier to avoid losing data. Then enable interrupt.

@sugaarK
Copy link

sugaarK commented Aug 9, 2024

tested on brand new whoop lite that was having issue that only increasing the uarts baud rate to 230400

this pr totally fixes the issue

@nerdCopter
Copy link

nerdCopter commented Aug 15, 2024

does this fix the broken layout or something else?

i.e. this or no?
image

@sugaarK
Copy link

sugaarK commented Aug 15, 2024

does this fix the broken layout or something else?

i.e. this or no? image

It’s more than a broken logo the baud rate for msp ain’t correct

@ligenxxxx
Copy link
Member Author

does this fix the broken layout or something else?

i.e. this or no? image

If you cannot enter the vtx menu, this may be a compatibility issue between the VTX uart and the FC uart, or the VTX uart tx may be damaged.
You can try other types of FC or other uarts connected to the FC.

@ligenxxxx ligenxxxx merged commit 88e24fa into hd-zero:main Aug 21, 2024
11 checks passed
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

Successfully merging this pull request may close these issues.

3 participants