AnsweredAssumed Answered

Real-time command execution STM32F407

Question asked by msn on Jul 1, 2012
Latest reply on Jul 4, 2012 by msn
Hi, everyone.

Testing STM32F407.
Runs it at 168 MHz (5.92 ns cycle), FLASH-> ACR = FLASH_ACR_DCEN | FLASH_ACR_ICEN | FLASH_ACR_PRFTEN | FLASH_ACR_LATENCY_5WS.
Outstanding at the PA1 a simple square wave:

  PM_(RCC->AHB1ENR, RCC_AHB1ENR_GPIOAEN) = 1;                           // GPIOA clock enabled
  PM_(GPIOA->MODER, GPIO_MODER_MODER1_0) = 1;                           // PA1 - General purpose output mode
  GPIOA->OSPEEDR |= GPIO_OSPEEDER_OSPEEDR1;                             // PA1 - 100 MHz High speed

while (1)
{
GPIOA-> BSRR = GPIO_BSRR_BS_1;
GPIOA-> BSRR = GPIO_BSRR_BR_1;

GPIOA-> BSRR = GPIO_BSRR_BS_1;
GPIOA-> BSRR = GPIO_BSRR_BR_1;

GPIOA-> BSRR = GPIO_BSRR_BS_1;
GPIOA-> BSRR = GPIO_BSRR_BR_1;

GPIOA-> BSRR = GPIO_BSRR_BS_1;
GPIOA-> BSRR = GPIO_BSRR_BR_1;

GPIOA-> BSRR = GPIO_BSRR_BS_1;
GPIOA-> BSRR = GPIO_BSRR_BR_1;
}


Compiled as follows:
STR r1, [r0, # 0x18]
STR r2, [r0, # 0x18]

STR r1, [r0, # 0x18]
STR r2, [r0, # 0x18]

STR r1, [r0, # 0x18]
STR r2, [r0, # 0x18]

STR r1, [r0, # 0x18]
STR r2, [r0, # 0x18]

STR r1, [r0, # 0x18]
STR r2, [r0, # 0x18]

B | L1.6 |

On the oscilloscope can see this signal (Attachments img)
https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Attachments/23318/01.png

This means that the Branch instruction is actually executed in 3 cycles?
I have to debug in Keil stm32f4discovery.
At the Branch instruction cycle counter in the Keil (States) increased by 1.
In addition, using SysTick and DWT-> CYCCNT, they are also incremented by 1 for instructions Branch.

Why is it so?

Attachments

Outcomes