获取单片机唯一id(stm32获取单片机唯一id)

stm32唯一id:
不同型号的stm32单片机,id不在同一地址上!具体地址可以通过用户手册中的Device electronic signature>Unique device ID register来获取。
  1. stm32f072:
    • uint32_t id[3];
      id[0] = *(__IO uint32_t *)(0x1FFFF7AC);
      id[1] = *(__IO uint32_t *)(0x1FFFF7B0);
      id[2] = *(__IO uint32_t *)(0x1FFFF7B4);
  2. stm32f103:
    • uint32_t id[3];
      id[0] = *(__IO uint32_t *)(0x1FFFF7E8);
      id[1] = *(__IO uint32_t *)(0x1FFFF7EC);
      id[2] = *(__IO uint32_t *)(0x1FFFF7F0);
  3. stm32f407:
    • uint32_t id[3];
      id[0] = *(__IO uint32_t *)(0x1FFF7A10);
      id[1] = *(__IO uint32_t *)(0x1FFF7A14);
      id[2] = *(__IO uint32_t *)(0x1FFF7A18);
posted @ 2018-06-27 17:06  花火·  阅读(1513)  评论(0编辑  收藏  举报