Hi,
I wanted to change at runtime the iSerialNumber exposed by USB descriptor.
As Kenneth suggested (link), the solution has been to override the weak function in usb_descriptor.c
weak uint8_t *usb_update_sn_string_descriptor(void)
{
snprintk(usb_serial_str, sizeof(usb_serial_str), USB_SERIALNUMBER_TEMPLATE,
(uint32_t)(NRF_FICR->DEVICEADDR[1] & 0x0000FFFF)|0x0000C000,
(uint32_t)NRF_FICR->DEVICEADDR[0]);
return usb_serial_str;
}
with this one
uint8_t *usb_update_sn_string_descriptor(void)
{
snprintk(usb_serial_str, sizeof(usb_serial_str), USB_SERIALNUMBER_TEMPLATE, sn_recovered_from_littlefs);
return usb_serial_str;
}
The problem is that the override function is executed when the littlefs is still unmounted, thus sn_recovered_from_littlefs=0.
What's the storage location of the iSerialNumber "D0766E074450A9F0" the nRF5340 uses if untouched ?