[ambd] Add Realtek AmebaD family (RTL8720DN / BW16) - #403
Conversation
044e287 to
fb46bb3
Compare
|
@kuba2k2 ready for review — tested on an Ai-Thinker BW16 (RTL8720DX die): 18 firmware revisions flashed during bring-up, OTA verified in both slot directions (upload → signature switch → reboot → running slot confirmed over serial and the ESPHome native API), FlashDB preferences on the kvs partition, WiFi STA including assoc-reject recovery. CI is green. libretiny-eu/ltchiptool#98 carries the matching flasher support. |
a5b5f97 to
de09dab
Compare
de09dab to
0cef2a6
Compare
256fb93 to
ee94b21
Compare
|
Bench round on the BW16 KIT closed two more hardware gaps, both amended into the single commit (ee94b21):
Verification methodology worth noting: each output pin was jumpered to the (already-proven) PB1 ADC and driven from Home Assistant — every header GPIO shows a clean 3.3/0 V swing, and PWM duty measured by ADC averaging matches the gamma-corrected setpoint within 1 %. Full matrix in the PR body. |
39ce003 to
85c50c6
Compare
|
One more bench finding folded into the commit (85c50c6): the SerialClass indexed UART_DEV_TABLE by the variant port number, but the AmebaD table order is UART0 / UART1-BT / LOGUART / luart — so SERIAL0 (PA7/PA8) must map to index 2 and SERIAL2 (PB1/PB2) to index 3. With the old indexing, SERIAL2 writes landed in the LOGUART registers and PB1 never emitted a byte. The mapping alone is not enough for a working SERIAL2, and the body now documents why: the luart is a KM0-domain peripheral (hal_platform.h calls it the 'KM0 luart'); from KM4 it still needs the LP-domain clock/function enables and a clock-source switch off the low-power oscillator — the reason stock AT firmware serves that UART from the KM0 image. TX measurably stays low after init (probed by jumpering PB1 to the now-working PB3 ADC). Scoped as a known limitation rather than blocking the family. |
85c50c6 to
503d712
Compare
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
503d712 to
d03e5f9
Compare
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Working port running ESPHome on an Ai-Thinker BW16 (RTL8720DX die): family and board definitions, KM4 builder with prebuilt KM0/boot, core API (cpu, device, mem, init, dual-slot OTA by image signature), LOGUART printf and syscalls, Serial driver, fixups, linker scripts, platform docs and status table. Shared realtek-amb core changes gated for AmebaD, plus fixes proven on hardware: WiFi event queue double-free and truncated-copy repairs, power-save re-assert after every association, netif up/default on the static-IP connect path, full-chip watchdog reset instead of KM4-only sys_reset, deauthenticate before rebooting, wifi_set_mib override with 802.11v/k steering participation disabled.
d03e5f9 to
190ee79
Compare
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the LibreTiny realtek-ambd family to the rtl87xx platform and the bw16 board (RTL8720DN), with the corrected variant pin map and the official A0-A2 ADC aliases, and teaches patch_linker.py the AmebaD image layout. The family ships in LibreTiny (libretiny-eu/libretiny#403); until a release carries it, CI exercises config validation only.
Adds the
realtek-ambdfamily (UF2 id0x3379CFE2, reserved in families.json) with the BW16 board. Closes the RTL8720DN part of #1.Approach
framework-realtek-ambd— a GCC-only AmebaD SDK package (based on the pruned OpenRTL8720D tree used by OpenBeken). Currently pinned toBl00d-B0b/framework-realtek-ambd; transfer to libretiny-eu before merge.realtek-ambcore; AmebaD differences are gated withLT_RTL8720D.wifi_connect(): on this SDKwifi_connect_bssid()associates at L2 with a dead data path — the netif never passes traffic (bench: every saved-fast-connect boot came up unreachable, every plain connect worked). AmebaZ keeps its working BSSID path.81958711image signature (OTA2 preferred when valid), not a system-data flag.cores/realtek-ambd/base/api/lt_ota.cimplements the switch with signature-verify-before-invalidate ordering; the active slot's signature is invalidated with a zero-write (FLASH_TxData12BXIP), neverFLASH_EreaseDwordsXIP— the sector backup/erase/rewrite that function performs on the sector holding the active KM0 header hard-faults at runtime (bench-reproduced).Flash layout (4 MB)
Hardware verification (BW16 KIT, RTL8720DX die)
kvspartitionPinmux_Swdoff()before GPIO writes reach the pad (SWD claims them by default)ADC_GetVoltage()- a 3.3 V reference reads 3.26 V; the AmebaZ-namedAD_1..AD_3channels land on pins not bonded out on BW16, and PA27 has no ADC (the TypeC pinout tables claim otherwise)Known limitations
hal_bt_proxy_rtl8720d.cis the reference)UART_DEV_TABLEindex mapping is fixed (SERIAL0/PA7-PA8 is the LOGUART at index 2, SERIAL2 is the luart at index 3 - indexing by port number sent SERIAL2 writes to the LOGUART registers), but the luart is a KM0-domain peripheral and still needs the LP-side clock/function enable and clock-source select from KM4 (it idles on the low-power oscillator); TX stays low after init (verified by ADC probe)BOOT_Reason()- the ROM's latched backup of the BKUP_REG0 reason bits, taken by the boot chain before it clears the live register (bits 16-23, "software backup from BITn" in rtl8721dlp_sysreg.h). Distinguishes software / watchdog / brown-out / deep-sleep wake / power-on; hardware-verified: a software restart reports SW Reboot. Note for future work: the live BKUP registers are shared state with the ROM chain and the running KM0 - app-time access destabilizes WiFi (bench-reproduced three ways); BOOT_Reason() is the sanctioned readTODO(bench)markers: efuse chip-id bytes for RTL8720DN/DM (test unit reports RTL8720DX) and the efuse MAC offset — need an efuse dump to confirmWIFI_EVENT_BEACON_AFTER_DHCPat ~10 Hz while connected; handled silently, follow-up planned with realtek-amb: fix double free and truncated copy of Arduino WiFi event data #401Dependencies
WiFiEvents.cppfixes from realtek-amb: fix double free and truncated copy of Arduino WiFi event data #401 (file content identical); rebasing after realtek-amb: fix double free and truncated copy of Arduino WiFi event data #401 merges drops it from this diff.Open questions (carried over from #402)
framework-realtek-ambd). Would you host it underlibretiny-eu, as with the other Realtek families?project_lpthe expected route, or would a prebuilt ship in the framework package?