Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3915

SDK • TinyUSB and Core1 Problem

$
0
0
I have some code that ran fine when I used the SDK USB stdio. I then changed to TinyUSB and found that I had lockups when the code called functions that used timers. Thinking this was some error in the way I bolted TinyUSB onto my code I started with a solid TinyUSB example and bolted my code to that. I've ended up with the same problem. A stack trace of the two cores is here:

Code:

Thread 1 "rp2040.core0" received signal SIGINT, Interrupt.0x10005320 in timer_time_us_64 (timer=0x40054000) at /home/menadue/pico/pico-sdk/src/rp2_common/hardware_timer/timer.c:6969              if (hi == next_hi) break;(gdb) bt#0  0x10005320 in timer_time_us_64 (timer=0x40054000)    at /home/menadue/pico/pico-sdk/src/rp2_common/hardware_timer/timer.c:69#1  time_us_64 () at /home/menadue/pico/pico-sdk/src/rp2_common/hardware_timer/timer.c:126#2  0x10003086 in menu_loop_tasks () at /home/menadue/tree/github/psion-organiser-recreate-c/basic/menu.c:154#3  0x10000fee in ed_epos (str=str@entry=0x20041e70 "F", len=len@entry=64,     single_nmulti_line=single_nmulti_line@entry=0, exit_on_mode=exit_on_mode@entry=0)    at /home/menadue/tree/github/psion-organiser-recreate-c/basic/svc_ed.c:160#4  0x10002ec2 in menu_fl_find () at /home/menadue/tree/github/psion-organiser-recreate-c/basic/menu.c:785#5  0x100038e6 in menu_process () at /home/menadue/tree/github/psion-organiser-recreate-c/basic/menu.c:221#6  menu_process () at /home/menadue/tree/github/psion-organiser-recreate-c/basic/menu.c:186#7  0x10003976 in menu_loop () at /home/menadue/tree/github/psion-organiser-recreate-c/basic/menu.c:1301#8  0x10000650 in main () at /home/menadue/tree/github/psion-organiser-recreate-c/basic/main.c:291(gdb) thr 2[Switching to thread 2 (Thread 2)]#0  alarm_pool_cancel_alarm (pool=0x20002928 <default_alarm_pool>, alarm_id=984940)    at /home/menadue/pico/pico-sdk/src/common/pico_time/time.c:6767          return (int16_t)(id >> 16);(gdb) bt#0  alarm_pool_cancel_alarm (pool=0x20002928 <default_alarm_pool>, alarm_id=984940)    at /home/menadue/pico/pico-sdk/src/common/pico_time/time.c:67#1  0x100052c2 in cancel_alarm (alarm_id=<optimised out>)    at /home/menadue/pico/pico-sdk/src/common/pico_time/time.c:102#2  best_effort_wfe_or_timeout (timeout_timestamp=<optimised out>)    at /home/menadue/pico/pico-sdk/src/common/pico_time/time.c:460#3  0x20000874 in mutex_enter_block_until (until=4294970192830, mtx=0x20004508 <_ubsd_mutexdef>)    at /home/menadue/pico/pico-sdk/src/common/pico_sync/mutex.c:175#4  mutex_enter_timeout_ms (mtx=mtx@entry=0x20004508 <_ubsd_mutexdef>, timeout_ms=timeout_ms@entry=4294967295)    at /home/menadue/pico/pico-sdk/src/common/pico_sync/mutex.c:145#5  0x1000a630 in osal_mutex_lock (msec=4294967295, mutex_hdl=0x20004508 <_ubsd_mutexdef>)    at /home/menadue/pico/pico-sdk/lib/tinyusb/src/osal/osal_pico.h:92#6  tu_edpt_claim (ep_state=0x20004589 <_usbd_dev+57>, mutex=0x20004508 <_ubsd_mutexdef>)    at /home/menadue/pico/pico-sdk/lib/tinyusb/src/tusb.c:111#7  0x10009b90 in usbd_edpt_claim (rhport=rhport@entry=0 '\000', ep_addr=<optimised out>)    at /home/menadue/pico/pico-sdk/lib/tinyusb/src/device/usbd.c:1293#8  0x10009fc2 in tud_cdc_n_write_flush (itf=itf@entry=0 '\000')    at /home/menadue/pico/pico-sdk/lib/tinyusb/src/class/cdc/cdc_device.c:199#9  0x10008d72 in tud_cdc_write_flush () at /home/menadue/pico/pico-sdk/lib/tinyusb/src/class/cdc/cdc_device.h:176#10 stdio_usb_out_chars (length=41, buf=0x20040ec9 "Ped:", '0' <repeats 16 times>, " Red:0000000020000000")    at /home/menadue/pico/pico-sdk/src/rp2_common/pico_stdio_usb/stdio_usb.c:114#11 stdio_usb_out_chars (buf=0x20040ec9 "Ped:", '0' <repeats 16 times>, " Red:0000000020000000", length=41)    at /home/menadue/pico/pico-sdk/src/rp2_common/pico_stdio_usb/stdio_usb.c:101#12 0x10008786 in stdio_out_chars_crlf (len=<optimised out>, s=<optimised out>, driver=<optimised out>)    at /home/menadue/pico/pico-sdk/src/rp2_common/pico_stdio/stdio.c:82#13 stdio_out_chars_crlf (driver=0x20002960 <stdio_usb>,     s=0x20040ec8 "\nPed:", '0' <repeats 16 times>, " Red:0000000020000000", len=42)    at /home/menadue/pico/pico-sdk/src/rp2_common/pico_stdio/stdio.c:63#14 0x10008bd8 in stdio_stack_buffer_flush (buffer=0x20040ec4)    at /home/menadue/pico/pico-sdk/src/rp2_common/pico_stdio/stdio.c:185#15 stdio_stack_buffer_flush (buffer=0x20040ec4)    at /home/menadue/pico/pico-sdk/src/rp2_common/pico_stdio/stdio.c:180#16 __wrap_vprintf (format=<optimised out>, va=...)    at /home/menadue/pico/pico-sdk/src/rp2_common/pico_stdio/stdio.c:329#17 0x10008c24 in __wrap_printf (format=0x10014794 "\nPed:%016llX Red:%016llX")    at /home/menadue/pico/pico-sdk/src/rp2_common/pico_stdio/stdio.c:350#18 0x20000460 in matrix_debounce (matrix=<optimised out>)    at /home/menadue/tree/github/psion-organiser-recreate-c/basic/svc_kb.c:381#19 0x2000072c in matrix_scan () at /home/menadue/tree/github/psion-organiser-recreate-c/basic/svc_kb.c:609#20 0x200001a8 in core1_code () at /home/menadue/tree/github/psion-organiser-recreate-c/basic/core1.c:81#21 0x1000ac2a in core1_wrapper (entry=0x2000016d <core1_code>, stack_base=<optimised out>)    at /home/menadue/pico/pico-sdk/src/rp2_common/pico_multicore/multicore.c:97#22 0x00000172 in ?? ()
I'm currently removing all calls in core 1 to anything that locks up, as I don't have much running on core1, just a keyboard scanner. This is tedious, though, and I'd rather not do it, and I'd also like to know what is wrong.

Statistics: Posted by amenjet — Fri Sep 20, 2024 7:10 am



Viewing all articles
Browse latest Browse all 3915

Trending Articles