AnsweredAssumed Answered

Unique device ID address in STM32F2xx

Question asked by sheehy.rosemarie on Dec 10, 2013
Latest reply on Dec 10, 2013 by Andrew Neil
Hi,

I have been looking for some time and I cannot find an answer.
In a previous project I found the UID for the STM32F107 using the following function. Can someone tell me what the equivalent for STM32F2 is?

void GetDeviceID(void)
{
u8 HexTmp, H_HexTmp,L_HexTmp,i;
u32 Dev_Serial0, Dev_Serial1, Dev_Serial2;
u8 HEX[6] ={'A','B','C','D','E','F'};


Unique_Device_ID[24] = '\0';
    
Dev_Serial0 = *(vu32*)(0x1FFFF7E8);
Dev_Serial1 = *(vu32*)(0x1FFFF7EC);
Dev_Serial2 = *(vu32*)(0x1FFFF7F0);


for(i=0;i<24;)
     {
    if( 0==i ) HexTmp = (u8)Dev_Serial0; 
    else if( 2==i ) HexTmp = (u8)( Dev_Serial0 >> 8 );
    else if( 4==i ) HexTmp = (u8)( Dev_Serial0 >> 16 );
     else if( 6==i ) HexTmp = (u8)( Dev_Serial0 >> 24 );
     else if( 8==i ) HexTmp = (u8)Dev_Serial1; 
     else if( 10==i ) HexTmp = (u8)( Dev_Serial1 >> 8 ); 
     else if( 12==i ) HexTmp = (u8)( Dev_Serial1 >> 16 );
     else if( 14==i ) HexTmp = (u8)( Dev_Serial1 >> 24 );
     else if( 16==i ) HexTmp = (u8)Dev_Serial2;
     else if( 18==i ) HexTmp = (u8)( Dev_Serial2 >> 8 );
     else if( 20==i ) HexTmp = (u8)( Dev_Serial2 >> 16 );
     else if( 22==i ) HexTmp = (u8)( Dev_Serial2 >> 24 );
      
     H_HexTmp = HexTmp >> 4;
     L_HexTmp = HexTmp & 0x0F;
   
   
     if( L_HexTmp > 9 )
          Unique_Device_ID[i+1] = HEX[ L_HexTmp - 10 ];
     else
          Unique_Device_ID[i+1] = L_HexTmp + '0';
     if( H_HexTmp > 9 )
          Unique_Device_ID[i+0] = HEX[ H_HexTmp - 10 ];  
     else
         Unique_Device_ID[i+0] = H_HexTmp + '0';
    i += 2;
    }  
}

I see from some earlier posts that the start address is 0x1FFF7A10 but do I increment in 4 Bytes?





Outcomes