SRM32F411RE Interrupts don't work
Moderator: Benj
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
Re: SRM32F411RE Interrupts don't work
Hi,
The timer interrupt is likely working on the target device, but much faster than you expect.
Unfortunately, the calculated period in the Flowcode timer interrupt properties dialogue is incorrect.
This is because Flowcode is not aware of the PLL multiplier and other clock configuration parameters.
You have the Project Options clock speed correctly set to 8MHz for the HSI.
You will need to manually calculate the pre-scaler and rollover values,
based on the clock multipliers and divisors that you have set, to give your desired time period.
Hope that helps
Leigh
The timer interrupt is likely working on the target device, but much faster than you expect.
Unfortunately, the calculated period in the Flowcode timer interrupt properties dialogue is incorrect.
This is because Flowcode is not aware of the PLL multiplier and other clock configuration parameters.
You have the Project Options clock speed correctly set to 8MHz for the HSI.
You will need to manually calculate the pre-scaler and rollover values,
based on the clock multipliers and divisors that you have set, to give your desired time period.
Hope that helps
Leigh
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
Re: SRM32F411RE Interrupts don't work
Hi,
I've done an example based on your original Flowchart,
because on your settings above you have changed to HSE,
but I don't know your external crystal frequency.
btw. For HSI the clock speed should be set to 16MHz (not 8MHz, I was getting confused with the Nucleo board)
Or set this to your external crystal frequency if you use HSE.
Using the settings in your previously attached Flowcode project,
the internal HCLK will be 96MHz, and your APB1 Timer clock will also be 96MHz.
So, for example if you require a 100Hz Timer interrupt, the Interrupt properties should be:
Prescaler= 1:64
Rollover = 15000
The STM32CubeMX application is useful for visualising the clocks, here's a screen shot
Hope that helps
Leigh
I've done an example based on your original Flowchart,
because on your settings above you have changed to HSE,
but I don't know your external crystal frequency.
btw. For HSI the clock speed should be set to 16MHz (not 8MHz, I was getting confused with the Nucleo board)
Or set this to your external crystal frequency if you use HSE.
Using the settings in your previously attached Flowcode project,
the internal HCLK will be 96MHz, and your APB1 Timer clock will also be 96MHz.
So, for example if you require a 100Hz Timer interrupt, the Interrupt properties should be:
Prescaler= 1:64
Rollover = 15000
The STM32CubeMX application is useful for visualising the clocks, here's a screen shot
Hope that helps
Leigh
Re: SRM32F411RE Interrupts don't work
8MHZ,external crystal frequency . HSE
Downloaded it to the chip. It doesn't work
Can you help me check if there are any mistakes in the Settings?Thank you very much
Downloaded it to the chip. It doesn't work
Can you help me check if there are any mistakes in the Settings?Thank you very much
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
Re: SRM32F411RE Interrupts don't work
It looks Ok.
Have you tried a simple 1 second LED flash loop, with LED on/off and 1/2 second delays?
Without the timer interrupt.
Just to check the chip is programming and running OK?
Have you tried a simple 1 second LED flash loop, with LED on/off and 1/2 second delays?
Without the timer interrupt.
Just to check the chip is programming and running OK?
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
Re: SRM32F411RE Interrupts don't work
I've just run a similar program on a 32F446 and it works fine.
I also just noticed that in your latest Flowcode project that you have not changed the Timer Interrupt properties,
you still have Rollover as 1000, so unless you have an oscilloscope on your LED you might not see the on/off state change.
I also just noticed that in your latest Flowcode project that you have not changed the Timer Interrupt properties,
you still have Rollover as 1000, so unless you have an oscilloscope on your LED you might not see the on/off state change.
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
Re: SRM32F411RE Interrupts don't work
Hi,
I don't have them with me at the moment.
But I suggest you use the project that you first posted.
That used the internal HSI. (So will eliminate any possible issues with your external crystal)
In the project options screen, change the clock speed to 16MHz (from 8MHz)
and then in the Timer interrupt properties, change the Rollover Value to 15000,
as shown in my second post.
I don't have them with me at the moment.
But I suggest you use the project that you first posted.
That used the internal HSI. (So will eliminate any possible issues with your external crystal)
In the project options screen, change the clock speed to 16MHz (from 8MHz)
and then in the Timer interrupt properties, change the Rollover Value to 15000,
as shown in my second post.