cancel
Showing results for 
Search instead for 
Did you mean: 

F446-429, core_cm4.h for NVIC setup?

Mikas Longbardi
Associate II
Posted on August 06, 2017 at 03:26

F446/F429

Hi.

Im trying to get NVIC work but it's very confusing, i dont do HAL/SPL.

Are core_cm4.h all thats needed to setup and use NVIC?

I basically 

need to get ADC1 to cause an interrupt so data can be processed.

I trying NVIC via SPL but i get weird compilation errors for things that

has nothing to do with NVIC and i would be glad not to be forced to use SPL.

Thanks in advance for your time.

3 REPLIES 3
Posted on August 06, 2017 at 15:21

You still likely want to pull in stm32f4xx.h to define structures and register descriptions.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Mikas Longbardi
Associate II
Posted on August 06, 2017 at 21:17

Well obvious, but i was thinking of something 'none obvious and specific' such as 

SCB memory address is defined

in core_cm4.h which in a roundabout way is included by misc.c etc, etc, 

in this world of  ST abstractedness.

Anyhow i got NVIC to work with only core_cm4.h, now some fine tuning work to do.

void nvic(void)

{

/******************** NVIC configuration ***************************/

NVIC_ClearPendingIRQ(ADC_IRQn); //Clear Pending Interrupt

NVIC_SetPriorityGrouping(1);  //

NVIC_SetPendingIRQ(ADC_IRQn);  //Set Pending Interrupt

NVIC_SetPriority(ADC_IRQn,5);  //ADC_IRQn have priority level of 5

NVIC_EnableIRQ(ADC_IRQn);  //Enable interrupt from ADC1,2,3

}

Posted on August 07, 2017 at 09:47

Hello

pic24hj

‌,

the same way as SCB block, you can use NVIC structure pointer and use interrupt implementation on your own. But it is suggested that you use code provided by ARM (NVIC and MISC) is part of this code.

There is also startup code where vectors are defined for functions.