Author Topic: STM32L0 Recognized as in DFU mode instead of USB HID  (Read 245 times)

0 Members and 1 Guest are viewing this topic.

Offline obsoletepower

  • Contributor
  • Posts: 6
STM32L0 Recognized as in DFU mode instead of USB HID
« on: April 14, 2021, 07:03:02 pm »
Hello everyone,

I have been a lurker on these forums for a long time now and haven't posted in a long time but I am hoping somebody can assist me with an issue I am having in trying to build a USB keyboard using the STM32L082KZ for my Apollo DSKY.
I am trying to get the MCU to be recognized by my PC as a HID but even flashing the default the usbd_hid.c and usbd_hid.h files that get generated will not get it to show up as a HID. Instead, the PC sees it as an "STM32 BOOTLOADER" and Device Manager shows it as "STM Device in DFU Mode". I have been pulling out my hair trying to get this working so any help will be greatly appreciated. I have uploaded my PCB schematic as well as the configuration in CubeMX for reference.

The PCB schematic:
- U1 is the STM32
- U2 is a solid-state relay to turn on the LEDs for key backlight
- U3 is a 5V to 3.3V linear regulator
- J1 is the Micro USB 2.0 port
- J2 is 4-pin header for programming/debugging
Note that I am using the STM32L0's internal oscillator; I hope this isn't the issue  :-//

[attach=1]

The STM32CubeMX pin configuration:

[attach=2]

The clock configuration:

[attach=3]

From a hardware standpoint, the PCB is getting power and I know the MCU is working because when I connect a USB cable to my PCB it shows it as an "STM32 BOOTLOADER" in Devices and Printers.


« Last Edit: April 14, 2021, 07:04:55 pm by obsoletepower »
 

Online profdc9

  • Regular Contributor
  • *
  • Posts: 218
  • Country: us
Re: STM32L0 Recognized as in DFU mode instead of USB HID
« Reply #1 on: April 14, 2021, 09:09:44 pm »
Pull BOOT0 low with a 100k resistor.  BOOT0 needs to be set on startup.
 
The following users thanked this post: obsoletepower

Offline obsoletepower

  • Contributor
  • Posts: 6
Re: STM32L0 Recognized as in DFU mode instead of USB HID
« Reply #2 on: April 14, 2021, 10:45:22 pm »
Oh my word!!! I added the bodge 100K and it works now! How the heck did I miss this?? |O I appreciate your help very very much!! I owe you a few beers!
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3443
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: STM32L0 Recognized as in DFU mode instead of USB HID
« Reply #3 on: April 27, 2021, 02:36:52 am »
Another way if possible at all - you can use option bytes to disable BOOT0 pin entirely if there is one such bit available, and thus no bodge needed. (Since I have no use with BOOT0 on my projects, a lot of my projects have BOOT0 entirely fused off that way.)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf