USB ID Pin function

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
gwork
Posts: 5
Joined: Sun Dec 09, 2018 3:51 am

USB ID Pin function

Post by gwork » Tue Mar 05, 2019 3:00 pm

Hello all,

I recently created a board based off of the STM32F405RGT6 (same as the Pyboard), with compatibility for micropython in mind. When I got the board, I was able to flash the micropython hex file to the microcontroller. The LEDs light up as I would expect when I reset the device, so I am fairly confident that the board is programmed correctly. However, when I try to connect via USB, I cannot make a connection. The device doesn't even show up in /dev/tty*. I went back, checked the circuit and I forgot to hook up the USB ID line to the chip. There is a pull up on the line, so it is always drawn high (though I could make it floating by taking off the resistor). Does this ID line need to be properly connected for functionality? My understanding is that the ID line specifies whether the device is acting as a host or device. I think that the floating means that it defaults to device, which is what I want, since this USB port will only be used to program the device over the micropython REPL.

I'm also going to go back and ensure that the solder connections on the USB port are good, that may also be the issue.

The Eagle files for this design can be found here: https://github.com/osu-uwrt/uwrt_electr ... oProcessor

Thanks!

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: USB ID Pin function

Post by dhylands » Tue Mar 05, 2019 6:16 pm

The ID pin doesn't have to be connected. For example, this board doesn't have an ID pin on the USB connector: https://old.ghielectronics.com/download ... 40_SCH.pdf (because it uses a mini connector rather than a micro connector).

Similarly, there is no requirement to connect VBUS from the USB connector to the MCU either.

What is important is that your board configuration reflect things properly. For example, if your config says that your VBUS pin is connected but it actually isn't, then the firmware doesn't initialize the USB peripheral until VBUS is detected.

If you don't have the ID pin connected, make sure MICROPY_HW_USB_OTG_ID_PIN isn't defined in your mpconfigboard.h file.
Similarly if VBUS isn't connected, make sure MICROPY_HW_USB_VBUS_DETECT_PIN isn't defined in your mpconfigboard.h file.

akronmacon
Posts: 7
Joined: Thu Jun 07, 2018 4:23 am

Re: USB ID Pin function

Post by akronmacon » Thu Mar 07, 2019 6:10 am

If I understand correctly, you're looking to take a stock image (like the pre-made pyboard image) and get it working with your board.

In that case I believe you need to pull pin A9 up.

If you look at the PyBoard Schematic ( http://micropython.org/resources/PYBv11-schematics.pdf ) you can see this is done by connecting PA9 to VUSB via 560R. This is used to detect the USB connection and enable the USB serial port interface.

The USB_ID pin is separate, for use in USB OTG initial host determination (not required for simply hooking up your pyboard derivative as a serial device to your computer).

[Aside: 1) If you're able to link or post PDF schematics when you have questions, you'll reach a wider audience. I had to fire up my ECAD and import your schematic, which isn't foolproof. 2) I'm not sure your FETs are doing what you intend, when I import the schematic, it looks like their gates are tied permanently to 3V3 / "On" ]

gwork
Posts: 5
Joined: Sun Dec 09, 2018 3:51 am

Re: USB ID Pin function

Post by gwork » Mon Mar 11, 2019 3:50 pm

Hi @akronmacon and @dhylands,

Thanks for both of your help. We did indeed forget to pull up A9, but we ended up figuring out our issue, thanks to the comment about the VBUS. We disabled the VBUS and ID pins in the firmware. While poking around in there, I also noticed that we were flashing the wrong firmware - the v1.0 of the PyBoard used an 8MHz clock, whereas we based our design off of the PyBoard v1.1 which has a 12MHz clock.

I appreciate that you loaded our designs into your CAD software - we are a group of students, so it is times like these where we are learning the best practices for reaching out for help on forums. In the future, we will be sure to link a pdf of the schematic instead! Additionally, the point of the NMOS transistors on our board is for logic level conversion. The gates are intentionally tied to 3V, so that when the source pin is also 3V then the transistor doesn't conduct - we have 5V pull ups on another board to raise the logic level (this fact probably was not clear when you were looking at the design). Otherwise, when the source pin is low, then the transistor does conduct, pulling the output line low as well. I appreciate that you are trying to help us improve our design!

Thanks!

Post Reply