Read UNIQUE ID and flash size method for stm32

/*
  读取stm32的unique id 与 flash size
*/
/*
 func: unsigned int Read_UniqueID_Byte(unsigned char offset)  
 desc: This function is used to read the unique ID in flash.
        parameter offset is the byte offset ,the max is 96/8= 12.
 return: the return value is indicated part of the unique ID.
*/
unsigned char Read_UniqueID_Byte(unsigned char offset)  
{  
    unsigned char id_byte;

        id_byte = *(unsigned char*)(0x1FFFF7E8+offset);           //ID基地址是0x1FFFF7E8

        return id_byte; 
}

/*
 func: unsigned short Read_Flash_Byte(void)  
 desc: This function is used to read flash size .This field value indicates 
    the Flash memory size of the device in Kbytes.
    example:0x100 means this flash size is 256 Kbytes.
        0x080 means this flash size is 128 Kbytes.
 return: the return value is flash size.
*/
unsigned short Read_Flash_Byte(void)  
{  
    unsigned short id_byte;

        id_byte = *(unsigned int*)(0x1FFFF7E0);           //flash size基地址是0x1FFFF7E0 

        return id_byte; 
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值