Interrupt | Cypress Semiconductor


Summary: 2 Replies, Latest post by odissey1 on 28 Nov 2015 11:18 AM PST
Verified Answers: 1
Last post
Log in to post new comments.
AM49840_1477916's picture
1 post

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  


 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

user_78878863's picture
2551 posts

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.

user_342122993's picture
527 posts

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.

Log in to post new comments.