edgetx icon indicating copy to clipboard operation
edgetx copied to clipboard

refactor(f4): use generic init system on F4 targets

Open raphaelcoeffic opened this issue 7 months ago • 7 comments

This allows for a huge speed up during the boot process.

Requires #6172 and #6177.

raphaelcoeffic avatar May 02 '25 06:05 raphaelcoeffic

  • T15 :white_check_mark:
  • TX16S :white_check_mark:
  • V16 :white_check_mark:

@richardclli Can you check this on the NB4+/EL18/PL18... doesn't seem to be working for me? Both main firmware and bootloader seem to be getting stuck. Thankful for the hard reset button on some of them so I don't need to disassemble the radio to pull the batteries!

pfeerick avatar May 30 '25 11:05 pfeerick

  • T15 ✅

    • TX16S ✅

    • V16 ✅

@richardclli Can you check this on the NB4+/EL18/PL18... doesn't seem to be working for me? Both main firmware and bootloader seem to be getting stuck. Thankful for the hard reset button on some of them so I don't need to disassemble the radio to pull the batteries!

I will check it out when I have time. No need to merge it in rush.

richardclli avatar May 31 '25 07:05 richardclli

Not working for Flysky targets, something is missing, I think I can try to fix this.

richardclli avatar Jun 03 '25 03:06 richardclli

Tested:

  • PL18EV :heavy_check_mark:
  • PL18U :heavy_check_mark:
  • NB4P :heavy_check_mark:
  • EL18 :x:
  • NV14 :x:

@raphaelcoeffic Not sure why el18 and nv14 not start up, if only flash only the firmware (aka bootloader is 2.11.1) it seems ok, but together with the bootloader, it will not start up.

richardclli avatar Jun 03 '25 06:06 richardclli

@raphaelcoeffic Not sure why el18 and nv14 not start up, if only flash only the firmware (aka bootloader is 2.11.1) it seems ok, but together with the bootloader, it will not start up.

Did you hook them to SWD? This is probably the only way to find out.

raphaelcoeffic avatar Jun 03 '25 06:06 raphaelcoeffic

@raphaelcoeffic EL18 and NV14 works now. However, I found that the delaysInit() is called quite a lot of times in the boot sequence. Not sure if it need some cleanup.

The problem in EL18 and NV14 boot is due to the delay used in PCBREV detection, and since you cleaned up the SDRAM init without delays, the delay is used before init and it hangs.

Now I just put the init before using the delay to make it work, but I think the delaysInit() should be called before boardBLEarlyInit() and remove all other calls in the code, what do you think?

richardclli avatar Jun 04 '25 03:06 richardclli

@raphaelcoeffic Now that the minor detail of Flysky targets,ya know, not booting has been resolved (thanks Richard!), only outstanding issue here before merge looks to be the question above ;)

pfeerick avatar Jun 17 '25 04:06 pfeerick

Now I just put the init before using the delay to make it work, but I think the delaysInit() should be called before boardBLEarlyInit() and remove all other calls in the code, what do you think?

The "delays" function are fairly low level things which should actually not be used unless really needed, and only when the system is not initialised yet. You should not assume that anything is actually initialised yet at all. So if your low-level / early-init code needs anything, it's better to ensure it is actually usable rather than relying on someone having done that for you earlier in the process.

Mid- to long term, I'd like to get rid of these delays as much as possible. By the way, could you have a look at the SDRAM init for ST16? I have the feeling the only delay there is actually not needed (I might be wrong on that one).

raphaelcoeffic avatar Jul 18 '25 06:07 raphaelcoeffic

Just ran through TX16, T15, EL18, T20 & X9D+2019 again... all booting and seem to be working still. Since the delays "issue" looks to require more work, lets do that in another PR.

Just to put the changes in this PR into context... this is the T15, nightly on the left, this PR on the right, with the exact same splash screen delay/startup time settings. One is faster than the other :hand_over_mouth:

https://youtu.be/koGkYjoldOc

pfeerick avatar Jul 23 '25 22:07 pfeerick