Minimum pin access to program via STLink

If you made your own board, post here, unless you built a Maple or Maple mini clone etc
michaeliv
Posts: 15
Joined: Tue Apr 12, 2016 4:55 am

Re: Minimum pin access to program via STLink

Postby michaeliv » Wed Apr 27, 2016 8:51 pm

michaeliv wrote:I see no reason to use a GPIO-controlled transistor. I guess there must be something I'm missing.

After looking into this, I managed to find some info on it.
Apparently the issue is that you should never ever ever pull down D+. So having a resistor to another GPIO might lead to pulling down D+ when there is no power supplied to the chip(if the chip is powered then you can restrict it to being floating / 3.3V only). I haven't tested if this is actually true for the STM32F103(if when powered off, current might flow from GPIO to ground).
Ironically a PNP transistor is the worst approach to achieve this since there will basically be a diode from D+ to another GPIO, so it can happen that D+ will be pulled down through diode + transistor base resistor + GPIO powered-off resistance when the device is powered off. So a MOSFET should be used.
To me this sounds kind of too corner-case to justify adding a transistor + 2 resistors to the board.

Thread about this issue:
http://www.eevblog.com/forum/projects/d ... stor-on-d/

User avatar
RogerClark
Posts: 5320
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Minimum pin access to program via STLink

Postby RogerClark » Wed Apr 27, 2016 9:46 pm

or use a FET

michaeliv
Posts: 15
Joined: Tue Apr 12, 2016 4:55 am

Re: Minimum pin access to program via STLink

Postby michaeliv » Thu Apr 28, 2016 12:57 am

For anyone curious, I've tested the resistance of the D12 GPIO to ground while the micro is unpowered and it measured at 33 MOhms. which IMO would not pose an issue.
Having said this, it seems there is no reason not to use the 1.5k resistor from D+ to another GPIO.
The only reason that I can see now is that the 33MOhms resistance isn't guaranteed by spec so theoretically in the future it might change -- however I view this as extremely unlikely.

User avatar
RogerClark
Posts: 5320
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Minimum pin access to program via STLink

Postby RogerClark » Thu Apr 28, 2016 1:04 am

Perhaps the HIGH voltage on the GPIO is not guaranteed to be 3.3V, there is bound to be some volt drop though the internal circuit for the GPIO inside the STM32

michaeliv
Posts: 15
Joined: Tue Apr 12, 2016 4:55 am

Re: Minimum pin access to program via STLink

Postby michaeliv » Thu Apr 28, 2016 5:21 am

RogerClark wrote:Perhaps the HIGH voltage on the GPIO is not guaranteed to be 3.3V, there is bound to be some volt drop though the internal circuit for the GPIO inside the STM32

That's a very good point, not only for my scenario, but it would be useful to know in general the internal resistance when pulling pins HIGH via GPIO.
So I decided to measure it.
When sourcing 10.05mA there was a voltage drop of 0.2197V from the closest VCC to the GPIO pin(measured directly on the pins) -- this gives an internal resistance of ~22R.

For my scenario, this would be much higher than a say SOT-23 MOSFET with less than 100mOhms resistance, but when considering that it's effectively in series with the 1.5k resistor, it probably won't be very impactful.

I'll give the pull-up-to-GPIO method a try with a board prototype and see if it proves reliable, the 10k pull up hasn't proven reliable for me.
Now on to modifying the bootloader :D. I haven't managed to find a complete guide for a n00b for building on Windows, I've read the readme and some forum threads but they seem to assume that you have knowledge about nmake & gcc & their setup.
Is there a detailed guide for building on windows, including what exactly to install, how to set up the build environment & what commands to issue ?

Thanks!

User avatar
RogerClark
Posts: 5320
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Minimum pin access to program via STLink

Postby RogerClark » Thu Apr 28, 2016 5:47 am

To build the bootlooader you need make.exe (I think I use WinAVR's copy), and just put the path to the arm gcc compiler in your PATH var

Arduino hides GCC in the %appdata%/Arduino15 folder somewhere

User avatar
Just4Fun
Posts: 45
Joined: Tue Jan 05, 2016 9:48 pm
Contact:

Re: Minimum pin access to program via STLink

Postby Just4Fun » Thu Apr 28, 2016 9:23 am

Hi all,
if it can help, here is the schematics of my "multistandard" board (see my post on the "Welcome" section: http://www.stm32duino.com/viewtopic.php?f=2&t=841) that uses one PNP for the USB disconnect signal.

PS: These days I'm making a new board that will "join" the STM32 "world" with the CPLD/FPGA "universe"... I'll post here the result (if any... :lol: ). Currently I'm starting the PCB design using a single layer homemade board.... not so easy.... some transmission line problems to manage....

Cheers.




UPDATE (schematic errata):

L2 is upside down;
USB (J3) shield is unconnected. Better connect it to GND.
Attachments
A181115-R180116.pdf
(62.15 KiB) Downloaded 68 times
Last edited by Just4Fun on Fri Apr 29, 2016 8:00 am, edited 1 time in total.

stevech
Posts: 442
Joined: Thu Aug 27, 2015 6:32 am

Re: Minimum pin access to program via STLink

Postby stevech » Fri Apr 29, 2016 5:55 am

michaeliv wrote:For anyone curious, I've tested the resistance of the D12 GPIO to ground while the micro is unpowered and it measured at 33 MOhms. which IMO would not pose an issue.
Having said this, it seems there is no reason not to use the 1.5k resistor from D+ to another GPIO.
The only reason that I can see now is that the 33MOhms resistance isn't guaranteed by spec so theoretically in the future it might change -- however I view this as extremely unlikely.

That 33Mohm is just parasitic. Not significant.

Signal32
Posts: 26
Joined: Sun May 08, 2016 12:19 am

Re: Minimum pin access to program via STLink

Postby Signal32 » Mon May 23, 2016 8:05 pm

I asked a ST-Guy at Maker Fair SF Bay 2016 about the pull-up-to GPIO mystery. Though he was a software guy and didn't know the specifics behind the choice he pointed out that with pull-up-to GPIO you're pulling up to the micro's internal voltage which is subject to noise. Though that wouldn't seem that much of a big deal since ST says in their datasheet that the pull-up should be done to 3.0v-3.3v.


Return to “Custom design boards”

Who is online

Users browsing this forum: No registered users and 2 guests