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

Incorrect SN on Nucleo board #494

Closed
luckyluke72 opened this issue Oct 4, 2016 · 1 comment · Fixed by #1106
Closed

Incorrect SN on Nucleo board #494

luckyluke72 opened this issue Oct 4, 2016 · 1 comment · Fixed by #1106

Comments

@luckyluke72
Copy link

luckyluke72 commented Oct 4, 2016

Programmer/board type: Stlink/v2-1 on NUCLEO board
Programmer firmware version: N/A
Operating system: Linux
Stlink tools version and/or git commit hash: v1.2.0-129-gee3f7a1
Stlink commandline tool name: st-info --serial
Target chip (and optional board): ANY

IMHO, there is an error in stlink_print_serial(stlink_t *sl, bool openocd), file src/tools/info.c:22

line 30: fmt = "%02x";
should be replaced with

fmt="%c";
then I noticed the SN is truncated, as the ST SN is 24 chars long. You have to extend the serial number array from 12 to 24 chars in some places in your code. In fact the real SN of the board should have been

0667 FF53 5651 7270 6761 3012

  1. See for usb.c:912 stlink_probe_usb_devs(libusb_device *devs, stlink_t *sldevs[]) and following lines. In line 967 there is the call involved in SN, but you have to change

usb.c:958 char serial[13];
array should be 25.

  1. In include/st-link.h:135 please change to the following

    char serial[25];
    Then it works

[ mar ott 04 14:45:03 ] celettol@celettol-HP-Compaq-Elite-8300-USDT:~/software/stlink/build$ ./st-info --serial
0667FF535651727067173012

I can send you the code if you like (or do a pull req.)

@xor-gate
Copy link
Member

xor-gate commented Oct 9, 2016

The nucleo board programmer (stlinkv2-1) formats the serial in a hex-encoded string format (usb pid 0x374b). While stlink v1 and v2 format is binary (and we need to convert ourselves). It is already known this is incompatible, it needs more work than just changing the array to 25 elements.

Thank you for your contribution, as this is a duplicate of #417 I will close this. Feel free to discus further in the other issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants