2025-01-15 10:07 AM - edited 2025-01-15 10:26 AM
I am trying to create a custom keyboard, and I was trying to flash my board with stm32f070c6t6 MCU in DFU mode using cube programmer, but I keep getting "no DFU detected" (of course while pulling BOOT0 pin high).
Also, every time I plug my device into my PC, the error message says, "Windows has stopped this device because it has reported problems (Code43). A request for the USB device descriptor failed."
I am new to this field, so I am running out of ideas.
I put 16MHz crystal and set up 48MHz for USB, I configured the device description based on this website; https://controllerstech.com/how-to-use-stm32-as-a-keyboard/
I pulled up D+ with a 1k5 resistor, I pulled down both CC1 and CC2 with 5k1 resistors.
I checked the voltage on the regulator and found it was totally fine (both 3v3 and 5v). I also checked the soldering and made sure that no pins were bridging.
I managed to flash the chip using STlink recently, but since this board is designed to be a keyboard, I expect the USB to work fine.
I am feeling so stuck, I have already spent like a total of 10 hours trying to figure it out, so it will be really helpful if someone tells me where I made a mistake.
Thanks.
2025-01-16 06:02 AM
I checked the datasheet, and I am pretty sure that those were not mixed up. (PA12: D+, PA11: D-)
Also, pin speed is not configurable apparently.
I will try removing C18.
2025-01-16 06:26 AM - edited 2025-01-16 09:50 AM
I removed the C18, but it did not work... no DFU target + no USB error
Edit: no USB error meant the error "USB device not recognized", sorry for my *** explanation...
This is my PCB design for a USB data line... I hope this routing is ok...
2025-01-16 07:31 AM
Routing looks ok...so far, i can see it; just at U5 : is the line D+/- here connected inside this chip ? did you check continuity ?
+
read:
> no USB error
Good. So its doing nothing now...also nothing wrong. :) So try power up with boot0 hi... and see dfu in CubeProgrammer...
2025-01-16 10:00 AM
According to the datasheet from ST, USBLC6-2SC6 (the U5 chip) is internally connected (at least that is what I thought).
I am unsure what I should do for the datasheet for the device bootloader. Should I erase my code before trying DFU mode?
And sorry for my poor explanation, still I am getting the same error :(
2025-01-16 11:36 AM
You don't need to erase, if bootloader running, you can flash, erase etc.
Just on your layout, D- close to CPU has a via, but there is also another connection to red track and to a pin. What is this?
Can you look with a scope to the signal at the CPU pins, to prove the signal looks ok?
2025-01-16 04:50 PM
Sorry for the late reply!
Here is the close-up.
the orange line on the USBD- via is just a silksceen.
2025-01-17 03:26 AM
Hi @HaYa6174
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-01-17 11:40 PM
Thank you for the info.
I used KiCad's differential routing tool, assuming those traces are almost the same length and maintaining close distance, and I also tried to minimize sharp corners and vias.
I also tried not to allow any other traces to cross the USB data line, and when I needed to do so, I made sure that it crossed perpendicular to the USB data line.
But, I am not sure about the 90ohm impedance rule; I knew that it existed, but I am not sure how to actually achieve that.
What should I do?
2025-01-18 03:30 AM - edited 2025-01-18 03:37 AM
Afaik in kicad main menu is tools/... , pcb tools or so, there is a impedance calculator
(track width x distance to ground plane in pcb material -> approx. impedance )
+ no need to match this +/- 1 ohm ; just it should be in range 70...110 ohms (center of range is 90 ohms).
Because it should match the cable , as good as possible, so it should be :
>
The USB 2.0 specification stipulates an impedance between 76.5 and 103.5 Ω for the cable when measured during differential transmission.
<
2025-01-20 02:08 AM
I searched a little about this and tried to calculate using the KiCad calculator tool. Then I got Zeven: 189.26 and Zodd: 67.822.
This is mostly because I designed the board with only 2 layers, meaning that the distance between the ground plane and D+- was about 1.6mm (the board thickness)...
I assume those numbers aren't great, should I redesign it with 4 layers?