Closed HouseSimOn closed 5 months ago
I debug pico-w all the time with a debug probe. I can't imagine how/why that call would cause a problem for the debugger.
Cannot reproduce. I ran your code via the debugger and nothing "reset"
You used DebugProbe, I'm using PicoProbe (the latest version: https://github.com/raspberrypi/picoprobe/releases/tag/picoprobe-cmsis-v1.0.3). Do you have possibility to test it using Pico as PicoProbe?
Have you added set USE_CORE 0
to the target/rp2040.cfg
file?
Have you used my launch.json
file to test it?
I'm on macOs M2 so I can't install gdb
. I use arm-none-eabi-gdb
.
{
"version": "0.2.0",
"configurations": [
{
"name": "Pico Debug",
"cwd": "${workspaceRoot}",
"executable": "${command:cmake.launchTargetPath}",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
// This may need to be "arm-none-eabi-gdb" for some previous builds
"gdbPath" : "arm-none-eabi-gdb",
"device": "RP2040",
"configFiles": [
// This may need to be "interface/picoprobe.cfg" for some previous builds
"interface/cmsis-dap.cfg",
"target/rp2040.cfg"
],
"svdFile": "./Sdk/pico-sdk/src/rp2040/hardware_regs/rp2040.svd",
"runToEntryPoint": "main",
// Work around for stopping at main on restart
"postRestartCommands": [
"break main",
"continue"
],
"liveWatch": {
"enabled": true,
"samplesPerSecond": 1
},
"openOCDLaunchCommands": [
"adapter speed 5000"
]
}
]
}
I used linux I don't have a mac. Yes I used a Pico to do a debug. I suggest you ask on the forum, maybe they'll have better luck guessing what you're doing wrong.
@peterharperuk I've performed test on Ubuntu 22.04.3 LTS. I've used gdb-multiarch
so I had to change one line in launch.json
to:
"gdbPath" : "gdb-multiarch"
I've also added set USE_CORE 0
to the target/rp2040.cfg
file. And there is the same problem as on macOS. Reset after cyw43_arch_enable_ap_mode
call. Everything work ok when this line is commented out.
Questions:
set USE_CORE 0
to the target/rp2040.cfg
file?openocd
or from this repo: https://github.com/raspberrypi/openocd.git?openocd
, gdb-multiarch
or use arm-none-eabi-gdb
, I've created post on forum: https://forums.raspberrypi.com/viewtopic.php?t=361958 as you suggested.
Why are you setting USE_CORE? Does it work without that?
See this issue: https://github.com/raspberrypi/picoprobe/issues/45
I had to setup USE_CORE because sleep_ms
function doesn't work in debug - or maybe I mixed something?
Based on the comments in https://github.com/raspberrypi/picoprobe/issues/45#issuecomment-1332610961 (and having a quick search in the RP2040 datasheet) I guess setting TIMER: DBGPAUSE.DBG1
to 0
(in your code) might be an alternative to telling OpenOCD to only use core 0?
(see https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2040/hardware_regs/include/hardware/regs/timer.h#L157 and https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2040/hardware_structs/include/hardware/structs/timer.h#L63 )
@lurch Adding timer_hw->dbgpause = 0;
to the code doesn't help, but it's true that it helps with sleep_ms
issue. In this case we don't have to modify target/rp2040.cfg
file.
I connected PicoProbe with PicoW as on the picture below (source: https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf):
I solved issue when I connected to the PicoW board USB cable (and disconnected VSYS between boards). It looks like there is no enough power on VSYS pin to power PicoW when AP/STA mode starts (any current-peak?). I have to investigate it. But maybe this information should be added to the Picoprobe wiring subsection in Getting started with Raspberry Pi Pico document?
I couldn't seem to reproduce this. I had the usb connected to the pico debugger which is powering the pico_w as shown above. I could connect to wifi just fine when debugging.
Description
Last time I decided to try use PicoProbe to have a debugger. I'm using Pico as PicoProbe connected to a PicoW. After some troubles (for example with
sleep_ms
function in debug https://github.com/raspberrypi/picoprobe/issues/45) it works. Then I decided to load simple example with cyw43 driver to setup AP or to set STA mode. Unfortunately, call of thecyw43_arch_enable_ap_mode
orcyw43_arch_enable_sta_mode
functions cause reset of the Pico and debug session is interrupted. Program loaded to the PicoW without debugger works.First I've used
pico_cyw43_arch_lwip_threadsafe_background
but I thought that maybe multi-core under debug is a problem but no...pico_cyw43_arch_lwip_poll
also fails.Reproduce
You can find my test example here: https://github.com/HouseSimOn/PicoSdkStartTemplate/blob/test/cyw43debug/Source/main.c - It's ready to compile and test.
Output
Debug session
cyw43_arch_enable_ap_mode("MyAPTest", "12345678", CYW43_AUTH_WPA2_AES_PSK);
is called:cyw43_arch_enable_ap_mode
is commented out:No debug
cyw43_arch_enable_ap_mode("MyAPTest", "12345678", CYW43_AUTH_WPA2_AES_PSK);
is called - it works as expected. AP is created.