-
Notifications
You must be signed in to change notification settings - Fork 54
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
Identical device serial numbers #85
Comments
You can build your own FW with hardcoded serial numbers for each of your devices, see the source code. |
I would suggest using the STM32's 96-bit unique ID, either directly or better yet hashed, to create a unique serial number per device. The STM32F303xC Reference Manual RM0316 documents the unique ID in section 34.1. The benefit for the user would be that if a user connects more than one TinySA Ultra to a computer, then the COM port or /dev/tty will stay assigned to the same TinySA Ultra. Probably not a top priority issue, but it would be a good-to-have feature. Side note: if there is a need to communicate the firmware version number, that could still be done by prefixing the serial number string with the current version number format. Alternatively, the firmware version number can be communicated using the bcdDevice field of the USB Device Descriptor. It uses BCD format typically as 0xMMJJ or 0xMMJK where M = major number, J = minor number, K = patch number (your choice of each format). |
Proof of concept for the unique IDChange uint8_t vcom_string3[50] = { // 2 byte config + 24 wchar string
USB_DESC_BYTE(50), // bLength.
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), // bDescriptorType.
};
static const uint8_t HEX[] = {
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
};
void get_uuid() {
uint8_t *uuid = (uint8_t *)0x1FFFF7AC; // Unique device ID register (12 byte)
for ( int iii = 2; iii < 50; iii+=4 ) { // put into serial number string at these positions
uint8_t idPart = *uuid++; // fetch next byte
vcom_string3[iii] = HEX[idPart >> 4]; // encode high nibble as hex char, next byte is 0x00
vcom_string3[iii+2] = HEX[idPart & 0x0F]; // encode low nibble as hex char, next byte is 0x00
}
} declare it extern in I did this for tinySA as well as for NanoVNA
The 12 bytes of the UUID correspond to this structure, STM32 uses little endian: struct UUID {
uint16_t X; // X coordinate of chip on wafer
uint16_t Y; // Y coordinate of chip on wafer
uint8_t WAF; // Wafer number as byte
char LOT[7]; // Lot number as string w/o zero term
}; Im my code above the USB sernum string is shown as I found also this STM example code how to represent the USB sernum string. |
create a 12 char string based on the Arduino algorithm https://github.com/limbongofficial/STM32_Core-Arduino/blob/master/cores/arduino/stm32/usb/usbd_desc.c#L326-L370 Signed-off-by: Martin <[email protected]>
inspired by erikkaashoek/tinySA#85 create a 12 char string based on the Arduino algorithm https://github.com/limbongofficial/STM32_Core-Arduino/blob/master/cores/arduino/stm32/usb/usbd_desc.c#L326-L370 Signed-off-by: Martin <[email protected]>
At a glance, the code looks fine. I have not confirmed/tested it. |
I would like to connect multiple tinySA devices to the same computer, identifying them based on their serial number as reported by udev.
It turns out that multiple of my tinySA seem to share the same serial number (400). Is there a way to change this?
The text was updated successfully, but these errors were encountered: