Skip to content

Commit 9e20952

Browse files
soramame21adbridge
authored andcommitted
Add function to read 12byte HW RoT over STM32L4xx.
1 parent 83ca010 commit 9e20952

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

targets/TARGET_STM/TARGET_STM32L4/device/stm32l4xx_hal.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,18 @@ uint32_t HAL_GetDEVID(void)
403403
return(DBGMCU->IDCODE & DBGMCU_IDCODE_DEV_ID);
404404
}
405405

406+
/**
407+
* @brief Return the unique device identifier (UID based on 96 bits)
408+
* @param UID: pointer to 3 words array.
409+
* @retval Device identifier
410+
*/
411+
void HAL_GetUID_12Byte(uint32_t *UID)
412+
{
413+
UID[0] = (uint32_t)(READ_REG(*((uint32_t *)UID_BASE)));
414+
UID[1] = (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE + 4U))));
415+
UID[2] = (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE + 8U))));
416+
}
417+
406418
/**
407419
* @brief Return the first word of the unique device identifier (UID based on 96 bits)
408420
* @retval Device identifier

targets/TARGET_STM/TARGET_STM32L4/device/stm32l4xx_hal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ void HAL_ResumeTick(void);
582582
uint32_t HAL_GetHalVersion(void);
583583
uint32_t HAL_GetREVID(void);
584584
uint32_t HAL_GetDEVID(void);
585+
void HAL_GetUID_12Byte(uint32_t *UID);
585586
uint32_t HAL_GetUIDw0(void);
586587
uint32_t HAL_GetUIDw1(void);
587588
uint32_t HAL_GetUIDw2(void);

0 commit comments

Comments
 (0)