AnsweredAssumed Answered

STM32F103 USB stack doesn't work in Ubuntu and OpenWRT

Question asked by Kai Liu on Jan 16, 2018

I am developing IoT application on OpenWRT and USB. The STM32F103C8T6 is selected. After some research, I find its USB stack (CDC/ACM device) doesn't work well in some Linux disto. The same situation also applies to USB stack demo from Keil 4/5.

 

STM32F103 Stack, failed in OpenWRT/Ubuntu 10/12/14, worked in Windows XP/10 and Ubuntu 15/17

Keil USB Stack, failed in OpenWRT/Ubuntu 10/12/14, worked in Windows XP/10 and Ubuntu 15/17 

 

Here is my hardware configuration summary: In OpenWRT, the Python is 2.7.3, pyserial is 2.4. and My CDC/ACM code are from ST's STM32F103/F072 HAL SDK. You can find the reference code from mbed

 

After Python, I tried lua's io.open, and shell programming for serial with cat/echo commands. I am pretty sure that my device (mbed CDC) doesn't run well in Linux.

 

I also tested MicroPython (based upon STM32F4XX HAL), built-in CDC in STLINKV2 (STM32F103) and Keil RTX USB CDC demo (STM32F103). The first two works well in Windows/Linux, Keil doesn't.

 

Currently I am trying to usbmon to debug and find root cause, since USB stack is quite complex and firmware is hard to debug in real-time, I need some experienced in such cross-domain development.

 

f3e3f9c0 857391360 S Ii:1:004:1 -115:2 16 < f3f2e180 857391559 S Co:1:004:0 s 21 22 0003 0000 0000 0 f3f2e180 857414072 C Co:1:004:0 0 0 f3e3fa80 857414467 S Bi:1:004:2 -115 128 < f3e3fb40 857414547 S Bi:1:004:2 -115 128 < f3e3ff00 857414595 S Bi:1:004:2 -115 128 < f3e3fe40 857414636 S Bi:1:004:2 -115 128 < f3e3f900 857414676 S Bi:1:004:2 -115 128 < f3e3f780 857414716 S Bi:1:004:2 -115 128 < f3e3f6c0 857417325 S Bi:1:004:2 -115 128 < f3e3f600 857417399 S Bi:1:004:2 -115 128 < f3e3fc00 857417435 S Bi:1:004:2 -115 128 < f3e3fcc0 857417469 S Bi:1:004:2 -115 128 < f3e3f540 857417502 S Bi:1:004:2 -115 128 < f3e3f480 857417533 S Bi:1:004:2 -115 128 < f3e3f3c0 857417565 S Bi:1:004:2 -115 128 < f3e3f300 857417594 S Bi:1:004:2 -115 128 < f3e3f240 857417622 S Bi:1:004:2 -115 128 < f3e3f180 857417650 S Bi:1:004:2 -115 128 <  f3e3f9c0 1138689644 S Ii:1:004:1 -115:2 16 < f51fd6c0 1138692116 S Co:1:004:0 s 21 22 0003 0000 0000 0 f51fd6c0 1138703025 C Co:1:004:0 0 0 f3e3fa80 1138703444 S Bi:1:004:2 -115 128 < f3e3fb40 1138703524 S Bi:1:004:2 -115 128 < f3e3ff00 1138703570 S Bi:1:004:2 -115 128 < f3e3fe40 1138703610 S Bi:1:004:2 -115 128 < f3e3f900 1138703652 S Bi:1:004:2 -115 128 < f3e3f780 1138703692 S Bi:1:004:2 -115 128 < f3e3f6c0 1138703817 S Bi:1:004:2 -115 128 < f3e3f600 1138703865 S Bi:1:004:2 -115 128 < f3e3fc00 1138703906 S Bi:1:004:2 -115 128 < f3e3fcc0 1138703947 S Bi:1:004:2 -115 128 < f3e3f540 1138703987 S Bi:1:004:2 -115 128 < f3e3f480 1138704026 S Bi:1:004:2 -115 128 < f3e3f3c0 1138704066 S Bi:1:004:2 -115 128 < f3e3f300 1138704106 S Bi:1:004:2 -115 128 < f3e3f240 1138704147 S Bi:1:004:2 -115 128 < f3e3f180 1138704188 S Bi:1:004:2 -115 128 < f6c65840 1138704450 S Bo:1:004:2 -115 13 = 48656c6c 6f20776f 726c640d 0a f6c65cc0 1138704878 S Bo:1:004:2 -115 13 = 48656c6c 6f20776f 726c640d 0a f6c65d80 1138704970 S Bo:1:004:2 -115 13 = 48656c6c 6f20776f 726c640d 0a f6c65600 1138705045 S Bo:1:004:2 -115 13 = 48656c6c 6f20776f 726c640d 0a f6c65240 1138705117 S Bo:1:004:2 -115 13 = 48656c6c 6f20776f 726c640d 0a f6c65000 1138705189 S Bo:1:004:2 -115 13 = 48656c6c 6f20776f 726c640d 0a f6c659c0 1138705261 S Bo:1:004:2 -115 13 = 48656c6c 6f20776f 726c640d 0a f6c65b40 1138705333 S Bo:1:004:2 -115 13 = 48656c6c 6f20776f 726c640d 0a f6c656c0 1138705459 S Bo:1:004:2 -115 13 = 48656c6c 6f20776f 726c640d 0a f6c65300 1138705515 S Bo:1:004:2 -115 13 = 48656c6c 6f20776f 726c640d 0a f6c65f00 1138705559 S Bo:1:004:2 -115 13 = 48656c6c 6f20776f 726c640d 0a f6c65900 1138705603 S Bo:1:004:2 -115 13 = 48656c6c 6f20776f 726c640d 0a f6c65780 1138705646 S Bo:1:004:2 -115 13 = 48656c6c 6f20776f 726c640d 0a

According to this logging, the Bulkin always return nothing at all.

Outcomes