STM32L1xx-Discovery - USB CDC
Posted: Wed Jul 31, 2013 7:31 pm
Hi all,
Currently I'm trying to modify the USB_CDC code for STM32F37x to fit into STM32L-Discovery board.
I did some research online and make changes as the following:
Hardware:
1. Attach 8 MHz oscillator and capacitor on X3 pad on the board to enable HSE
2. External pull-up 1.5K resistor connecting D+ to C12 according to the errata
3. Power supplied by the mini-usb cable, D+/D- connecting to PA12/PA11, and GND to GND pin.
|-------1.5K--------PC12
D+ ------------------------------ PA12
D- ------------------------------ PA11
GND --------------------------- GND
Software
1. I made some changes in board.h, and set the PIN_OSPEED_40M(GPIOA_USB_DM), assuming USB should be fastest speed.
#define STM32_LSECLK 32768
#define STM32_HSECLK 8000000
#define usb_lld_connect_bus(usbp) palClearPad(GPIOC, GPIOC_USB_DISC) /* GPIOC_USB_DISC is PC12, for external pull-up */
#define usb_lld_disconnect_bus(usbp) palSetPad(GPIOC, GPIOC_USB_DISC)
2. mcuconf.h
#define STM32L1xx_MCUCONF
#define STM32_HSE_ENABLED TRUE
#define STM32_PLLSRC STM32_PLLSRC_HSE
3. halconf.h
#define HAL_USE_USB TRUE
4. Lastly, I changed the Makefile according to the STM32L.
I'm not sure if I miss anything here. The code can be compiled successfully, but after I loaded the binary to the board, I could not see anything on linux by typing "lsusb" and nothing happened in the kernal.log either.
I wonder what happened here and how would linux react when it detects the properly-programmed USB device? I'm pretty new to this. If anyone could suggest me a way to test whether the USB device is working, that would be great.
I can post my code if needed.
Thanks a lot,
V.
Currently I'm trying to modify the USB_CDC code for STM32F37x to fit into STM32L-Discovery board.
I did some research online and make changes as the following:
Hardware:
1. Attach 8 MHz oscillator and capacitor on X3 pad on the board to enable HSE
2. External pull-up 1.5K resistor connecting D+ to C12 according to the errata
3. Power supplied by the mini-usb cable, D+/D- connecting to PA12/PA11, and GND to GND pin.
|-------1.5K--------PC12
D+ ------------------------------ PA12
D- ------------------------------ PA11
GND --------------------------- GND
Software
1. I made some changes in board.h, and set the PIN_OSPEED_40M(GPIOA_USB_DM), assuming USB should be fastest speed.
#define STM32_LSECLK 32768
#define STM32_HSECLK 8000000
#define usb_lld_connect_bus(usbp) palClearPad(GPIOC, GPIOC_USB_DISC) /* GPIOC_USB_DISC is PC12, for external pull-up */
#define usb_lld_disconnect_bus(usbp) palSetPad(GPIOC, GPIOC_USB_DISC)
2. mcuconf.h
#define STM32L1xx_MCUCONF
#define STM32_HSE_ENABLED TRUE
#define STM32_PLLSRC STM32_PLLSRC_HSE
3. halconf.h
#define HAL_USE_USB TRUE
4. Lastly, I changed the Makefile according to the STM32L.
I'm not sure if I miss anything here. The code can be compiled successfully, but after I loaded the binary to the board, I could not see anything on linux by typing "lsusb" and nothing happened in the kernal.log either.
I wonder what happened here and how would linux react when it detects the properly-programmed USB device? I'm pretty new to this. If anyone could suggest me a way to test whether the USB device is working, that would be great.
I can post my code if needed.
Thanks a lot,
V.