Hello MikroBasic users,
I am absolutely new to the use of 32bit controllers.
Until now I have been working a lot with AVR's and Bascom.
I have also done some programming in assembler.
But now I need a controller with much more speed for trigonometric calculations, 5 external interrupts and some outputs.
I thought the STM32F411 would be good for this.
Floating point calculation, 168MHz .....
But now I had to realise that an interrupt call and the return from the ISR takes a lot of clocks on an STM411.
Into the ISR 51 clocks, back out of the ISR 53 clocks.
Is that normal ?
If I test it with a STM32F103, this only needs
17 clocks into the ISR and 19 clocks out.
(according to the MicroBasic debugger).
What am I doing wrong here?
Best regards , Gerhard
Code: Select all
' * Project name:
' external_interrupt
' * Test configuration:
' Device: STM32F103
' Device: STM32F411
program External_interrupt
sub procedure ExtInt() iv IVT_INT_EXTI15_10 ics ICS_AUTO
EXTI_PR.B10 = 1 ' clear flag
GPIOA_ODR = not GPIOA_IDR ' Togle PORTA
end sub
main:
GPIO_Digital_Output(@GPIOA_BASE, _GPIO_PINMASK_HIGH) ' Enable digital output on PORTA
GPIOA_ODR = 0xAAAA
GPIO_Digital_Input(@GPIOD_BASE, _GPIO_PINMASK_10) 'Pin PortD.B10 is input
SYSCFGEN_bit = 1 ' STM32F411 Enable clock for alternate pin functions
SYSCFG_EXTICR3 = 0x00000300 ' STM32F411 Map external interrupt on PD10
'RCC_APB2ENR.AFIOEN = 1 ' STM32F103 Enable clock for alternate pin functions
'AFIO_EXTICR3 = 0x0300 ' STM32F103 PD10 as External interrupt
EXTI_RTSR = 0x00000400 ' Set interrupt on Rising edge
EXTI_IMR = EXTI_IMR or 0x00000400 ' Set mask
NVIC_IntEnable(IVT_INT_EXTI15_10) ' Enable External interrupt
EnableInterrupts() ' Enables the processor interrupt.
while(TRUE)
nop
wend ' Infinite loop
end.