2020-07-23 07:13 AM
I'm use STM32F103C8T6. I use DBGMCU->CR = DBGMCU_CR_TRACE_IOEN to change the value of DBGMCU->CR, but the operation is failed after POR, the register is alway read 0.
I suspect that the cause of this problem is the the debug component is not be powered up or not be clocked, so I try to power up debug component by set DP CTRL/STAT register to 0x50000000 by sending data to SWD port, and then the DBGMCU->CR can be changed as expected.
So my question is: how to power up debug component from application directly, rather than using the debug port?
2020-07-23 07:24 AM
Here some code I use in bl*ckm*g*c:
+ while(1) {
+ ctrlstat = adiv5_dp_read(dp, ADIV5_DP_CTRLSTAT);
+ uint32_t check = ctrlstat & (ADIV5_DP_CTRLSTAT_CSYSPWRUPACK |
+ ADIV5_DP_CTRLSTAT_CDBGPWRUPACK);
+ if (check == (ADIV5_DP_CTRLSTAT_CSYSPWRUPACK |
+ ADIV5_DP_CTRLSTAT_CDBGPWRUPACK))
+ break;
+ if (platform_timeout_is_expired(&timeout)) {
+ DEBUG_INFO("DEBUG Power-Up failed\n");
+ return;
+ }
+ }
2020-07-23 07:40 AM
Using SWD port to power up debug component is succussfull, I tested it. I want to power up it in application code, not SWD port.
2020-07-23 09:37 AM
Check DBGMCU or AFIO clock enabled.