-
Notifications
You must be signed in to change notification settings - Fork 952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pico 2 W - FreeRTOS - cyw43_arch_init within Task causes Panic #2101
Comments
SDK is 2.1.0 |
Could you be calling cyw43_arch_init twice? That's the only way I could think that this could happen off the top of my head. I assume it's the cyw43_irq_init call that's causing the problem.
I can't think why this would be different on Pico W. |
Certain this is only calling once at the top of the main thread. |
a stack trace would be helpful |
Stack trace: Thread #1 [rp2350.dap.core0] 1 (Name: rp2350.dap.core0, state: breakpoint) (Suspended : Signal : SIGTRAP:Trace/breakpoint trap) |
So some further debugging on this I can confirm that cyw43_irq_init is being called twice. This is happening somewhere in the cyw43_arch_init code. Trying to get my head around why.... |
This might be related to SMP - does the problem go away if you turn off SMP? |
This is running single core. To confirm I got the config correct the stack trace above shows no functions running on the second core. |
The multiple calls to cyw43_irq_init are from the async_context_task looping. It looks to me like the task is being reset on the queue to need work. the async context: core.when_pending.work_pending on first time through goes from True to False correctly I think. Then the function ulTaskNotifyTake is updating this to be True again. That is either a memory corruption or could another task be updating this. |
It seems odd that I don't see this with the pico-examples. Are you doing anything different to the examples? https://github.com/raspberrypi/pico-examples/blob/master/pico_w/wifi/freertos/iperf/picow_freertos_iperf.c#L103 |
Of course let me post the code and config. It is very odd and I am only calling cyw43_arch_init in my trimmed down test. I am really scratching my head with what is going on. So very grateful for the help. |
I think this is a bug. I'm a bit stumped why it only occurs when configNUMBER_OF_CORES = 1
The following might be the fix.
|
We need to do this to avoid work_pending being set twice. Fixes raspberrypi#2101
Thanks Peter. Nice to know I am not going nuts. I'll try that fix and also perhaps running under SMP. Kind of weird though, I can't work out how the work_pending is being reset. |
I can confirm that the following line fixes the issue Thank you for diagnosing so quickly. Look forward to the official update. |
I'm using Raspberry Pi version of FreeRTOS, current version which was last updated about 3 months ago. Linking: pico_cyw43_arch_lwip_sys_freertos and calling cyw43_arch_init from within a task. I get error as below. Any suggestions?
Error:
assertion "!(raw_irq_mask[get_core_num()] & gpio_mask)" failed: file "/Users/jondurrant/pico/pico-sdk-2.1
.0/src/rp2_common/hardware_gpio/gpio.c", line 222, function: gpio_add_raw_irq_handler_with_order_priority
_masked
This is a migration of code that runs flawlessly on Pico W.
The text was updated successfully, but these errors were encountered: