Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Error with USB using DualCore #71

Open
pedrorovi opened this issue Oct 18, 2024 · 0 comments
Open

Error with USB using DualCore #71

pedrorovi opened this issue Oct 18, 2024 · 0 comments

Comments

@pedrorovi
Copy link

pedrorovi commented Oct 18, 2024

I have a program using both cores, one for logging some sensors and send/receive data by I2C, and the other to save the data in a SD Card and send by USB.

I have some problems with mutexes and dynamic memory created in some of them. For example, I must create a custom SPI class to use with the library SDFat, because the default SPI of Arduino framework uses a mutex and my program crashes. Now I have a similar problem with the USB. I copy the call stack during debuging to ask for some help.

I didn't use the USB in both cores, just in the second, and it is not using shared data.

If I change the loops between Cores it works. For me that's weird!

Call Stack Core 0

multicore_fifo_push_blocking_inline@0x1001a0e4 (Unknown Source:0)
multicore_fifo_push_blocking@0x1001a0f6 (/multicore_fifo_push_blocking.dbgasm:3)
App::loop@0x10006e72 (/home/pedro/projects/valvometry/rp2040-logger/lib/app/src/app.cpp:262)
setupApp@0x10007226 (/home/pedro/projects/valvometry/rp2040-logger/lib/app/src/app.cpp:346)
main@0x1000726e (/home/pedro/projects/valvometry/rp2040-logger/src/main.cpp:12)

Call Stack Core 1

update_present_time@0x100163d8 (Unknown Source:0)
ticker_read_us@0x1001673e (/ticker_read_us.dbgasm:7)
ticker_read@0x10016754 (/ticker_read.dbgasm:3)
wait_us@0x10017bca (/wait_us.dbgasm:9)
mbed_die@0x10016ea8 (/mbed_die.dbgasm:27)
mbed_halt_system@0x10016fe4 (Unknown Source:0)
mbed_error@0x10017284 (/mbed_error.dbgasm:21)
trap_rtx_error@0x1001387e (Unknown Source:0)
EvrRtxSemaphoreError@0x1001395a (/EvrRtxSemaphoreError.dbgasm:7)
osSemaphoreNew@0x10012adc (/osSemaphoreNew.dbgasm:12)
rtos::Semaphore::constructor(long, unsigned short)@0x10017d54 (Unknown Source:0)
rtos::Semaphore::Semaphore(long)@0x10017d7a (Unknown Source:0)
AsyncOp::wait(rtos::Mutex*, std::chrono::duration<unsigned long, std::ratio<1ll, 1000ll> >)@0x1001497e (Unknown Source:0)
arduino::USBCDC::send@0x1001061c (/home/pedro/.platformio/packages/framework-arduino-mbed/cores/arduino/USB/USBCDC.cpp:371)
arduino::USBSerial::write@0x1000f7de (/home/pedro/.platformio/packages/framework-arduino-mbed/cores/arduino/USB/PluggableUSBSerial.h:263)
arduino::UART::write@0x1000f7de (/home/pedro/.platformio/packages/framework-arduino-mbed/cores/arduino/Serial.cpp:232)
arduino::Print::write@0x10000fd6 (/home/pedro/.platformio/packages/framework-arduino-mbed/cores/arduino/api/Print.h:53)
SerialUSBHal::write@0x10000fd6 (/home/pedro/projects/valvometry/rp2040-logger/.pio/libdeps/pico/SERIAL_HAL_USB/src/serial_usb_hal.cpp:26)
SerialController::write@0x100010b6 (/home/pedro/projects/valvometry/rp2040-logger/.pio/libdeps/pico/SERIAL_CONTROLLER/src/serial_controller.h:18)
App::saveInSd@0x1000711c (/home/pedro/projects/valvometry/rp2040-logger/lib/app/src/app.cpp:210)
App::loop2@0x10007174 (/home/pedro/projects/valvometry/rp2040-logger/lib/app/src/app.cpp:305)

Thanks for your time.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant