HAL DBGMCU Use Cases

Get Device ID

@startuml
' To add a number by line
'autonumber

' Fix order of each column
participant "User Application" as user
participant "DBGMCU Driver" as DBGMCU

group #lightblue  DBGMCU Get Device ID
user->DBGMCU : HAL_DBGMCU_GetDeviceID()
user<--DBGMCU: Device ID 
end

@enduml

Called functions:

Get DevRevision ID

@startuml
' To add a number by line
'autonumber

' Fix order of each column
participant "User Application" as user
participant "DBGMCU Driver" as DBGMCU

group #a6d2f6ff DBGMCU Get Revison ID
user->DBGMCU : HAL_DBGMCU_GetRevisionID()
user<--DBGMCU: Revison ID 
end

@enduml

Called functions:

Debug in low power mode(s)

@startuml
hide footbox
participant "User Application" as user
participant "DBGMCU Driver" as DBGMCU

group #lightblue Debug during low power mode(s)
user->DBGMCU : HAL_DBGMCU_EnableDebugLowPowerMode()
note right : Enable the debug during low power mode(s)
user->DBGMCU : HAL_DBGMCU_IsEnabledDebugLowPowerMode()
DBGMCU-->user : The debug during low power mode is enabled
user->DBGMCU  : HAL_DBGMCU_DisableDebugLowPowerMode()
note right : Disable the debug during low power mode(s)
user->DBGMCU : HAL_DBGMCU_IsEnabledDebugLowPowerMode()
DBGMCU-->user : The debug during low power mode is disabled
end

@enduml

Called functions:

Freeze / Unfreeze TIM 1

@startuml
hide footbox
participant "User Application" as user
participant "DBGMCU Driver" as DBGMCU
participant "TIM Driver" as TIM
participant "RCC Driver" as RCC

== TIM1 HAL Initilaization ==
group #c6ffc6ff Initialization
user->TIM : HAL_TIM_Init()
alt#grey #lightgrey If USE_HAL_TIM_CLK_ENABLE_MODEL = HAL_CLK_ENABLE_NO
TIM->RCC : Enable the TIM1 clock
end
TIM --> user: HAL_OK
end

== DBGMCU Freeze TIM1 ==
group #e2fde2ff Freeze the clock of TIM1
user->DBGMCU : HAL_DBGMCU_TIM1_Freeze()
note right : Freeze the clock of TIM1 when the CPU is in debug mode
user->TIM : HAL_TIM_SetConfig()
TIM --> user: HAL_OK
user->TIM : HAL_TIM_Start()
TIM --> user: HAL_OK
user->TIM : HAL_TIM_GetCounter()
note left : Add Break Point to **HAL_TIM_GetCounter()**
TIM-->user : Counter value
note right : TIM1 is frozen while CPU is in debug mode
end

== DBGMCU Unfreeze TIM1 ==
group #ecf3ecff  Unfreeze the clock of TIM1
user->DBGMCU : HAL_DBGMCU_TIM1_UnFreeze()
note right : Unfreeze the clock of TIM1 when the CPU is in debug mode
user->TIM : HAL_TIM_SetConfig()
TIM --> user: HAL_OK
user->TIM : HAL_TIM_Start()
TIM --> user: HAL_OK
user->TIM : HAL_TIM_GetCounter()
note left : Add Break Point to **HAL_TIM_GetCounter()**
TIM-->user : Counter value
note right : TIM1 continues to operate while CPU is in debug mode
end

@enduml

Called functions: - HAL_DBGMCU_TIM1_Freeze() - HAL_DBGMCU_TIM1_UnFreeze()

Freeze / Unfreeze DMA Channel 0

@startuml
hide footbox
participant "User Application" as user
participant "DBGMCU Driver" as DBGMCU
participant "DMA Driver" as DMA
participant "RCC Driver" as RCC

== DMA HAL Initialization ==
group #f9e5c7ff Freeze / Unfreeze the clock of DMA Channel 0 
user->DMA : HAL_DMA_Init()
alt#grey #lightgrey If USE_HAL_DMA_CLK_ENABLE_MODEL = HAL_CLK_ENABLE_NO
DMA->RCC : Enable the DMA clock
end
DMA --> user: HAL_OK
end

== DBGMCU Freeze DMA ==
group #faf2e7ff Freeze DMA Channel 0
user->DBGMCU : HAL_DBGMCU_GPDMA1_Ch0_Freeze()
note right : Freeze the clock of DMA channel 0 when the CPU is in debug mode
user->DMA : HAL_DMA_SetConfigDirectXfer()
DMA --> user: HAL_OK
user->DMA : HAL_DMA_StartDirectXfer()
DMA --> user: HAL_OK
user->DMA : HAL_DMA_PollForXfer()
note left : Add Break Point to **HAL_DMA_PollForXfer()**
DMA-->user : HAL_TIMEOUT
note right : DMA channel 0 is frozen while CPU is in debug mode
end

== DBGMCU Unfreeze DMA ==
group #fefcf9ff Unfreeze DMA Channel 0
user->DBGMCU : HAL_DBGMCU_GPDMA1_Ch0_UnFreeze()
note right : Unfreeze the clock of DMA channel 0 when the CPU is in debug mode
user->DMA : HAL_DMA_SetConfigDirectXfer()
DMA --> user: HAL_OK
user->DMA : HAL_DMA_StartDirectXfer()
DMA --> user: HAL_OK
user->DMA : HAL_DMA_PollForXfer()
note left : Add Break Point to **HAL_DMA_PollForXfer()**
DMA-->user : HAL_OK
note right : DMA channel 0 continues to operate while CPU is in debug mode
end

@enduml

Called functions: - HAL_DBGMCU_LPDMA1_Ch0_Freeze() - HAL_DBGMCU_LPDMA1_Ch0_UnFreeze()