A
A
Alexander Wolf2018-08-11 14:01:45
Microcontrollers
Alexander Wolf, 2018-08-11 14:01:45

Why can't an interrupt be called?

Good afternoon!
I'm trying to start a SysTick timer in STM32F030F4P6.
I enable interrupts globally, set all the parameters for SysTick, the timer ticks, sets the SCB_ICSR_PENDSTSET flag in ICSR, sets the COUNTFLAG reset bit, but does not enter the interrupt. I've already tried a bunch of things, rummaged through tons of documentation. Should work, but doesn't.

__enable_irq();
SysTick->CTRL = 0b110;
SysTick->LOAD = CPU_SPEED / 100; // 10ms
SysTick->VAL = 0;
SysTick->CTRL = 0b111;

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
LampTester, 2018-09-27
@LampTester

Use NVIC_EnableIRQ() instead of __enable_irq(). This is how interrupts are enabled in ARM.
And yes, define a handler if you haven't already. Just copy (but don't remove it from its original place!) the desired name from startup_xxx.S to main.c, formatting it as a function.

void SysTick_Handler(void)
{
}

V
vanyamba-electronics, 2018-08-12
@vanyamba-electronics

I didn't get my handler called because the linker didn't want to override the weak functions.
Googling arm-gcc weak function override found a key to add to the Makefile .
It was a long time ago, it seems to be --partial .
Why does the linker select weak definitions instea...
I don't remember exactly, maybe -ffunction-sections should have been added.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question