- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ide:ads
steps:
1.Making a 1ms timer:
static void prvSetupTimerInterrupt( void )
{
IfxStm_Timer_Config timerConfig;
IfxStm_Timer_initConfig(&timerConfig, STMs[CPU_ID]);
timerConfig.base.frequency = 1000; //1ms
timerConfig.base.isrPriority = 2;
IfxStm_Timer_init(&Timers[CPU_ID], &timerConfig);
IfxStm_Timer_run(&Timers[CPU_ID]);
}
IFX_INTERRUPT(stm0_isr, 0, 2)
{
counter1ms++;
}
2.
delay(int ms)
{
var old=counter1ms;
while(counter1ms-old>=ms);
}
core0_main()
{
.....//init code
prvSetupTimerInterrupt();
boolean interruptState = IfxCpu_disableInterrupts();
int32_t i=1000000;
while(i--);//Simulate time-consuming operations, such as flash operations
IfxCpu_restoreInterrupts(interruptState);
delay(10);
}
Problem:
When the simulation time-consuming operation( such as while i--, or flash operations ) takes a little time and the delay (10) function is executed, the STM timer will no longer enter the interrupt, until after a period of time, the STM will re-enter the interrupt (may be STM overflow?)
How to solve this problem?
- Tags:
- IFX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
IFX_INTERRUPT(stm0_isr, 0, 2)
{
counter1ms++;
IfxStm_Timer_acknowledgeTimerIrq( &timerConfig );
}
Have a look at StmDemo.c for a full implementation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
But the problem still exists
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,Do you solve it?I ran into the same problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @JexJiang . What does your ISR look like? The iLLD API has changed a bit, and this is the new implementation per the iLLD documentation:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yes, This is my ISR.but when i used
boolean interruptState = IfxCpu_disableInterrupts();
//to do some things
IfxCpu_restoreInterrupts(interruptState);
It can't enter ISR.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hmm, that's odd - once the interrupt is pending, the ISR should be invoked after interrupts are restored, regardless of how long interrupts were disabled.
Can you try adding a line before the IfxCpu_restoreInterrupts line to capture the interrupt pending flag into a global variable? Something like this:
stm0_pending = SRC_STM0SR0.B.SRR;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi:
Thanks for your reply.I created a new project and tested it. The reason is not that the STM interrupt is not generated, but that it entered the state of IfxCpu_Trap_contextManagementError. I started a new question:https://community.infineon.com/t5/AURIX/TC397-STM-Interrupt-and-Pflash-operation-conflict/m-p/330626...