how to set USB serialnumber as the ble mac address

Hi,

    my product now is base on the nrf5340,  I want to set the USB's serialnumber same as the ble mac address.

    when I use the nrf52840,  I can set it as follows simply.

    

int32_t z_impl_hwinfo_get_device_id(uint8_t *buffer, size_t length)
{
    uint16_t serial_num_high_bytes = sys_cpu_to_be16(((NRF_FICR->  DEVICEADDR[1]) & 0xffff) | 0xC000);
    uint32_t serial_num_low_bytes  = sys_cpu_to_be32(NRF_FICR->DEVICEADDR[0]);

    memcpy(buffer, (uint8_t *)&serial_num_high_bytes, 2);
    memcpy(buffer + 2, (uint8_t *)&serial_num_low_bytes, 4);
    return 6;
}

    I found the DEVCIEADDR in the network core,  but it is not accessible from the application core. 

    is there another way to set the USB serialnumber dynamically?

Related