After the anger comes the frustration. After being stuck a few days on the serial over USB implementation on ChibiOS, I finally did it ! It was yesterday evening. I was in a good mood this morning. Actually, making a success of compiling and flashing a demo code is not very glorious. The rules are clear : no black magic ! However, after many comparisons with my original code, I could not figure out where were my mistakes.
The general survey and advice of today have been helpful. My problems came from the multithreading. Firstly, I thought that when main returns, it would be sleeping forever. In fact, it seems to be stuck in an infinite active loop. Because of this active wait, the serial over UBS, which had the same priority, could not be executed properly. (The management of SDU was made in a thread, not in the main function) Instead I saw a lot of 110 errors in dmesg. 110 means “not enough power supply to provide to the device”. It logical from the point of view of the host. The STM32 acted like it was establishing a connection, and stopping. And started a new one and so on, like a device which is constantly rebooting because it not powered enough.
A few patches later, it is now working properly. I am pretty impressed by the shell. It is very easy to enable and customize. You can add you own commands, see the number of threads, the state of the memory. Very useful.
Well, I hope I will remember this episode during my future debugs. I leave you with this picture you might have already seen.