Skip to content

Confirm V5.5 (YST-DXT-J20) compatibility, modern flashing docs, ADC auto-calibration - #3

Open
Teuflor wants to merge 7 commits into
HayWo:masterfrom
Teuflor:master
Open

Confirm V5.5 (YST-DXT-J20) compatibility, modern flashing docs, ADC auto-calibration#3
Teuflor wants to merge 7 commits into
HayWo:masterfrom
Teuflor:master

Conversation

@Teuflor

@Teuflor Teuflor commented Jul 23, 2026

Copy link
Copy Markdown

Summary

Brought up a board labeled V5.5 (silkscreen: YST-DXT-J20 V5.5, from a
Bluewheel offroad hoverboard) and documented everything found along the way,
plus one small opt-in feature.

  • Confirmed V5.5 compatibility by reading the chip ID over SWD (not by
    assuming from the label) — it's the same AT32F413RCT7 this repo targets.
    See docs/V5.5-mainboard-notes.md.
  • docs/FLASHING_GUIDE.md: a from-scratch flashing walkthrough using a
    current OpenOCD (0.12.0+) with its native Artery driver — no more need for
    the old patched-stm32f2x workaround.
  • tools/at32f413_fap_disable.cfg: a workaround for a driver bug where
    the official artery fap disable OpenOCD command times out on this chip
    (waits 5ms instead of ~500ms+ for the USD erase to finish). Root-caused
    against openocd's actual artery.c source.
  • Inc/config.h / Src/main.c: opt-in ADC_AUTO_CALIBRATION for
    CONTROL_ADC_JOYSTICK — hold the power-button jumper 3s at boot to learn
    ADC min/center/max by moving the potis, persisted to the last flash page.
    No behavior change when the flag is off (default).
  • README: fixed a stale clone URL, moved the old flashing workaround into
    a collapsed fallback section, added a German translation
    (README.de.md), and documented that the power-button jumper is only
    needed for the very first unlock of a still-protected chip (confirmed
    across several sessions — not needed for any flash after that).
  • GCC 10+ -fcommon fix for the rtP multiple-definition linker error
    (tentative vs. real definition, -fno-common became GCC's default in
    GCC 10).

Also found and cross-referenced an independent report
(#230)
of the same factory-enabled Flash Access Protection on another
YST-DXT-J20 board, for anyone who finds this board family confusing.

Test plan

  • Builds cleanly with current arm-none-eabi-gcc (14.2.1), both with and
    without ADC_AUTO_CALIBRATION
  • Chip identified via SWD as AT32F413RCT7 on real V5.5 hardware
  • FAP disabled via the included workaround script on real hardware
  • Firmware flashed and verified OK (program ... verify reset exit) on
    real hardware, multiple times across sessions
  • ADC_AUTO_CALIBRATION builds and flashes; full end-to-end test (motors
    attached, calibration gesture, verifying motor response) still pending
    on my end — no motors currently connected to this board

Teuflor added 7 commits July 23, 2026 09:22
…+ fix

- Add docs/V5.5-mainboard-notes.md: SWD chip-ID confirmation that V5.5
  boards use the same AT32F413RCT7 controller, factory-enabled Flash Access
  Protection (FAP) behavior, wiring gotchas (V3.3 sense line, no physical
  power button), and the GCC 14 -fcommon note.
- Add docs/FLASHING_GUIDE.md: from-scratch flashing walkthrough using a
  modern OpenOCD (0.12.0+) with the native Artery driver, plus a
  troubleshooting table.
- Add tools/at32f413_fap_disable.cfg: OpenOCD script working around a
  driver bug where `artery fap disable` uses a 5ms timeout for the USD
  erase step instead of the correct ~500ms, causing it to reliably fail on
  this chip.
- README: link the new docs, note GCC 10+ needs -fcommon (already applied
  in the Makefile).
Ported the idea (not the code, different HAL/flash driver on this chip)
from EFeru's hoverboard-firmware-hack-FOC VARIANT_ADC auto-calibration,
scoped down to a single feature rather than its full input-abstraction
system: hold the power-button jumper for 3s at boot to enter calibration,
move both potentiometers through their range within 15s, and the learned
min/center/max values are written to the last flash page and used from
then on (falling back to the config.h ADC1/2_MIN/CENTER/MAX defaults
until the first successful calibration).

Opt-in via ADC_AUTO_CALIBRATION in config.h (enabled here, since this is
this board's actual control mode). No change in behavior when disabled.
…lash

Wiring GND/SWDIO/SWCLK only, exactly as the README instructed, made OpenOCD
fail at the very first connection attempt (STLINK_JTAG_GET_IDCODE_ERROR) —
it never got far enough to even read the chip ID, let alone flash. V3.3
still needs to be connected so the ST-Link has a logic-level reference for
SWDIO/SWCLK; the existing "don't power from the programmer's 3.3V" warning
is about current sourcing, not about leaving this pin disconnected entirely.
- Fix clone URL (was pointing at an unrelated "someone42" repo, leftover
  from further upstream)
- Move the old stm32f2x-driver-patch flashing instructions into a collapsed
  "only if your OpenOCD lacks Artery support" section, with
  docs/FLASHING_GUIDE.md as the primary path
- Add a short Documentation section linking the two docs/ files up top
- Mention ADC_AUTO_CALIBRATION in the ADC troubleshooting note
- Misc: dedupe repeated warnings, minor copyedits, consistent V5.1/V5.5 wording
- README.de.md: full German translation, cross-linked with README.md
- Confirmed across several sessions that the power-button jumper only
  matters for the very first unlock of a still-protected chip — every
  flash after that works with just battery + ST-Link, no need to touch
  the jumper. Documented in README (both languages), FLASHING_GUIDE.md,
  and V5.5-mainboard-notes.md.
Board silkscreen confirms "YST-DXT-J20 V5.5" - a board family used across
multiple hoverboard brands (not Bluewheel-specific), seen across several
hoverboard-firmware-hack forks' issue trackers with different chips
depending on batch (AT32F403RCT6, AT32F413RCT7, GD32F103RCT6). Found an
independent report of the same factory-enabled FAP issue on a YST-DXT-J20
V5.7 board, corroborating this isn't a one-off.

Also noted visible connectors from a reference photo (SW likely = power
button, BAT-, motor phase color labels) and left the mystery ~1.2V 2-pin
connector as an open question pending physical identification.
…Init

Replace the old unframed 4-byte struct DMA-overlay (any dropped/extra byte
permanently desyncs the stream forever) with the same framing EFeru's
hoverboard-firmware-hack-FOC and its "hoverSerial.ino" reference sketch
use: 2-byte start marker + steer + speed + XOR checksum, validated against
a circular DMA buffer (byte-count-since-last-check must exactly match one
packet, mirroring their usart2_rx_check() design) rather than a dedicated
IDLE-line interrupt, so it's called once per main loop iteration instead -
same correctness, no new interrupt wiring needed. A malformed/corrupted
packet is silently dropped and the previous steer/speed values are kept.

While test-building this under CONTROL_SERIAL_USART2 (never done before on
this AT32 fork), found that UART_Control_Init() in setup.c is unrelated
pre-existing dead code: it uses STM32-HAL-style calls (HAL_UART_Init,
GPIO_InitTypeDef, ...) that don't exist in this fork's SPL-style AT32
driver, so it has never actually compiled since this port was created.
Flagged clearly in config.h - the new protocol code is ready and compiles
fine standalone, but is unreachable until that init function is rewritten
(RX pin + RX DMA channel, following the working DEBUG_SERIAL_USART2
pattern in the same file) and verified on real hardware. Left unfixed for
now: no UART source or motors at hand to test against, and getting
low-level peripheral/DMA config wrong silently is a real risk not worth
taking blind.

Does not affect the currently active CONTROL_ADC_JOYSTICK config - builds
clean, only +4 bytes (the Serialcommand struct grew by two uint16_t fields
regardless of which input mode is active).
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.

1 participant