Skip to content

Add initial board support for nRF54LM20 DK#3574

Merged
hathach merged 8 commits intohathach:masterfrom
gab-k:support-nrf54lm20a
Apr 13, 2026
Merged

Add initial board support for nRF54LM20 DK#3574
hathach merged 8 commits intohathach:masterfrom
gab-k:support-nrf54lm20a

Conversation

@gab-k
Copy link
Copy Markdown
Contributor

@gab-k gab-k commented Mar 27, 2026

The cdc_msc device example works fine. Isochronous OUT transfers hit a babble error (DOEPINT bit 12) on every packet I am not really sure why that is.

The nrfx 3.14 commit which is used in get_deps.py is a little outdated so it predates the renaming done in nrfx 4.1.0 which reads:

Renamed nRF54LM20A Eng A to nRF54LM20A.

in the nrfx changelog

@HiFiPhile
Copy link
Copy Markdown
Collaborator

Hi, are you still working on this ?

@gab-k
Copy link
Copy Markdown
Contributor Author

gab-k commented Apr 4, 2026

No, i was hoping someone could review it, let me know if i missed something.

@HiFiPhile
Copy link
Copy Markdown
Collaborator

Ok, please remove commited submodules.

@hathach hathach force-pushed the support-nrf54lm20a branch from bbca96b to d6db296 Compare April 5, 2026 05:55
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

Size Difference Report

Because TinyUSB code size varies by port and configuration, the metrics below represent the averaged totals across all example builds.

Note: If there is no change, only one value is shown.

Changes >1% in size

No entries.

Changes <1% in size

file .text .rodata .data .bss size % diff
dcd_dwc2.c 4210 ➙ 4237 (+27) 25 ➙ 19 (-6) 0 265 4500 ➙ 4521 (+21) +0.5%
dwc2_common.c 602 ➙ 603 (+1) 30 ➙ 22 (-8) 0 0 618 ➙ 615 (-3) -0.5%
hcd_dwc2.c 4994 ➙ 5007 (+13) 33 ➙ 25 (-8) 1 513 5540 ➙ 5545 (+5) +0.1%
TOTAL 9806 ➙ 9847 (+41) 88 ➙ 66 (-22) 1 778 10658 ➙ 10681 (+23) +0.2%
No changes
file .text .rodata .data .bss size % diff
audio_device.c 2897 0 1260 1627 4518 +0.0%
cdc_device.c 1252 16 1106 684 1935 +0.0%
cdc_host.c 6381 487 15 985 7579 +0.0%
dcd_ch32_usbfs.c 1473 0 0 2444 3917 +0.0%
dcd_ch32_usbhs.c 1469 0 0 448 1917 +0.0%
dcd_ci_fs.c 1925 0 0 1290 3215 +0.0%
dcd_ci_hs.c 1759 0 0 1344 2538 +0.0%
dcd_da146xx.c 3067 0 0 144 3211 +0.0%
dcd_eptri.c 2271 0 0 259 2530 +0.0%
dcd_ft9xx.c 3276 0 0 172 3448 +0.0%
dcd_khci.c 1953 0 0 1290 3243 +0.0%
dcd_lpc17_40.c 1474 0 0 648 1798 +0.0%
dcd_lpc_ip3511.c 1463 0 0 264 1683 +0.0%
dcd_mm32f327x_otg.c 1478 0 0 1290 2768 +0.0%
dcd_msp430x5xx.c 1798 0 0 176 1974 +0.0%
dcd_musb.c 2445 0 0 160 2605 +0.0%
dcd_nrf5x.c 2918 0 0 292 3210 +0.0%
dcd_nuc120.c 1094 0 0 78 1172 +0.0%
dcd_nuc121.c 1168 0 0 101 1269 +0.0%
dcd_nuc505.c 0 0 1531 157 1688 +0.0%
dcd_rp2040.c 838 0 764 655 2257 +0.0%
dcd_rusb2.c 2919 0 0 156 3075 +0.0%
dcd_samd.c 1034 0 0 266 1300 +0.0%
dcd_samg.c 1320 0 0 72 1392 +0.0%
dcd_stm32_fsdev.c 2558 0 0 291 2849 +0.0%
dfu_device.c 777 28 712 140 916 +0.0%
dfu_rt_device.c 157 0 134 0 157 +0.0%
ecm_rndis_device.c 1037 0 1 2858 3896 +0.0%
ehci.c 2763 0 0 6043 7597 +0.0%
fsdev_common.c 180 0 0 0 180 +0.0%
hcd_ch32_usbfs.c 2485 0 0 498 2983 +0.0%
hcd_ci_hs.c 184 0 0 0 184 +0.0%
hcd_khci.c 2442 0 0 449 2891 +0.0%
hcd_musb.c 3073 0 0 157 3230 +0.0%
hcd_pio_usb.c 262 0 240 0 502 +0.0%
hcd_rp2040.c 2000 17 4 321 2342 +0.0%
hcd_rusb2.c 2923 0 0 245 3168 +0.0%
hcd_samd.c 2220 0 0 324 2544 +0.0%
hcd_stm32_fsdev.c 3287 0 1 420 3708 +0.0%
hid_device.c 1125 44 997 119 1244 +0.0%
hid_host.c 1240 0 0 1251 2491 +0.0%
hub.c 1384 8 8 30 1418 +0.0%
midi_device.c 1151 0 1007 623 1772 +0.0%
midi_host.c 1341 7 7 3635 4979 +0.0%
msc_device.c 2525 108 2286 547 3071 +0.0%
msc_host.c 1587 0 0 394 1982 +0.0%
mtp_device.c 1696 22 735 588 2292 +0.0%
ncm_device.c 1538 28 718 5843 7395 +0.0%
ohci.c 1940 0 0 2414 4353 +0.0%
printer_device.c 830 0 706 566 1394 +0.0%
rp2040_usb.c 382 35 625 11 1053 +0.0%
rusb2_common.c 160 0 16 0 176 +0.0%
tusb.c 451 0 383 3 453 +0.0%
tusb_fifo.c 846 0 480 0 841 +0.0%
typec_stm32.c 820 8 2 12 842 +0.0%
usbc.c 420 2 20 166 608 +0.0%
usbd.c 3224 57 88 275 3564 +0.0%
usbd_control.c 538 0 484 79 616 +0.0%
usbh.c 4652 55 99 1034 5807 +0.0%
usbtmc_device.c 2196 24 68 316 2544 +0.0%
vendor_device.c 641 0 534 565 1204 +0.0%
video_device.c 4443 5 1235 479 4914 +0.0%
TOTAL 109150 951 16266 45698 156402 +0.0%

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

MemBrowse Memory Report

Top 10 targets by memory change (%) (out of 2156 targets) View Project Dashboard →

target .text .rodata .data .bss total % diff
adafruit_clue/board_test 6,516 → 8,012 (+1,496) 420 → 556 (+136) 7,664 → 9,296 (+1,632) +21.3%
adafruit_clue/dfu_runtime 10,772 → 12,204 (+1,432) 816 → 952 (+136) 12,596 → 14,164 (+1,568) +12.4%
adafruit_clue/hid_generic_inout 11,912 → 13,344 (+1,432) 1,020 → 1,156 (+136) 13,764 → 15,332 (+1,568) +11.4%
adafruit_clue/hid_multiple_interface 12,532 → 13,964 (+1,432) 896 → 1,032 (+136) 14,436 → 16,004 (+1,568) +10.9%
adafruit_clue/hid_boot_interface 12,588 → 14,020 (+1,432) 896 → 1,032 (+136) 14,444 → 16,012 (+1,568) +10.9%
adafruit_clue/hid_composite 12,620 → 14,052 (+1,432) 884 → 1,020 (+136) 14,608 → 16,176 (+1,568) +10.7%
adafruit_clue/midi_test 12,800 → 14,232 (+1,432) 1,144 → 1,280 (+136) 14,872 → 16,440 (+1,568) +10.5%
raspberrypi_zero/hid_boot_interface 40,732 → 41,304 (+572) 807 → 4,323 (+3,516) 41,539 → 45,627 (+4,088) +9.8%
raspberrypi_zero/hid_multiple_interface 40,564 → 41,136 (+572) 1,011 → 4,527 (+3,516) 41,575 → 45,663 (+4,088) +9.8%
adafruit_clue/printer_to_cdc 13,692 → 15,124 (+1,432) 1,436 → 1,572 (+136) 16,116 → 17,684 (+1,568) +9.7%

@hathach hathach force-pushed the support-nrf54lm20a branch from d6db296 to a39e9cd Compare April 9, 2026 04:09
@gab-k
Copy link
Copy Markdown
Contributor Author

gab-k commented Apr 9, 2026

Thanks for removing submodules would have done it myself as well, just didnt get around to it. Anything else still missing?

Copy link
Copy Markdown
Owner

@hathach hathach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect, thank you. Tested and it works well. I haven't tested with ISO just yet, but I think we could do that with follow-up PR. This is great start for nrf54 series. I update board_uart_read/write(), move the init sequence to dwc2_clock_init() which is run before accessing the dwc2 register, also fix freeRTOS config for secure mode. The speed isn't great for highspeed device, it could be dwc2 not optimized enough, will come back to this later.

nrf54lm20dk                              device/cdc_dual_ports          ...  OK  in 1.5s
nrf54lm20dk                              device/dfu                     ...  OK  in 1.8s
nrf54lm20dk                              device/cdc_msc                 ...  dd read: 1.6 MB/s, write: 1.5 MB/s  OK  in 2.3s
nrf54lm20dk                              device/dfu_runtime             ...  OK  in 1.7s
nrf54lm20dk                              device/cdc_msc_freertos        ...  dd read: 1.2 MB/s, write: 1.2 MB/s  OK  in 2.5s
nrf54lm20dk                              device/hid_boot_interface      ...  OK  in 1.7s
nrf54lm20dk                              device/msc_dual_lun            ...  OK  in 2.9s
nrf54lm20dk                              device/hid_generic_inout       ...  OK  in 2.1s
nrf54lm20dk                              device/printer_to_cdc          ...  OK  in 5.1s
nrf54lm20dk                              device/midi_test               ...  OK  in 5.9s
nrf54lm20dk                              device/mtp                     ...  OK  in 1.8s
nrf54lm20dk                              device/board_test              ...  OK  in 0.6s

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds initial TinyUSB BSP/port support for the Nordic nRF54LM20 DK, including DWC2 (USBHS) bring-up steps and build-system plumbing, plus a small refactor of the DWC2 FIFO sizing configuration to use DFIFO depth (words) instead of byte-sized SRAM constants.

Changes:

  • Refactor DWC2 controller configuration to use otg_dfifo_depth (32-bit words) and call a new dwc2_clock_init() hook before any DWC2 register access.
  • Add nRF54LM20 DK board support (linker script, board definitions, build presets) and nRF54LM20-specific clock/power init for the DWC2 core.
  • Update multiple DWC2 port headers (STM32/ESP32/EFM32/GD32/XMC/AT32/BCM/NRF) to the new FIFO-depth configuration model.

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/portable/synopsys/dwc2/hcd_dwc2.c Switch host DFIFO sizing to otg_dfifo_depth and call dwc2_clock_init() early.
src/portable/synopsys/dwc2/dwc2_xmc.h Update XMC controller config to otg_dfifo_depth; add dwc2_clock_init() stub.
src/portable/synopsys/dwc2/dwc2_type.h Replace ep_fifo_size with otg_dfifo_depth (words) and add a new core rev constant.
src/portable/synopsys/dwc2/dwc2_stm32.h Convert STM32 DWC2 configuration to DFIFO depth model; add dwc2_clock_init() stub.
src/portable/synopsys/dwc2/dwc2_nrf.h Add nRF54LM20-specific USBHS/DWC2 clock+reset+PHY enable sequence; update DFIFO depth.
src/portable/synopsys/dwc2/dwc2_info.py Update/add DWC2 register fingerprints for nRF54LM20 and minor formatting tweaks.
src/portable/synopsys/dwc2/dwc2_gd32.h Update GD32 config to otg_dfifo_depth; add dwc2_clock_init() stub.
src/portable/synopsys/dwc2/dwc2_esp32.h Update ESP32 configs to otg_dfifo_depth; add dwc2_clock_init() stub.
src/portable/synopsys/dwc2/dwc2_efm32.h Update EFM32 config to otg_dfifo_depth; add dwc2_clock_init() stub.
src/portable/synopsys/dwc2/dwc2_common.h Document new required port symbol dwc2_clock_init().
src/portable/synopsys/dwc2/dwc2_bcm.h Update BCM config to otg_dfifo_depth; add dwc2_clock_init() stub.
src/portable/synopsys/dwc2/dwc2_at32.h Update AT32 config to otg_dfifo_depth; add dwc2_clock_init() stub.
src/portable/synopsys/dwc2/dcd_dwc2.c Switch device DFIFO sizing to otg_dfifo_depth and call dwc2_clock_init() early.
src/common/tusb_mcu.h Mark nRF54 as high-speed capable (TUP_RHPORT_HIGHSPEED).
hw/bsp/nrf/nrfx_config/nrfx_config_common.h Enable the correct UARTE instance for nRF54LM20A EngA.
hw/bsp/nrf/linker/nrf54lm20a_enga_xxaa_application.ld Add linker script for nRF54LM20A EngA application build.
hw/bsp/nrf/FreeRTOSConfig/FreeRTOSConfig.h Enable secure-only FreeRTOS CM33 config for nRF54 targets.
hw/bsp/nrf/family.mk Add nRF54LM20A EngA variant handling and adjust nrfx source inclusion.
hw/bsp/nrf/family.cmake Add nRF54LM20A EngA variant handling, linker/startup selection, and nrfx source selection.
hw/bsp/nrf/family.c Add UART20 selection, USBHS IRQ path, UART RX buffering, and nRF54LM20 clock init.
hw/bsp/nrf/boards/nrf54lm20dk/board.mk Define the new board’s MCU variant and flashing configuration.
hw/bsp/nrf/boards/nrf54lm20dk/board.h Provide pin mappings for LED/button/UART for nRF54LM20 DK.
hw/bsp/nrf/boards/nrf54lm20dk/board.cmake Add CMake board config (mirrors existing nRF54H20DK behavior).
hw/bsp/BoardPresets.json Add build presets for the new nrf54lm20dk board.
docs/reference/boards.rst Add nrf54lm20dk to the documented board list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/portable/synopsys/dwc2/dwc2_stm32.h
Comment thread src/portable/synopsys/dwc2/dwc2_stm32.h
Comment thread src/portable/synopsys/dwc2/dcd_dwc2.c
Comment thread src/portable/synopsys/dwc2/dcd_dwc2.c Outdated
Comment thread src/portable/synopsys/dwc2/hcd_dwc2.c
hathach and others added 3 commits April 10, 2026 21:17
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@hathach hathach merged commit 3cfe7a0 into hathach:master Apr 13, 2026
693 of 697 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.

4 participants