cancel
Showing results for 
Search instead for 
Did you mean: 

Some question about DWT working on the stm32F767

yuanfu xie
Associate
Posted on May 30, 2018 at 03:57

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? 

2 REPLIES 2
Tilen MAJERLE
ST Employee
Posted on May 30, 2018 at 07:20

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

Posted on May 30, 2018 at 08:26

OK  I have a try first