cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L Discovery and ''STM32F10x and STM32L1xx USB-FS-Device Library''

elijah
Associate II
Posted on November 16, 2011 at 19:00

I've failed to start ''Custom HID'' and ''Virtual COM'' examples on my discovery.

Wiring: PA11 is connected to USB DATA-; PA12 is connected to USB DATA+. The board itself is powered by USB socket.

I'm using IAR Kickstart, 6.2, Library version 3.3.0. Example project is made compilable by removing core_cm3.X files. Target device is set to STM32L152xB.

Host PC is AMD based, Windows 7(x64), Virtual Com Port driver(1.3.1) from ST is installed.

When device is connected, Windows reports ''Unknown device'' is connected (Error 43).

What's wrong? Why it does not work? What shall I do to make this working?

#stm32l-discovery #usb-client
4 REPLIES 4
elijah
Associate II
Posted on November 18, 2011 at 17:40

The solution has been found. According to datasheet and ref guide, the 24-MHz clock should be provided to USB part of MCU. To provide the external clocking, I've soldered SB17 bridge, which connects 8MHz MCO from ST-LINK chip to main MCU. PLL inside MCU multiplies this by 3 to provide proper clocking to the USB client. After solderig I've modified program example - RCC control register HSEBYP bit has to be enabled durign startup. So,

  /*!< Set HSEBYP bit */

  RCC->CR |= ((uint32_t)0x00040000);

Instead of:

//  /*!< Reset HSEBYP bit */

//  RCC->CR &= (uint32_t)0xFFFBFFFF;

That's all! Everything works!

MikeAtETI
Associate III
Posted on November 23, 2011 at 15:28

Could you post the example project... As I'm trying to do the same thing and can't get it to work?

[In my case in the debugger it gets to the end of USB_Init and seems to disappear off somewhere...]

elijah
Associate II
Posted on December 02, 2011 at 09:23

Sorry, HM. Wasn't here for a while.

Link to sources is here:

http://sourceforge.net/projects/stm32l-usb-uart/

There is one more small change - UART GPIOs used in the library sources are not wired to STM32L-Discovery pins, I've changed sourses a bit and now:

PA2 - UART TX

PA3 - UART RX

GND - UART GND + USB GND

EXT_5V - USB +5V

PA11 - USB DATA-

PA12 - USB DATA+ SB17 has to be closed with solder. USB flash/debug socket must be disconnected before connecting USB, so I don't know how to debug that on-device.

NB Do not connect to COM ports(RS-232). Controller will be destroyed in milliseconds!

RS232 - uses 12V, controllers - 3.3V. Make convertor with MAX232.

ftp27host
Associate
Posted on June 24, 2013 at 14:47

Hello.

I use to 8MHz clock on pins OSC_IN and OSC_OUT on my kit STM32L-Dicovery. 

And I use this code for configure Clock System:

  /*!< Set MSION bit */

 

  RCC->CR |= (uint32_t)0x00000100;

 

 

  /*!< Reset SW[1:0], HPRE[3:0], PPRE1[2:0], PPRE2[2:0], MCOSEL[2:0] and MCOPRE[2:0] bits */

 

  RCC->CFGR &= (uint32_t)0x88FFC00C;

 

  

 

  /*!< Reset HSION, HSEON, CSSON and PLLON bits */

 

  RCC->CR &= (uint32_t)0xEEFEFFFE;

 

 

//  /*!< Reset HSEBYP bit */

 

//  RCC->CR &= (uint32_t)0xFFFBFFFF;

 

 

  /*!< Set HSEBYP bit */

 

  RCC->CR |= ((uint32_t)0x00040000);

 

 

  /*!< Reset PLLSRC, PLLMUL[3:0] and PLLDIV[1 :0] bits */

 

  RCC->CFGR &= (uint32_t)0xFF12FFFE;//0xFF02FFFF;

 

As example firmware, I use Custom HID demo firmware from Examples  of USB-FS-Device. And this project doesn't work. 

In what could be the problem?