Some pins not usable when using ST-Link ?

User avatar
martinayotte
Posts: 1172
Joined: Mon Apr 27, 2015 1:45 pm

Re: Some pins not usable when using ST-Link ?

Post by martinayotte » Sun Jan 15, 2017 6:38 pm

That is pretty normal to have this flag in the stlink upload method, since otherwise, you can only upload one time and then the SWD becomes disabled.

stevestrong
Posts: 1166
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Some pins not usable when using ST-Link ?

Post by stevestrong » Sun Jan 15, 2017 7:50 pm

Yes for Stlink, but i had it for stm32duino bootloader upload method, which i think is not wanted.

User avatar
martinayotte
Posts: 1172
Joined: Mon Apr 27, 2015 1:45 pm

Re: Some pins not usable when using ST-Link ?

Post by martinayotte » Sun Jan 15, 2017 8:44 pm

You're right ! Roger did that change on December 26th, I don't know why other than allowing SWD debugging whatever upload method is used.

https://github.com/rogerclarkmelbourne/ ... a4b3925ffb

stevestrong
Posts: 1166
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Some pins not usable when using ST-Link ?

Post by stevestrong » Sun Jan 15, 2017 9:56 pm

Well, i think we need to find another solution for the original idea to enable debugging, because i lost 2 days to find this issue, and maybe there will be more users who will complain about this.
Last edited by stevestrong on Mon Jan 16, 2017 1:53 pm, edited 1 time in total.

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

Re: Some pins not usable when using ST-Link ?

Post by RogerClark » Sun Jan 15, 2017 10:52 pm

I'm confused now

People wanted the SWD pins enabled all the time, so I changed it.

Is this not what was wanted by the majority of users?

danieleff
Posts: 270
Joined: Thu Sep 01, 2016 8:52 pm
Location: Hungary
Contact:

Re: Some pins not usable when using ST-Link ?

Post by danieleff » Mon Jan 16, 2017 5:26 am

Idea: enable SWD always, and disable it from pinMode if somebody wants one of its pins.

stevestrong
Posts: 1166
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Some pins not usable when using ST-Link ?

Post by stevestrong » Mon Jan 16, 2017 5:57 am

I'm just wondering how many of us are debugging when uploading with DFU, having no debugger connected.
I admit, this may be not the right place to post my issue, because this happens without using Stlink. And obviously i missed that majority vote.
This issue i see citical since the affected pin cannot be corrected with pinMode alone, one really have to use the afio cfg function, too.
But i don't want to push my opinion, i obey the majority, i just hope that others will find this post and will know that they should use an Arduino non-compatible function "afio_cfg_debug_ports(AFIO_DEBUG_NONE);" in order to get their pin toggle in any simple sketch.
Me, I will just remove the respective define from "boards.txt" for my local and github version.
Last edited by stevestrong on Mon Jan 16, 2017 3:20 pm, edited 1 time in total.

User avatar
martinayotte
Posts: 1172
Joined: Mon Apr 27, 2015 1:45 pm

Re: Some pins not usable when using ST-Link ?

Post by martinayotte » Mon Jan 16, 2017 2:52 pm

I think that daniel's idea is a good one :
maybe the disableDebug() should within the pinMode when those specific pins are specified.

stevestrong
Posts: 1166
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Some pins not usable when using ST-Link ?

Post by stevestrong » Mon Jan 16, 2017 3:29 pm

I don't know whether my opinion counts, but I would suggest an IDE menu entry, this way is left to the user to enable/disable debugging according to his needs. Yes, you could say that we already have a lot of menu entries. Indeed. But still, this would be essential in my opinion. And this could be done across multiple platforms/boards.
The more because the parallel TFT libraries do set pin modes without calling pinMode() for each pin, but rather use direct register writes for multiple pin mode setting in one shot (btw, this was the way I meet this issue).

This should be linked (but can be done also independently) with information (on wiki?) pointing out the involved GPIO pins.

We anyway need some nice wiki pages regarding debugging.

User avatar
Rick Kimball
Posts: 870
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: Some pins not usable when using ST-Link ?

Post by Rick Kimball » Mon Jan 16, 2017 4:08 pm

stevestrong wrote:...But i don't want to push my opinion, i obey the majority, i just hope that others will find this post and will know that they should use an Arduino non-compatible function "afio_cfg_debug_ports(AFIO_DEBUG_NONE);" in order to get their pin toggle in any simple sketch.
I guess the previous post that did just that was easy to miss. The third post in this thread already explained how to deal with it, however it seemed you overlooked it: http://www.stm32duino.com/viewtopic.php ... 130#p13919

You must not be using a bluepill. I bought the bluepill boards specifically because it has the SWD pins broken out. They are broken out horizontally instead of vertically, they don't plug into a bread board. I couldn't even tell you which digital pins they use without digging into the datasheet. I use SWD exclusively, I've never loaded the boot loader and don't plan to. If I did ever want to use a boot loader I'd use the builtin serial one in ROM with an external USB dongle. Like you, I spent a bunch of time being frustrated with the SWD pins. However, in my case it was the opposite. I had to dig through the code to find out where the pins were being disabled and turn it back on. Unfortunately, when the pins are disabled there is nothing I can do in my code to turn it back on. If it is enabled by default, it is easy to turn it off, but impossible to turn on. Yes, I know I can physically toggle the boot0 pin high and reset to make it work temporarily. However, that isn't obvious either.
stevestrong wrote:...
Me, I will just remove the respective define from "boards.txt" for my local and github version.
I came to that same conclusion a long time ago. I created personal board entries for the bluepill and maple mini. It sets up the configurations the way I like to use the bluepill and maple mini boards. I put them in a separate file so I can just append my file to the end of the github one.

There is no majority way to use these boards. There are many different people using many different boards all in different ways.

-rick
Last edited by Rick Kimball on Mon Jan 16, 2017 5:42 pm, edited 1 time in total.
-rick

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests