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

[stm32] use desig_get_unique_id from libopencm3 #1018

Merged
merged 1 commit into from
Jan 31, 2015
Merged

Conversation

flixr
Copy link
Member

@flixr flixr commented Dec 7, 2014

  • update libopencm3 so we have desig in F4 lib
  • use desig_get_unique_id_as_string from libopencm3 instead of our own function

@flixr flixr added the STM32 label Dec 7, 2014
@flixr
Copy link
Member Author

flixr commented Dec 7, 2014

@podhrmic this seems to work fine for me, would be great if you could cross check.

@flixr
Copy link
Member Author

flixr commented Dec 11, 2014

@podhrmic would be great if you could test this as well before we merge it...

@flixr
Copy link
Member Author

flixr commented Dec 16, 2014

Any chance that anyone else can test this? It works fine here, so I guess it is good to merge..
But would still appreciate if @podhrmic could take a look as well... (or just say if you won't have time soonish)

@podhrmic
Copy link
Member

I ll look at it later today.

@benlaurie
Copy link
Contributor

How does one test it?

On 16 December 2014 at 07:31, Michal Podhradsky notifications@github.com
wrote:

I ll look at it later today.


Reply to this email directly or view it on GitHub
#1018 (comment).

@flixr
Copy link
Member Author

flixr commented Dec 16, 2014

@podhrmic Ok, great
@benlaurie use telemetry type transparent_usb or the usb_tunnel and check if it correctly reports itself as CDC device with the chip serial number.

@podhrmic
Copy link
Member

Tested, and I don't think it works:

Using this commit:

[94907.552977] usb 3-1: New USB device found, idVendor=1d50, idProduct=603d
[94907.552985] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[94907.552989] usb 3-1: Product: CDC Serial STM32
[94907.552993] usb 3-1: Manufacturer: Paparazzi UAV
[94907.552996] usb 3-1: SerialNumber: 736343335174332314009200

Using master:

[95455.216916] usb 3-1: New USB device found, idVendor=1d50, idProduct=603d
[95455.216923] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[95455.216927] usb 3-1: Product: CDC Serial STM32
[95455.216930] usb 3-1: Manufacturer: Paparazzi UAV
[95455.216933] usb 3-1: SerialNumber: 410029001547333237363433

The implementation in libopencm3 looks correct, and you can see that first four bytes (7363433) in desig ID are identical to last four bytes from get_dev_unique_id() but the rest is garbage - so my guess is that there is some alignment problem in libopencm3 version...

Or our implementation was always wrong?

@flixr
Copy link
Member Author

flixr commented Dec 18, 2014

It isn't gabage, just different odering, if you split the string into 3x8 chars (32bit each), reverse the order of the 3 blocks, then swap every char pair again, you get the same number.

Actually it seems that our implementation so far doesn't make that much sense...
The libopencm3 version "correctly" starts converting each nibble in the id (from MSB downwards) to a char that is added to a string. So it seems to me that the locm3 odering makes sense, while the one we had so far does not...

Also since in some STM series the memory location for the id is not contiguous and the function already handles these correcty I would vote for changing it to the loc3 version.

@flixr
Copy link
Member Author

flixr commented Jan 31, 2015

Updated to use the latest libopencm3 version that converts the high nibble of the id to hex char first:
libopencm3/libopencm3@f206fcb
Now desig_get_unique_id_as_string returns a string that corresponds directly to the id in hex...

@flixr
Copy link
Member Author

flixr commented Jan 31, 2015

Ah, yeah.. and also updated luftboot to use the libopencm3 function...

@flixr flixr merged commit 705a7df into master Jan 31, 2015
@flixr flixr deleted the locm3_unique_id branch January 31, 2015 17:54
@flixr flixr added this to the v5.6 milestone Jan 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants