Why can not change DBGMCU->CR in STM32F103
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-07-23 7: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?
- Labels:
-
DEBUG
-
STM32F1 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-07-23 7: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;
+ }
+ }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-07-23 7: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-07-23 9:37 AM
Check DBGMCU or AFIO clock enabled.
Up vote any posts that you find helpful, it shows what's working..
