IRQ1 doesn't work on AT91SAM7S321?

Moderator: Benj

Post Reply
User avatar
PPerreijn
Flowcode V4 User
Posts: 7
Joined: Tue Mar 30, 2010 3:15 pm
Location: Heerlen, The Netherlands
Contact:

IRQ1 doesn't work on AT91SAM7S321?

Post by PPerreijn »

Hi everybody,

I've built two, identical, custom devices with the AT91SAM7S321 as main microcontroller. The device's ADC didn't work as expected, so I started bugtracking (again :roll: ).
The ADC pulls a signal line low when there's a new sample available. This signal line is connected to pin D6 (hardware pin 42, ARM pin PA30), a pin that can be used as the MCU's second interrupt line (IRQ1).
Both devices were unable to pick up any line changes, even with the simple test program below:

Image

After that, I made a hardware bypass (wire jump) from the ADC's line to pin D3 (hardware pin 16, ARM pin PA20), the MCU's first interrupt line (IRQ0). This time I was able to pick up the line changes and everything worked as expected: a nice steady square wave on output pin C5. Doesn't seem to be a hardware problem as pin D6 does work as a normal input/output.
Trouble is that I really need pin D3 (IRQ0) for other purposes and want to use IRQ1 as interrupt input. My guess is that there's another error in one of the .h and/or .c-files, but which one? Can somebody please look into this? Thanks in advance.

Paul

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: IRQ1 doesn't work on AT91SAM7S321?

Post by Sean »

Hello Paul,

We are looking into this problem. It appears to be related to the use of PA30 as both a signal output and an interrupt input. This should be possible, but might be affected by the order of the commands during initialization (the output function should be initialized last as input initialization often disables output drivers).

Some more details of the initialization and ADC code might help us identify this problem.

Another possible alternative, depending on your application, would be to use the ADC interrupt (as a custom interrupt) to directly control the PA30 output, and other functions, without requiring IRQ1.

User avatar
PPerreijn
Flowcode V4 User
Posts: 7
Joined: Tue Mar 30, 2010 3:15 pm
Location: Heerlen, The Netherlands
Contact:

Re: IRQ1 doesn't work on AT91SAM7S321?

Post by PPerreijn »

Hello Sean,

Thank you for your reply. Just to make sure I'm not making it harder for you as it already is: I don't need pin PA30 (D6) to be a GPIO as well as an interrupt. It only needs to be an interrupt, IRQ1.
As for the ADC: it's fairly simple to use. You don't need any code to control it, you just toggle pins. As you can see in my test program I only need to set pin C2 high to make it take samples.
Normally I would of course read the samples using SPI, but I need the interrupt line to tell me when it's safe to read the ADC's memory. Otherwise I would get corrupted readings.
Here's the ADC's datasheet by the way: http://www.ti.com/lit/gpn/ads1271. The ADS1271 from TI, a quite fast and accurate little device 8)

Paul

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: IRQ1 doesn't work on AT91SAM7S321?

Post by Sean »

Here is a new FCD file for the AT91SAM7S321. The original seems to contain an error in the initialization of the IRQ1 interrupt.
AT91SAM7S321.fcd
(13.17 KiB) Downloaded 432 times
If you copy the attached file into the FCD folder of your Flowcode installation (overwriting the original) it should solve the IRQ1 problem.

User avatar
PPerreijn
Flowcode V4 User
Posts: 7
Joined: Tue Mar 30, 2010 3:15 pm
Location: Heerlen, The Netherlands
Contact:

Re: IRQ1 doesn't work on AT91SAM7S321?

Post by PPerreijn »

Hello Sean,

Just wanted to say that the patch works; IRQ1 now behaves as it should. Thank you for your help.

Paul

P.S. now that you've changed your avatar from Klunk to your photo: did I see you at Elektor Live in Eindhoven?

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: IRQ1 doesn't work on AT91SAM7S321?

Post by Sean »

Thanks for the feedback on the patch. I will make sure all the other device files are updated correctly.

Yes, I was at Elektor Live. I hope you enjoyed the show.

All our avatars have now been changed to photos (I hope they don't deter other forum users).

Post Reply