Hello everyone,
On my PSoC I have 2 interrupts one at 2000Hz and one at 100Hz as you can see in attachment.
In the first interrupt ISR_Dyna I ask datas via UART at 460000 Baud
In the second interrupt ISR_Stat I ask others datas via the same UART at 460000 Baud
My problem is that I can't have both interrupt at same time because I receive data by UART Interrupt and if ISR_Dyna is asking datas and ISR_Stat is asking Data at the same time there will be conflicts and I will be stuck in my sequencer.
So to avoid that in my code I do Start and Stop each Interrupt, but I don't know if its the best way to do it?
Actually I made a mistake in my code and it was workingbut I don"t understand why.
My code was:
if(countMain==100){ // ask datas at 2000Hz
isr_dyna_Stop(); //
isr_stat_StartEx(dynamique); //
}
if (countMain==115){ // ask datas at 100Hz
isr_dyna_Stop(); //
isr_stat_StartEx(statique); //
}
And as you can see my mistake is instead of write
isr_stat_Stop();
isr_dyna_StartEx(dynamique);
I wrote in the first If
isr_dyna_Stop(); //
isr_stat_StartEx(dynamique); //
So my code work with the mistake and I don't understand why,and if I correct my mistake, it work 3-4 time and after it stucks.
Thank you
Solved! Go to Solution.
Two interrupts of the same priority won't run at the same time. So there is no need to disable/enable one. The ISR that comes second will just wait until the first one finishes.
Two interrupts of the same priority won't run at the same time. So there is no need to disable/enable one. The ISR that comes second will just wait until the first one finishes.
Since it is a fixed ratio 20/1, and single UART channel, it would be prudent to have only one 2000Hz interrupt, counting 0-20, and on 20th time to request both infos. Hard to say more without seeing the code.