Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protocol V1 and V2 difference #271

Closed
lanserge opened this issue Oct 10, 2014 · 2 comments · Fixed by #954
Closed

Protocol V1 and V2 difference #271

lanserge opened this issue Oct 10, 2014 · 2 comments · Fixed by #954

Comments

@lanserge
Copy link

I was playing with st-link jtag and looked at USB packets when ST utility worked with it.
I found that it enters SWD mode with USB packet data 0xF2 0x30 0xA3.
This corresponds to STLINK_DEBUG_COMMAND,STLINK_SWD_ENTER,STLINK_DEBUG_ENTER_SWD defines from stlink-common.h file. I confirm that this sequence is working on my ST-LINK V2.
But in the stlink-usb.c file in the function _stlink_usb_enter_swd_mode I see next lines:
cmd[i++] = STLINK_DEBUG_COMMAND;
cmd[i++] = STLINK_DEBUG_ENTER;
cmd[i++] = STLINK_DEBUG_ENTER_SWD;
The above lines correspond to sequence 0xF2 0x20 0xA3.
I looked at OpenOCD sources for the same stuff: http://sourceforge.net/p/openocd/code/ci/master/tree/src/jtag/drivers/stlink_usb.c
And it looks like second byte is changed from 0x20 to 0x30 and corresponds to V1 API and V2 API respectively. Someone needs to update the code to work with two API versions.

@xor-gate
Copy link
Member

xor-gate commented May 5, 2016

Have you tried with latest stlink tools in master?

@Nightwalker-87
Copy link
Member

Fixed since manual merge-commit aad5cf1.

Nightwalker-87 added a commit that referenced this issue May 9, 2020
- Comment for selection of API-Version (#271)
- Whitespace cleanup
- Fixed casting (-Wshorten-64-to-32)
@Nightwalker-87 Nightwalker-87 linked a pull request May 9, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment