- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I am building a simple digital piano for my little sister. Nothing serious, just some bush buttons connected to intterupts, when a button is pressed the intterupt writes a value to a control register. the control register works as a select signal for a mux. the mux inputs are differnet clocks which serve as the piano tunes.
Now, the hardware is connected perfectly, every intterupt triggers perfectly, so here is the weird part:
When I press the first bush button, which is the tune A, everything works as it should, the intterupt triggers, the control register is written, then the return statement is excuted which brings the program back to main.
when I press the second bush button, the intterupt triggers, the control register is written, but the return statment is IGNORED. the program just keeps going to the next ISR where the its return statment is also ignored, and the next and the next until it creats an infinte loop outside of main.
I have uploded the project on two links if you care to shed some light on this problem.
http://www.mediafire.com/download/sp7z1hvm2ccu3eh/Simple_Piano_Using_Square_Waves.Bundle01.zip
https://drive.google.com/file/d/0BwvX4pp-M0KyNzlqY00yWUZzOGc/view?usp=sharing
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What do you mean with "goes to the next ISR"? Is the same ISR called again?
How did you find about this? With the debugger? The reason might be that the interrupt trigger is level-based and not edge-based. Then it will be active as long as the button is pressed (and be executed when the interrupt-flag is cleared inside of the ISR)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes I found that problem using the debugger, and what I mean by "goes to the next ISR" is that it finishes whatever I programmed the ISR to do and moves to perform the next ISR although it was not triggered. for example, when I press button 2 (tone C) the C ISR is performed. as soon as it is finished it moves directly to perform the D ISR without the intterupt being triggered, and then moves to the E ISR and so on until it returns to the C ISR and creates a loop.
all the intteurpts are rising edge based.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No need, I found the problem, it was with the switch connections.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That sounds interesting. How does a faulty switch wiring cause triggering one ISR after another?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
GPIO Interrupts covered here (explanation of port wide behaviour) -
http://www.cypress.com/?rID=57571
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@hli, no idea. I connected 5 switches with a pull down resistor, but only the first switch worked as it should. I removed the pull down connections and it worked like a charm. it still is a very strange problem.
@Dana, the answer might be in your document, I'll make sure to read it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the document provieded by Dana, on page 16 it mentions 2 ports configured as a rising edge and falling edge interrupts.
3. Configure P6[0] as a resistive pull-down pin, or add
an external pull-down.
4. Configure P6[1] as a resistive pull-up pin, or add an
external pull-up.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you double up on PU's or PD's for sure you will burn more
power when switch closed.
Rare but if SW had high R when closed you might not meet noise margin,
eg. reflect a switch closure.
Just use internal, simpler.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, trust me Dana when I tell you that the lesson is well learned and won't be forgotten. Thank u.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Glad the forum was able to help.
Regards, Dana.