andreika-git / hellen-one

Hellen-One Hardware Platform for rusEFI Engine Management System
21 stars 28 forks source link

inconsistent DFU #79

Closed rusefillc closed 3 years ago

rusefillc commented 3 years ago

We have reports of two or three kinds of Hellen boards failing to reboot into DFU via "reboot_dfu" command

Same reboot to DFU procedure could be initiated by rusEFI console using "Program" button while "Automatic DFU" is selected

This issue is NOT about "reset" or "PROD" button, the scope of this issue is ONLY software-based reboot to DFU

Steps to reproduce: 1) have a Hellen board with 407 chip 2) have Hellen board with 407 blink blue LED 3) connect via USB 4) hit "automatic DFU" in rusEFI console

expected result: DFU process starts

actual result: board reboots into normal operation

BeerMoneyMotorsports commented 3 years ago

Auto DFU tests USB power only.
-3 boards selected with different chips and build dates. Each board was power cycled and tested 5 times for Automatic DFU functionality.

H72c w/F429- Pass-5 Fail- 0 H64a w/F407- Pass-0 Fail- 5 H64b w/f407- Pass-1 Fail- 4

image

BeerMoneyMotorsports commented 3 years ago

H72c 44E61158-3E2E-489E-A862-68E442BA196B

H64a 804E2C99-916D-4B13-805A-3563D00B196A

H64b 5E097665-61C8-412F-9E22-09F75DF5B98F

rusefillc commented 3 years ago

IMG_20210711_185521

not hellen with old 407 SW dfu jump works!

that's inconclusive

i also have 2nd 176 407 from same pack of samples

that opens many possibilities but i would compare designs arounds caps etc before we go swapping parts

maybe up some caps?

@dron0gus

mck1117 commented 3 years ago

With the PROG button held (ie, MCU always enters system ROM at reset), the reset line is triggering every exactly 1 second, so something is triggering a hardware reset after ~1 second

Reset is low, not reset is high:

SDS00044

The large period at the left is me pressing the physical reset button, then the ~1 second spaced blips are the MCU resetting itself (internal resets are implemented on the STM32 by physically pulling the nRST pin low internally with a transistor).

mck1117 commented 3 years ago

image

mck1117 commented 3 years ago

When attaching a debugger to a completely blank chip when boot looping the bootloader, it says the software reset bit is set in RCC register CSR.

image

mck1117 commented 3 years ago

Here are an old MRE (f407), f4 disco, and hellen probed at the OSCOUT (PH1) pin:

hellen:

SDS00046

microRusEfi:

SDS00045

F4 discovery:

SDS00047

rusefillc commented 3 years ago

OMG

Image from iOS (4)

rusefillc commented 3 years ago
I replaced $0.2 part with a "crystal and caps" that is guaranteed to oscillate well within the allotted time (edited) 
the bootloader waits 800us for the clock to start
if the clock doesn't start in 800us, it triggers a system reset
our clock is locking in ~900us or so
mck1117 commented 3 years ago

The above photo is injecting an 8mhz sine wave in to the OSC_IN pin - so that we can guarantee the "crystal" will have locked

mck1117 commented 3 years ago

Evidently the F42x bootloader waits longer, because on a random proteus board it takes even longer, but the bootloader still works perfectly

mck1117 commented 3 years ago

With the F407 discovery's oscillator transplanted on to the hellen121a PCB:

image

SDS00049

...and of course DFU works perfectly, both with the button and software reset.

andreika-git commented 3 years ago

There are some JLC drop-in alternatives to consider:

andreika-git commented 3 years ago

Here's a similar topic already discussed: https://community.st.com/s/question/0D53W000004lc5NSAQ/dfu-over-usb-not-working-hse-not-detected

mck1117 commented 3 years ago

This will add support for alternate crystal speeds without different firmware: https://github.com/rusefi/rusefi/pull/2952

rusefillc commented 3 years ago

Also there are some JLC drop-in alternatives to consider: C122522 C172361 C111120 C90881

You may also try fitting 3225-2pin package on 5032 footprint

NX3225GD-8MHZ-STD-CRA-3

higher freq crystals require less drive and are physically smaller, so should be able to start faster

rusefillc commented 3 years ago

520-200-12-30-AEM-TR

rusefillc commented 3 years ago

Maybe this is linked to the embedded bootloader version:

V3 on STM32F407 and STM32F401 V7 on STM32F427 V9 on STM32F446

Check AN2606 for details

https://www.st.com/resource/en/application_note/cd00167594-stm32-microcontroller-system-memory-boot-mode-stmicroelectronics.pdf

rusefillc commented 3 years ago

digikey stuff in stock

H130A-8.000-8-2030-TR‎ 8 MHz ‎2845-WTL5G60390VH-ND‎ 8 MHz 535-9105-1-ND (20 MHz ESR 30 Ohm) CTX1436CT-ND (16 MHz, ESR 40 Ohm) 644-1037-1-ND (16 MHz, ESR 120 Ohm)

mck1117 commented 3 years ago

Ordered a stack of 16 and 20MHz options from digikey, will test soon on 121vw

rusefillc commented 3 years ago

@BeerMoneyMotorsports please order qty 20 of

ABM3-20.000MHZ-B2-T 535-9105-1-ND 20 MHz ESR 30 Ohm

I believe that we have major improvement in Hellen72 rev D behavior

rusefillc commented 3 years ago

@mck1117 says that 20MHz crystal ABM3-20.000MHZ-B2-T starts in ~250us

looks like minimal fix for Hellen MCU is to jump from 8MHz to 20MHz and move on?

@andreika-git @mck1117