To start with I can grab cjheath/stm32f3-discovery-usb-example from GitHub, compile and flash it over st-link, and it works fine. Tilting the board moves my mouse cursor around as you'd expect. I can also download ChibiOS_17.6.0 and compile demos/STM32/RT-STM32F303-DISCOVERY and flash it, and the LED's on the compass chase around in a circle.
However, I can't get USB working under Chibios. I've tried compiling ChibiOS_17.6.0/testhal/STM32/STM32F3xx/USB_CDC, which is supposed to work on the stm32f3-discovery, but it doesn't work. I've also tried kernsny/chibios-stm32f3discovery on GitHub, and that project doesn't work either. In both cases I'm simply acquiring the source code, changing into the root directory, running make, and flashing the resulting ch.bin file. These demos target the stm32f3discovery board, and my board is a brand new unit received from digikey yesterday, with no hardware changes made.
From what I can tell usbStart() is called but never returns. Here's an example gdb session:
Code: Select all
zach-desktop:USB_CDC zwhite$ arm-none-eabi-gdb build/ch.elf
GNU gdb (GNU Tools for ARM Embedded Processors 6-2017-q1-update) 7.12.1.20170215-git
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-apple-darwin10 --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from build/ch.elf...done.
(gdb) target extended-remote :4242
Remote debugging using :4242
0x080001a0 in Reset_Handler ()
(gdb) load
Loading section .vectors, size 0x1a0 lma 0x8000000
Loading section .text, size 0x9c90 lma 0x80001a0
Loading section .rodata, size 0x1f54 lma 0x8009e30
Loading section .data, size 0x488 lma 0x800bd84
Start address 0x80001a0, load size 49676
Transfer rate: 14 KB/sec, 8279 bytes/write.
(gdb) break usbStart
Breakpoint 1 at 0x800422e: file ../../../../os/common/ext/CMSIS/include/cmsis_gcc.h, line 264.
(gdb) break main.c:143
Breakpoint 2 at 0x80042b8: file main.c, line 143.
(gdb) c
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.
Breakpoint 1, main () at main.c:142
142 usbStart(serusbcfg.usbp, &usbcfg);
(gdb) c
Continuing.
^C
Program received signal SIGTRAP, Trace/breakpoint trap.
0x08002b32 in chSysHalt (reason=reason@entry=0x800a28c "SV#6")
at ../../../../os/rt/src/chsys.c:200
200 ch.dbg.panic_msg = reason;
(gdb) bt
#0 0x08002b32 in chSysHalt (reason=reason@entry=0x800a28c "SV#6")
at ../../../../os/rt/src/chsys.c:200
#1 0x080031c4 in _dbg_check_lock_from_isr () at ../../../../os/rt/src/chdebug.c:179
#2 0x08003a76 in chSysLockFromISR () at ../../../../os/rt/include/chsys.h:418
#3 usb_event (usbp=<optimized out>, event=<optimized out>, usbp=<optimized out>)
at usbcfg.c:291
#4 0x08004298 in usb_lld_start (usbp=0x20001130 <USBD1>)
at ../../../../os/hal/ports/STM32/LLD/USBv1/hal_usb_lld.c:495
#5 usbStart (config=0x800a4c0 <usbcfg>, usbp=0x20001130 <USBD1>)
at ../../../../os/hal/src/hal_usb.c:311
#6 main () at main.c:142
This is what I get in the system log when I plug it into a raspberry pi:
Code: Select all
Jul 16 22:24:13 laser-monitor kernel: [538150.971812] usb 1-1.2: new full-speed USB device number 100 using dwc_otg
Jul 16 22:24:14 laser-monitor kernel: [538151.071772] usb 1-1.2: device descriptor read/64, error -32
Jul 16 22:24:14 laser-monitor kernel: [538151.291803] usb 1-1.2: device descriptor read/64, error -32
Jul 16 22:24:14 laser-monitor kernel: [538151.511789] usb 1-1.2: new full-speed USB device number 101 using dwc_otg
Jul 16 22:24:14 laser-monitor kernel: [538151.611828] usb 1-1.2: device descriptor read/64, error -32
Jul 16 22:24:14 laser-monitor kernel: [538151.831791] usb 1-1.2: device descriptor read/64, error -32
Jul 16 22:24:15 laser-monitor kernel: [538152.051832] usb 1-1.2: new full-speed USB device number 102 using dwc_otg
Jul 16 22:24:15 laser-monitor kernel: [538152.491828] usb 1-1.2: device not accepting address 102, error -32
Jul 16 22:24:15 laser-monitor kernel: [538152.591826] usb 1-1.2: new full-speed USB device number 103 using dwc_otg
Jul 16 22:24:16 laser-monitor kernel: [538153.031820] usb 1-1.2: device not accepting address 103, error -32
Jul 16 22:24:16 laser-monitor kernel: [538153.032045] usb 1-1-port2: unable to enumerate USB device
Could something have changed in Chibios since the last time anyone tried these demos?