I looked to a STM32F4Disco schematics and it confirms my thought - SWIM
RST is on PB7,
T_NRST is on PB0. So you're right too: before entering a mode the dongle
does not know,
what pin to use. This is only a default value in dongle fw, what selects
T_NRST to be asserted.
So I propose for #3952 (the real code should check errors of course):
/* preliminary SRST assert:
* We want SRST is asserted before activating debug signals (mode_enter).
* As the required mode has not been set, the adapter may not know what
pin to use.
* Tested firmware STLINK v2 JTAG v29 API v2 SWIM v... uses T_NRST pin by
default
* after power on, SWIM_RST stays unchanged */
if (connect_under_reset /* see note below */)
stlink_usb_assert_srst(handle, 0);
stlink_usb_mode_enter(handle, emode);
/* assert SRST again: a little bit late but now the adapter knows for
sure what pin to use */
if (connect_under_reset) stlink_usb_assert_srst(handle, 0);
*) If the code above does not work with SWIM, change the first condition to
if (connect_under_reset && emode != STLINK_MODE_DEBUG_SWIM)
BTW Thanks for a huge contribution
Tomas
On 02.11.2017 10:07, Åke Rehnman wrote:
Sorry, changes are in 3952
/Ake
On 2017-11-02 10:05, Åke Rehnman wrote:
On 2017-11-02 09:58, Tomas Vanek wrote:
Thank for catching it on scope.
Is it really the start of open OpenOCD with reset_config srst_only
srst_nogate connect_assert_srst?
Yes
If so, there is another problem or feature in stlink driver:
stlink_usb_mode_leave() is not called at exit.
Probably
And signals before reset is closing of the mode entered in a
previous session.
To isolate the problem disconnect dongle from USB, reconnect and try
again.
You should see Hi-Z state on SWCLK and SWDIO until SWD mode is entered.
Yes, it seem exit mode is not called when closing. After reconnecting
the dongle it is not squiring those signals onto the bus.
BTW You've abandoned #4265? Don't be so impatient...
I committed a new patch set with your suggestion to switch mode early
for swim only. Those changes are in 3953.
Tomas
On 01.11.2017 13:19, Åke Rehnman wrote:
FYI the stlink_usb_mode_leave squirts some data onto the SWD lines
before reset is asserted.
yellow = swio, blue = swclk, pink = reset
/Ake
On 2017-10-30 10:41, Tomas Vanek (Code Review) wrote:
> > If there is not a better solution, use a delayed
> stlink_usb_mode_enter
> > in swim mode only.
>
> Delayed reset for swim mode you mean?
Yes, delayed for swim, and before mode_enter for swd.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel