-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
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
[BUG] STM32_UID still broken, the serial number its is prining out is garbage. #26731
Comments
Even using the old way the serial number doesn't match my STM32F103 UID. 00FF9768 is located at 0x1FFFF7F8 |
Your right... its even more broken than I thought. Documenting for anyone reading: For my processor stm32f401RE the Device electronic signature register address is 0x1FFF7A10 I connect up my stlink and get it working under platformio If I ask GDB to dump these 3 addresses with
I get
OLD code UUID:004D00300200C000445243F5 or the current code 2035-2035-2035-203520352035 or the new code I was playing with.. Taking a closer look If we do a larger memory dump
and examine the old code output UUID:004D0030 0200C000 445243F5 first 4 bytes 004D0030 is correct So the old results where also wrong. |
So the long working version should be
which prints correct results CEDE2A2F-004D-0030-4646-500A20353631 But the single line version
Still produces scrambled result UUID:CEDE2A2F-3631-3631-3631-363136313631 |
got it. It is hex_word, this returns &_hex[byte_start + 2]; so in serial_echo the parameters hex_word(UID[1]), hex_word(UID[0]), hex_word(UID[3]), hex_word(UID[2]), hex_word(UID[5]), hex_word(UID[4]) all turn into &_hex[byte_start + 2] so when SERIAL ECHO prints them it just print out the last contents of _hex[byte_start + 2] over and over. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Did you test the latest
bugfix-2.1.x
code?Yes, and the problem still exists.
Bug Description (Updated)
If you enable HAS_STM32_UID on a test device It now prints out a serial number, but the number is not correct
First a red hearing, the old code did not give correct results, see notes below. So comparing old results to current results will not help
But the output is still incorrect
On my hardware the Device electronic signature is the following 0x004d0030 0x4646500a 0x20353631
If you enable STM32_UID_SHORT_FORM so the UID is formatted the same as the hex dump above
using current code
SERIAL_ECHO(hex_long(UID[0]), hex_long(UID[1]), hex_long(UID[2]));
results in 203536312035363120353631 <- incorrect values
expanding out the code to multiple SERIAL_ECHO lines
results in 004D00304646500A20353631 <- correct result
With STM32_UID_SHORT_FORM disabled you get similar results
long form of code, with corrected indexes
results in CEDE2A2F-004D-0030-4646-500A20353631 <- correct result
but the index corrected condensed version
results in CEDE2A2F-3631-3631-3631-363136313631 <- incorrect values
Bug Timeline
recent
Expected behavior
Correct serial number should be reported
Actual behavior
you effectively get a random repeating numbers
Steps to Reproduce
Version of Marlin Firmware
Bugfix-2.1.x
Don't forget to include
test Configuration.zip
=== Related Issues
#26715
#26698
#26724
#26727
The text was updated successfully, but these errors were encountered: