2018-05-29 06:57 PM
I am using the STM32F7-Discovery board and have been stuck at trying to enable the DWT cycle ,From what I've seen online this should suffice for enabling it:
#define DWT_CR *((volatile unsigned int *)0xE0001000)
#define DWT_CYCCNT *((volatile unsigned int *)0xE0001004)#define DEM_CR *((volatile unsigned int *)0xE000EDFC)#define DBGMCU_CR *((volatile unsigned int *)0xE0042004)
#define ITM_LAR *((volatile unsigned int *)0xE0000FB0)#define DEM_CR_TRCENA (1 << 24)
#define DWT_CR_CYCCNTENA (1 << 0)void bsp_DWT_Init(void)
{ //ITM_LAR = 0xC5ACCE55; DEM_CR |= (unsigned int)DEM_CR_TRCENA; /* Enable Cortex-M4's DWT CYCCNT reg. */ //ITM_LAR = 0xC5ACCE55; DWT_CYCCNT = (unsigned int)0u; DWT_CR |= (unsigned int)DWT_CR_CYCCNTENA;}Infact ,the programs above work well on the stm32F4 serials.but not on the stm32F7serials .why?
2018-05-29 10:20 PM
Hello,
In Cortex-M7, you have to write
DWT->
LAR
=
0xC5ACCE55
; to enable access to DWT registers. This is not the case for Cortex-M4.
Best regards,
Tilen
2018-05-30 01:26 AM
OK I have a try first