Skip to content

Instantly share code, notes, and snippets.

View aynka's full-sized avatar

Ramachandiran Aynkaran aynka

  • KPH Technical Services Pte Ltd
  • Singapore
View GitHub Profile
@aynka
aynka / gist:c512be08a3ca3613855f88cc985addc1
Created July 8, 2023 10:43
Decoding and making a Serial Number from STM32 96bit UID
uint16_t snprint_stm32_serialno(char* p, uint16_t maxlen)
{
uint32_t uid0 = *(uint32_t*) (UID_BASE);
uint32_t uid1 = *(uint32_t*) (UID_BASE + 0x4);
uint32_t uid2 = *(uint32_t*) (UID_BASE + 0x8);
uint16_t n = 0;
if (maxlen > 16)
{