Hey!
I recently took a closer look at why the ChibiOS shell prompt would often not appear correctly on the USB virtual serial device, and wrote down the individual problems that I found, and solution I settled on:
https://michael.stapelberg.ch/posts/202 ... l-cdc-acm/
This issue was reproducible across platforms (ST32, KINETIS, MIMXRT1062), and the workaround works on Linux, macOS and Windows.
Perhaps this is something to apply to the other demos that use a USB virtual serial device, too?
Hope this helps a few people
FYI: ChibiOS shell on USB virtual serial (CDC ACM) on Linux needs a delay
Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess
-
- Posts: 10
- Joined: Wed Jun 03, 2020 9:17 pm
- Has thanked: 4 times
- Been thanked: 3 times
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: FYI: ChibiOS shell on USB virtual serial (CDC ACM) on Linux needs a delay
Hi,
Good article, have you tried to exit the shell and see if it restarts? the semaphore is not necessarily signaled again.
Giovanni
Good article, have you tried to exit the shell and see if it restarts? the semaphore is not necessarily signaled again.
Giovanni
-
- Posts: 10
- Joined: Wed Jun 03, 2020 9:17 pm
- Has thanked: 4 times
- Been thanked: 3 times
Re: FYI: ChibiOS shell on USB virtual serial (CDC ACM) on Linux needs a delay
Giovanni wrote:Hi,
Good article, have you tried to exit the shell and see if it restarts? the semaphore is not necessarily signaled again.
Giovanni
Unfortunately, there’s another bug with exiting the shell (causes a hardfault) that I haven’t had time to look into. Until that one is fixed, I can’t test the restart scenario.
Does resetting the semaphore not signal all waiters? Is there a better way to use a semaphore, or perhaps a different primitive, in this case?
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: FYI: ChibiOS shell on USB virtual serial (CDC ACM) on Linux needs a delay
stapelberg wrote:Unfortunately, there’s another bug with exiting the shell (causes a hardfault) that I haven’t had time to look into.
Is the shell susystem initialized? (calling shellInit()).
What you could do is something like this:
Code: Select all
forever
if USB is not active then
wait on the semaphore
end
spawn shell
wait shell
sleep a little bit
end
This way it waits on the semaphore if USB is not active, making sure it will be signaled on the next connection. Note that the Serial_USB driver has connect/disconnect events, you may try those too (CHN_CONNECTED, CHN_DISCONNECTED).
Giovanni
Who is online
Users browsing this forum: No registered users and 43 guests