thread blocked by chprintf
Posted: Wed Jun 08, 2016 12:33 pm
Hello forum.
This is my first post to this forum, hope this questions will be useful to someone else...
My STM32F0 board has a magnetometer/accelerometer sensor connected. I'm using a Chibios static thread to read sensor information every 20ms and write it to a Linux host, using the USB-CDC serial driver (/dev/ttyACM0).
To debug I am using a blinking led inside the thread, and "chprintf" syscall to write the information from Chibios to Linux side:
chprintf((BaseSequentialStream *)&SDU1,
"%d %d %d %d %d %d\r\n", xa, ya, za, xm, ym, zm);
While minicom console app (Linux side) is connected and printing chars sent by Chibios to USB port, this solution works great, the led toggles on/off every loop. However, after closing minicom console app, board running chibios seems to block at "chprintf" after a second or so, led stops blinking, and everything continues stalled until minicom app is executed again (chprintf seems to unblock and led starts blinking again).
What is wrong with this solution and how this problem should be fixed?
Thank you in advance!
This is my first post to this forum, hope this questions will be useful to someone else...
My STM32F0 board has a magnetometer/accelerometer sensor connected. I'm using a Chibios static thread to read sensor information every 20ms and write it to a Linux host, using the USB-CDC serial driver (/dev/ttyACM0).
To debug I am using a blinking led inside the thread, and "chprintf" syscall to write the information from Chibios to Linux side:
chprintf((BaseSequentialStream *)&SDU1,
"%d %d %d %d %d %d\r\n", xa, ya, za, xm, ym, zm);
While minicom console app (Linux side) is connected and printing chars sent by Chibios to USB port, this solution works great, the led toggles on/off every loop. However, after closing minicom console app, board running chibios seems to block at "chprintf" after a second or so, led stops blinking, and everything continues stalled until minicom app is executed again (chprintf seems to unblock and led starts blinking again).
What is wrong with this solution and how this problem should be fixed?
Thank you in advance!