From ea885d5c83c5052930e2515b259e29c165569432 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 11 Dec 2023 17:48:27 +0700 Subject: [PATCH 1/4] reduce s3 baudrate to prevent usb isssue, reset rp2040 usb for board test example --- hw/bsp/rp2040/family.c | 6 ++++++ test/hil/hil_pi4.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/bsp/rp2040/family.c b/hw/bsp/rp2040/family.c index aa9d00c23..5facd271f 100644 --- a/hw/bsp/rp2040/family.c +++ b/hw/bsp/rp2040/family.c @@ -166,6 +166,12 @@ void board_init(void) #if CFG_TUH_ENABLED // set portfunc to host !!! #endif + +#if !CFG_TUD_ENABLED && !CFG_TUH_ENABLED + // board test exxample, reset usb controller + reset_block(RESETS_RESET_USBCTRL_BITS); + unreset_block_wait(RESETS_RESET_USBCTRL_BITS); +#endif } //--------------------------------------------------------------------+ diff --git a/test/hil/hil_pi4.json b/test/hil/hil_pi4.json index e9a6721ea..fd2c5c432 100644 --- a/test/hil/hil_pi4.json +++ b/test/hil/hil_pi4.json @@ -15,7 +15,7 @@ ], "flasher": "esptool", "flasher_sn": "461cb8d7decdeb119be9b506e93fd3f1", - "flasher_args": "-b 1500000" + "flasher_args": "-b 921600" } ] } From b67855468d943c5e107ba0d8c081570a22e90cc3 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 11 Dec 2023 17:56:10 +0700 Subject: [PATCH 2/4] fix build --- hw/bsp/rp2040/family.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/bsp/rp2040/family.c b/hw/bsp/rp2040/family.c index 5facd271f..5ac104688 100644 --- a/hw/bsp/rp2040/family.c +++ b/hw/bsp/rp2040/family.c @@ -30,6 +30,7 @@ #include "pico/unique_id.h" #include "hardware/gpio.h" #include "hardware/sync.h" +#include "hardware/resets.h" #include "hardware/structs/ioqspi.h" #include "hardware/structs/sio.h" From aa9dce09a17ac80c8d92a9d757378b7d89cf1e1c Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 11 Dec 2023 20:37:09 +0700 Subject: [PATCH 3/4] change baudrate back to 1.5MB --- test/hil/hil_pi4.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/hil/hil_pi4.json b/test/hil/hil_pi4.json index fd2c5c432..e9a6721ea 100644 --- a/test/hil/hil_pi4.json +++ b/test/hil/hil_pi4.json @@ -15,7 +15,7 @@ ], "flasher": "esptool", "flasher_sn": "461cb8d7decdeb119be9b506e93fd3f1", - "flasher_args": "-b 921600" + "flasher_args": "-b 1500000" } ] } From bd1009e135239cfd8be83fb220a241a4a1d87abd Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 11 Dec 2023 20:43:59 +0700 Subject: [PATCH 4/4] tweak openocd flash command --- test/hil/hil_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/hil/hil_test.py b/test/hil/hil_test.py index 9cb009264..8f8a3aa65 100644 --- a/test/hil/hil_test.py +++ b/test/hil/hil_test.py @@ -115,7 +115,7 @@ def flash_jlink(board, firmware): def flash_openocd(board, firmware): ret = subprocess.run( - f'openocd -c "adapter serial {board["flasher_sn"]}" {board["flasher_args"]} -c "program {firmware} reset exit"', + f'openocd -c "adapter serial {board["flasher_sn"]}" {board["flasher_args"]} -c "program {firmware}" -c "reset init" -c "resume" -c "exit"', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) return ret