cancel
Showing results for 
Search instead for 
Did you mean: 

Can you have too many peripheral init functions?

MFolk.1
Senior

Here is a weird one for ya.

I am programming on the STM32L4R9I-EVAL dev board, but my project is configured

for the STM32L4S9AII6. I am clocked at 120MHz.

My program has started failing for what seems to be because I have too many

MX_<peripheral>_init() functions. Can you configure too many peripherals?

I started getting this bug off and on as I was getting my TIM15 peripheral up and

running. I now have my TIM15 working, or I should say I had it working until

now. I thought before that the TIM15 was the culprit as that was what I was

working on. So I would comment out it's init function in main() and then the

error would go away. I would mess around some more in MxCube and then the

problem would go away (for a while). This seemed to be a repeating theme as I

worked on that.

So I moved on writing a small amount of other code that had nothing to do with any

peripheral and this problem happened again. Only this time, I don't dare mess

with MxCube because before this everything was working perfectly. What is funny

now though is that I notice that the problem goes away when I comment out

MX_TIM15_Init() as before, but now I thought to try commenting out other

peripheral init functions as well. Low and behold, it doesn't matter what init

function I choose to comment out. If I comment out any one of them, this error

goes away.

Enough of the back story, here is the error that I am referring to:

After attempting to run HAL_Init() at the very beginning of the program (and before

any peripheral init function has a chance to be called), the program tries to

run code outside the allocated memory space as shown here:

0693W00000KcBcqQAF.png 

This is super weird to me because (again) the error occurs before any peripheral init function has a chance to run. So how in the world does commenting out code that never has a chance to execute cause this error to go away? Again, do I have to many peripheral init functions? Again, it does NOT matter which function I choose to comment out, the problem will go away if I comment out ANY one of them.

Here are the init functions as they currently exist in my program:

MX_GPIO_Init();

 MX_DMA_Init();

 MX_ADC1_Init();

 MX_DAC1_Init();

 MX_I2C1_Init();

 MX_I2C2_Init();

 MX_IWDG_Init();

 MX_OCTOSPI1_Init();

 MX_OCTOSPI2_Init();

 MX_SPI1_Init();

 MX_SPI2_Init();

 MX_SPI3_Init();

 MX_TIM15_Init();

 MX_USART1_UART_Init();

I'm sorry but this is just weird. Any hints would be greatly appreciated. Thanks!

10 REPLIES 10

Those are CPU core registers and are documented in a "programming manual". In this case of Cortex-M4 it's the PM0214.