Minimum pin access to program via STLink
- RogerClark
- Posts: 8416
- Joined: Mon Apr 27, 2015 10:36 am
- Location: Melbourne, Australia
- Contact:
Re: Minimum pin access to program via STLink
I am not sure why you think a custome booloader would be a problem.
Its easy to add a new target to the existing bootloader and change the USB reset pin.
If you dont use a transistor to reset the USB, its not guranteed to work on all computers.
As what we do with boards like the BluePill etc is basically a hack. But we had no choice but to use a hack / workaround, as we cant change how those boards are made.
Its up to you, but if you are designing a board which you intend to make available for other people to use, I think you should seriously consider adding a reset transistor, even though that means loosing a GPIO line.
Its easy to add a new target to the existing bootloader and change the USB reset pin.
If you dont use a transistor to reset the USB, its not guranteed to work on all computers.
As what we do with boards like the BluePill etc is basically a hack. But we had no choice but to use a hack / workaround, as we cant change how those boards are made.
Its up to you, but if you are designing a board which you intend to make available for other people to use, I think you should seriously consider adding a reset transistor, even though that means loosing a GPIO line.
- RogerClark
- Posts: 8416
- Joined: Mon Apr 27, 2015 10:36 am
- Location: Melbourne, Australia
- Contact:
Re: Minimum pin access to program via STLink
You should take a look at this thread
http://stm32duinoforum.com/forum/viewtopic.php?t=642&start=30
Also. I'm pretty sure there is a commercial board, which already uses the STM32F103T but I'm having trouble tracking it down.
I'm pretty sure someone has posted a link to it on the forum somewhere.
http://stm32duinoforum.com/forum/viewtopic.php?t=642&start=30
Also. I'm pretty sure there is a commercial board, which already uses the STM32F103T but I'm having trouble tracking it down.
I'm pretty sure someone has posted a link to it on the forum somewhere.
Re: Minimum pin access to program via STLink
Thanks for the thread, it's very similar to what I'm trying to do.RogerClark wrote:You should take a look at this thread
http://stm32duinoforum.com/forum/viewtopic.php?t=642&start=30
Also. I'm pretty sure there is a commercial board, which already uses the STM32F103T but I'm having trouble tracking it down.
I'm pretty sure someone has posted a link to it on the forum somewhere.
You might have been refering to this board: http://www.artekit.eu/products/devboard ... m32-dip36/ linked in this thread: http://stm32duinoforum.com/forum/viewtopic.php?t=619
- RogerClark
- Posts: 8416
- Joined: Mon Apr 27, 2015 10:36 am
- Location: Melbourne, Australia
- Contact:
Re: Minimum pin access to program via STLink
@michaeliv
I think there is another STM32F103T board available, its not as long.
I will try to find it
Edit. Found it
http://www.hotmcu.com/stm32f103tb-arm-c ... cPath=1_20
Note. It looks like this company has some dodgy / illegal software hosted on their site.
I think there is another STM32F103T board available, its not as long.
I will try to find it
Edit. Found it
http://www.hotmcu.com/stm32f103tb-arm-c ... cPath=1_20
Note. It looks like this company has some dodgy / illegal software hosted on their site.
Re: Minimum pin access to program via STLink
Yes, SWD need to SENSE target Vcc, not use it for power. I recall that ST-Link won't run without sensing Vcc present. Also J-Link.RogerClark wrote:@stevech
Are you sure STLink needs to be connected to Vcc.
Re: Minimum pin access to program via STLink
OK, I've decided to add a USB disconnect circuit. I'm still deciding on which one would work best.
What would be the minimum component one that would work reliably ?
I found this one with 2 resistor + PNP that is claimed to be reliable: http://stm32duinoforum.com/forum/viewtopic.php?t=780
Also, there is the Maple Mini one but that uses 2 transistors.
Suggestions for best to use ?
Also on a side note -- does anyone know why my blue pill won't enumerate if I remove R10(10K resistor from PB12 to 3V3).
Thanks!
What would be the minimum component one that would work reliably ?
I found this one with 2 resistor + PNP that is claimed to be reliable: http://stm32duinoforum.com/forum/viewtopic.php?t=780
Also, there is the Maple Mini one but that uses 2 transistors.
Suggestions for best to use ?
Also on a side note -- does anyone know why my blue pill won't enumerate if I remove R10(10K resistor from PB12 to 3V3).
Thanks!
- RogerClark
- Posts: 8416
- Joined: Mon Apr 27, 2015 10:36 am
- Location: Melbourne, Australia
- Contact:
Re: Minimum pin access to program via STLink
10k is very high for USB enumeration, 1.5k is more common.
I think the pullup is part of the USB spec and indicates to the host that a slave is attached.
Without it, the USB won't re-enumerate.
Also.
Re: Circuits of USB reset transistors
See also http://store.iteadstudio.com/images/pro ... e-v1_0.pdf
They use a P Channel FET and 2 resistors.
I have been meaning to test this way of resetting the USB, and I bought some P Channel FETS a while ago, but never got around to trying it.
As far as I can tell, either a single PNP (or P Channel) device is needed, or 2 NPN devices, as the purpose of the transistor is to pull USB D+ (PA12) high via 1.5k when signaled to reset the USB
Our hack method (with the 1.5k resistor permanent pulling up USB D+), relies on the GPIO being able to drive PA12 low. But this isnt really how you are supposed to reset the USB, it just happens to work most of the time
I think the pullup is part of the USB spec and indicates to the host that a slave is attached.
Without it, the USB won't re-enumerate.
Also.
Re: Circuits of USB reset transistors
See also http://store.iteadstudio.com/images/pro ... e-v1_0.pdf
They use a P Channel FET and 2 resistors.
I have been meaning to test this way of resetting the USB, and I bought some P Channel FETS a while ago, but never got around to trying it.
As far as I can tell, either a single PNP (or P Channel) device is needed, or 2 NPN devices, as the purpose of the transistor is to pull USB D+ (PA12) high via 1.5k when signaled to reset the USB
Our hack method (with the 1.5k resistor permanent pulling up USB D+), relies on the GPIO being able to drive PA12 low. But this isnt really how you are supposed to reset the USB, it just happens to work most of the time

Re: Minimum pin access to program via STLink
Thanks for the info, now I'm a bit confused however.
I did not know that a pull-up is required for enumeration.
BTW when you say re-enumerate do you mean:
- Initial device identification, when the device is connected for the 1st time
- Device re-identification after messing with the D+ line
So in order to adequately force device re-identification, you would have to have both the D+ and D- pins floating, without any pull-up, correct ?
If that's the case then why use a transistor for disconnect ? Why not have D+ connected to another GPIO through a 1.5k resistor and configure the GPIO to output 3.3v, then when you want to re-identify the device, set the GPIO to floating. How is this different than using a GPIO-controlled transistor ?
Does anyone have a link where more details about this are given ? Preferably a straightforward explication, not a 500 page USB spec
I did not know that a pull-up is required for enumeration.
BTW when you say re-enumerate do you mean:
- Initial device identification, when the device is connected for the 1st time
- Device re-identification after messing with the D+ line
So in order to adequately force device re-identification, you would have to have both the D+ and D- pins floating, without any pull-up, correct ?
If that's the case then why use a transistor for disconnect ? Why not have D+ connected to another GPIO through a 1.5k resistor and configure the GPIO to output 3.3v, then when you want to re-identify the device, set the GPIO to floating. How is this different than using a GPIO-controlled transistor ?
Does anyone have a link where more details about this are given ? Preferably a straightforward explication, not a 500 page USB spec

- martinayotte
- Posts: 1265
- Joined: Mon Apr 27, 2015 1:45 pm
Re: Minimum pin access to program via STLink
From that I gather that the host uses the 1.5k resistor to detect that a high speed device is connected.martinayotte wrote:Here is one link : http://www.beyondlogic.org/usbnutshell/usb2.shtml
So in theory the suggestion about connecting a 1.5k resistor from D+ pin to another GPIO which would output 3.3v should work, right ? I see no reason to use a GPIO-controlled transistor. I guess there must be something I'm missing.