Reply by kumori0 April 9, 20082008-04-09
I'm afraid I don't have IAR compiler, I'm using gcc, after Lynch's
tutorial. I have located the macros that should enable and disable the
interrupts in my hello world example, but I can't figure out what
exactly do they do.
Could someone help me with this?

I have the following code: http://pastebin.com/m663dc4d

And I can't figure out how exactly to use them. Macro demands some
sort of key as an input argument. What is that key? I tried to enter 1
for it and it seems to unlock the interrupts in status register but I
would feel a lot better if I knew what exactly is it that I should input.

I'm saying that is seems to unlock the interrupts because now when I'm
debugging with jtag the my program gets lost somewhere. When I halt it
I get a message source not found which I think is probably caused by
staying in the interrupt forever. Problem is, I have breakpoints set
in all my interrupt handling routines so I think it should stop when
it reaches them.

One other thing, at the bottom of the file for enabling and disabling
interrupts I have this:

void ARM_reset(void);
void ARM_undef(void);
void ARM_swi(void);
void ARM_pAbort(void);
void ARM_dAbort(void);
void ARM_reserved(void);
void ARM_irq(void);
void ARM_fiq(void);

What is that for? I thought that all you have to do is declare the
interrupt handler like this:
static void PIT_IRQ_isr(void) __attribute__ ((interrupt("IRQ")));
Then create the routine itself like this:
void PIT_IRQ_isr ( void ) {
//Acknowledge interrupt by reading Periodic Interval Value
Register(PIT_PIVR);
unsigned int dummy = pitGetPIVR();
numINT++;
uart0_putc('Z');
(void)dummy; //suppress warning "dummy" was set but never used
}
Thanks in advance,
Jani

--- In A..., Johan Ingvast wrote:
>
> For the IAR compiler there is an intrisic function
> __enable_interrupt();
> For all interrupts. You can also set fiq and irq separately with
> something like
> __enable_irq()
> __enable_fiq()
> There are of course corresponding __disable commands
> Hope this helps.
> /johan
>
> kumori0 skrev:
> >
> >
> > Thanks, this should be the problem. I now have one very newbie
> > question. How do I change the CPSR value in code? I can't find the
> > memory location for it in AT91SAM9260 definitions where the memory
> > addresses are. Do I have to use some assembly command?
> >
> > Jani
> >
> > --- In A... ,
> > "ICLI, Bekir (EXT)"
> > wrote:
> > >
> > > Hi Jani,
> > >
> > > Looking at your CPSR, you are masking I and F (bits 6-7) bits. That
> > means, both fiq and irq interrupts are masked..
> > >
> > >
> > > Mit freundlichem Gru/ Best regards
> > > Bekir ICLI
> > >
> > >
> > >
> > >
> > > ________________________________
> > >
> > > Von: A...
> > [mailto:A... ] Im
> > Auftrag von kumori0
> > > Gesendet: Freitag, 4. April 2008 10:31
> > > An: A...
> > > Betreff: [AT91SAM] Re: arm926ejs simple interrupts
> > >
> > >
> > >
> > > Hello everyone,
> > >
> > > I'm still trying to get the interrupts working. I have
implemented the
> > > code from the examples that I got but so far they're still not
working.
> > >
> > > When I check the registers with jtag I can see that there is an
> > > interrupt pending (return (pAic->AIC_IPR & (0x1 << irq_id));)
but for
> > > some reason the active interrupt (return (pAic->AIC_ISR & (0x1 <<
> > > irq_id));) is always 0.
> > >
> > > When I look at the interrupt mask, to see which interrupts are
enabled
> > > I can see that the PIT interrupt and the software interrupt are
> > > enabled (SYS value of AIC_IMR=1).
> > >
> > > I also tried to trigge the interrupts manually by writing 1 in
> > > AIC_ISCR but nothing happens.
> > >
> > > You can see my source code here:
> > > aic.c - http://pastebin.com/m61920f16

> > >
> > > aic.h - http://pastebin.com/m2653e9ef

> > >
> > > main.c - http://pastebin.com/m51a7958b
> > > > >
> > > main.h - http://pastebin.com/m63a31dd0
> > > > >
> > > pit.c - http://pastebin.com/m13cd9e02

> > >
> > > pit.h - http://pastebin.com/m54f75450

> > >
> > > CS1275.c(hw init) - http://pastebin.com/m2fe34e30
> >
> > >
> > >
> > > The value of my CPSR is: 00100000 00000000 00000000 11010011
> > >
> > > I'm runing my code through debugger, does that disable interrupts?
> > >
> > > Let me know if more info about configuration and/or source code is
> > > needed.
> > >
> > > Thanks in advance,
> > > Jani
> > >
> >
> >
>
> --
> Johan Ingvast, PhD, CEO BioServo Technologies AB
> Mob. +46 70 34 34 498 http://www.bioservo.com
> Pub. pgp sign.: http://www.md.kth.se/~ingvast/Ingvast_public_key.asc
>

Reply by 42Bastian April 8, 20082008-04-08
kumori0 schrieb:
> I'm afraid I don't have IAR compiler, I'm using gcc, after Lynch's
> tutorial. I have located the macros that should enable and disable the
> interrupts in my hello world example, but I can't figure out what
> exactly do they do.

Did you look at the ARM assembly syntax ?

The macros just copy the CPSR into key lock interrupts (and change to
SYS-mode) or key into CPSR.

--
42Bastian

Note: SPAM-only account, direct mail to bs42@...

Reply by "ICLI, Bekir (EXT)" April 8, 20082008-04-08
Hi Jani,

They are the exception vector handlers, as it seems.
When there is, for example, a prefetch abort exception, the pc is loaded with the address 0xC.
And you probably have a branch to your ARM_pAbort() function at that address..

Mit freundlichem Gru/ Best regards
Bekir ICLI

________________________________

Von: A... [mailto:A...] Im Auftrag von kumori0
Gesendet: Dienstag, 8. April 2008 11:34
An: A...
Betreff: [AT91SAM] Re: arm926ejs simple interrupts

Thank you,

That helped a lot. I looked but I didn't look hard enough it seems.
I'm still trying to understand everything in C, I planed to learn more
about assembly after I can get the thing workng in c, because it
should be easier that way.

Does anyone know what

void ARM_reset(void);
void ARM_undef(void);
void ARM_swi(void);
void ARM_pAbort(void);
void ARM_dAbort(void);
void ARM_reserved(void);
void ARM_irq(void);
void ARM_fiq(void);

are for?

Jani

--- In A... , 42Bastian wrote:
>
> kumori0 schrieb:
> > I'm afraid I don't have IAR compiler, I'm using gcc, after Lynch's
> > tutorial. I have located the macros that should enable and disable the
> > interrupts in my hello world example, but I can't figure out what
> > exactly do they do.
>
> Did you look at the ARM assembly syntax ?
>
> The macros just copy the CPSR into key lock interrupts (and change to
> SYS-mode) or key into CPSR.
>
> --
> 42Bastian
>
> Note: SPAM-only account, direct mail to bs42@
>
Reply by kumori0 April 8, 20082008-04-08
Thank you,

That helped a lot. I looked but I didn't look hard enough it seems.
I'm still trying to understand everything in C, I planed to learn more
about assembly after I can get the thing workng in c, because it
should be easier that way.

Does anyone know what

void ARM_reset(void);
void ARM_undef(void);
void ARM_swi(void);
void ARM_pAbort(void);
void ARM_dAbort(void);
void ARM_reserved(void);
void ARM_irq(void);
void ARM_fiq(void);

are for?

Jani

--- In A..., 42Bastian wrote:
>
> kumori0 schrieb:
> > I'm afraid I don't have IAR compiler, I'm using gcc, after Lynch's
> > tutorial. I have located the macros that should enable and disable the
> > interrupts in my hello world example, but I can't figure out what
> > exactly do they do.
>
> Did you look at the ARM assembly syntax ?
>
> The macros just copy the CPSR into key lock interrupts (and change to
> SYS-mode) or key into CPSR.
>
> --
> 42Bastian
>
> Note: SPAM-only account, direct mail to bs42@
>

Reply by kumori0 April 6, 20082008-04-06
Hello everyone,

I'm still trying to get the interrupts working. I have implemented the
code from the examples that I got but so far they're still not working.

When I check the registers with jtag I can see that there is an
interrupt pending (return (pAic->AIC_IPR & (0x1 << irq_id));) but for
some reason the active interrupt (return (pAic->AIC_ISR & (0x1 <<
irq_id));) is always 0.

When I look at the interrupt mask, to see which interrupts are enabled
I can see that the PIT interrupt and the software interrupt are
enabled (SYS value of AIC_IMR=1).

I also tried to trigge the interrupts manually by writing 1 in
AIC_ISCR but nothing happens.

You can see my source code here:
aic.c - http://pastebin.com/m61920f16
aic.h - http://pastebin.com/m2653e9ef
main.c - http://pastebin.com/m51a7958b
main.h - http://pastebin.com/m63a31dd0
pit.c - http://pastebin.com/m13cd9e02
pit.h - http://pastebin.com/m54f75450
CS1275.c(hw init) - http://pastebin.com/m2fe34e30

The value of my CPSR is: 00100000 00000000 00000000 11010011

I'm runing my code through debugger, does that disable interrupts?

Let me know if more info about configuration and/or source code is
needed.

Thanks in advance,
Jani
Reply by Johan Ingvast April 4, 20082008-04-04
For the IAR compiler there is an intrisic function
__enable_interrupt();
For all interrupts. You can also set fiq and irq separately with
something like
__enable_irq()
__enable_fiq()
There are of course corresponding __disable commands
Hope this helps.
/johan

kumori0 skrev:
> Thanks, this should be the problem. I now have one very newbie
> question. How do I change the CPSR value in code? I can't find the
> memory location for it in AT91SAM9260 definitions where the memory
> addresses are. Do I have to use some assembly command?
>
> Jani
>
> --- In A... ,
> "ICLI, Bekir (EXT)"
> wrote:
> >
> > Hi Jani,
> >
> > Looking at your CPSR, you are masking I and F (bits 6-7) bits. That
> means, both fiq and irq interrupts are masked..
> >
> >
> > Mit freundlichem Gru/ Best regards
> > Bekir ICLI
> >
> >
> >
> >
> > ________________________________
> >
> > Von: A...
> [mailto:A... ] Im
> Auftrag von kumori0
> > Gesendet: Freitag, 4. April 2008 10:31
> > An: A...
> > Betreff: [AT91SAM] Re: arm926ejs simple interrupts
> >
> >
> >
> > Hello everyone,
> >
> > I'm still trying to get the interrupts working. I have implemented the
> > code from the examples that I got but so far they're still not working.
> >
> > When I check the registers with jtag I can see that there is an
> > interrupt pending (return (pAic->AIC_IPR & (0x1 << irq_id));) but for
> > some reason the active interrupt (return (pAic->AIC_ISR & (0x1 <<
> > irq_id));) is always 0.
> >
> > When I look at the interrupt mask, to see which interrupts are enabled
> > I can see that the PIT interrupt and the software interrupt are
> > enabled (SYS value of AIC_IMR=1).
> >
> > I also tried to trigge the interrupts manually by writing 1 in
> > AIC_ISCR but nothing happens.
> >
> > You can see my source code here:
> > aic.c - http://pastebin.com/m61920f16
> >
> > aic.h - http://pastebin.com/m2653e9ef
> >
> > main.c - http://pastebin.com/m51a7958b
> > >
> > main.h - http://pastebin.com/m63a31dd0
> > >
> > pit.c - http://pastebin.com/m13cd9e02
> >
> > pit.h - http://pastebin.com/m54f75450
> >
> > CS1275.c(hw init) - http://pastebin.com/m2fe34e30
>
> >
> >
> > The value of my CPSR is: 00100000 00000000 00000000 11010011
> >
> > I'm runing my code through debugger, does that disable interrupts?
> >
> > Let me know if more info about configuration and/or source code is
> > needed.
> >
> > Thanks in advance,
> > Jani
> >

--
Johan Ingvast, PhD, CEO BioServo Technologies AB
Mob. +46 70 34 34 498 http://www.bioservo.com
Pub. pgp sign.: http://www.md.kth.se/~ingvast/Ingvast_public_key.asc

Reply by "ICLI, Bekir (EXT)" April 4, 20082008-04-04
Hi Jani,

It is most probably set in the cstartup assembly code..
As an example:

msr CPSR_c, #ARM_MODE_SYS

sets the CPSR to supervisor mode.

if you write:
msr CPSR_c, #ARM_MODE_SYS | I_BIT | F_BIT
Where
#define I_BIT 0x80
#define F_BIT 0x40
is, than you set your CPSR to supervisor mode, with interrupts (both) disabled.

Look for msr commands in your code..

Mit freundlichem Gru/ Best regards
Bekir ICLI

________________________________

Von: A... [mailto:A...] Im Auftrag von kumori0
Gesendet: Freitag, 4. April 2008 11:01
An: A...
Betreff: [AT91SAM] Re: arm926ejs simple interrupts

Thanks, this should be the problem. I now have one very newbie
question. How do I change the CPSR value in code? I can't find the
memory location for it in AT91SAM9260 definitions where the memory
addresses are. Do I have to use some assembly command?

Jani

--- In A... , "ICLI, Bekir (EXT)"
wrote:
>
> Hi Jani,
>
> Looking at your CPSR, you are masking I and F (bits 6-7) bits. That
means, both fiq and irq interrupts are masked..
> Mit freundlichem Gru/ Best regards
> Bekir ICLI
> ________________________________
>
> Von: A... [mailto:A... ] Im
Auftrag von kumori0
> Gesendet: Freitag, 4. April 2008 10:31
> An: A...
> Betreff: [AT91SAM] Re: arm926ejs simple interrupts
>
> Hello everyone,
>
> I'm still trying to get the interrupts working. I have implemented the
> code from the examples that I got but so far they're still not working.
>
> When I check the registers with jtag I can see that there is an
> interrupt pending (return (pAic->AIC_IPR & (0x1 << irq_id));) but for
> some reason the active interrupt (return (pAic->AIC_ISR & (0x1 <<
> irq_id));) is always 0.
>
> When I look at the interrupt mask, to see which interrupts are enabled
> I can see that the PIT interrupt and the software interrupt are
> enabled (SYS value of AIC_IMR=1).
>
> I also tried to trigge the interrupts manually by writing 1 in
> AIC_ISCR but nothing happens.
>
> You can see my source code here:
> aic.c - http://pastebin.com/m61920f16 >
> aic.h - http://pastebin.com/m2653e9ef >
> main.c - http://pastebin.com/m51a7958b >
> main.h - http://pastebin.com/m63a31dd0 >
> pit.c - http://pastebin.com/m13cd9e02 >
> pit.h - http://pastebin.com/m54f75450 >
> CS1275.c(hw init) - http://pastebin.com/m2fe34e30
> The value of my CPSR is: 00100000 00000000 00000000 11010011
>
> I'm runing my code through debugger, does that disable interrupts?
>
> Let me know if more info about configuration and/or source code is
> needed.
>
> Thanks in advance,
> Jani
>
Reply by kumori0 March 12, 20082008-03-12
Thanks everyone,

I will try and digest all those links and examples today. Would do it
sooner but was at CEBIT...

Jani

--- In A..., "willoughby_jon"
wrote:
>
> And if you want to dig a little deeper...
> http://www.micrium.com/support/application_notes.html#AN1
>
> --- In A..., "ICLI, Bekir (EXT)"
> wrote:
> >
> > Hi Jani,
> >
> > There are lots of examples in the atmel's corresponding web-site:
> > http://www.atmel.com/dyn/products/tools_card.asp?
> family_id=605&family_name=AT91SAM+32%2Dbit+ARM%
> 2Dbased+Microcontrollers&tool_id=3933
> > You can download the complete cd.
> >
> > For the sake of simplicity, I have uploaded to rapidshare an
> example that covers interrupts with timers
> > http://rapidshare.com/files/97662092/AT91SAM9260-Interrupt.zip.html
>
> >
> > Good luck..
> >
> > Mit freundlichem Gru/ Best regards
> >
> > Bekir ICLI
> >
> >
> >
> > ________________________________
> >
> > Von: A... [mailto:A...] Im
> Auftrag von kumori0
> > Gesendet: Donnerstag, 6. Mz 2008 21:36
> > An: A...
> > Betreff: [AT91SAM] arm926ejs simple interrupts
> >
> >
> >
> > Hello everyone,
> >
> > I'm a student, trying to move up from programming PIC micros to
> > working with ARM microcontrollers.
> >
> > At the moment I have a lot of problems with the whole concept of
> > interrupts in ARM. Could someone tell me where I could find a simple
> > hello world like application that would have only the interrupt on
> > timer0 or something like that.
> >
> > Thanks in advance,
> > Jani
>



Reply by willoughby_jon March 10, 20082008-03-10
And if you want to dig a little deeper...
http://www.micrium.com/support/application_notes.html#AN1

--- In A..., "ICLI, Bekir (EXT)"
wrote:
>
> Hi Jani,
>
> There are lots of examples in the atmel's corresponding web-site:
> http://www.atmel.com/dyn/products/tools_card.asp?
family_id=605&family_name=AT91SAM+32%2Dbit+ARM%
2Dbased+Microcontrollers&tool_id=3933
> You can download the complete cd.
>
> For the sake of simplicity, I have uploaded to rapidshare an
example that covers interrupts with timers
> http://rapidshare.com/files/97662092/AT91SAM9260-Interrupt.zip.html

>
> Good luck..
>
> Mit freundlichem Gru/ Best regards
>
> Bekir ICLI
>
>
>
> ________________________________
>
> Von: A... [mailto:A...] Im
Auftrag von kumori0
> Gesendet: Donnerstag, 6. Mz 2008 21:36
> An: A...
> Betreff: [AT91SAM] arm926ejs simple interrupts
>
>
>
> Hello everyone,
>
> I'm a student, trying to move up from programming PIC micros to
> working with ARM microcontrollers.
>
> At the moment I have a lot of problems with the whole concept of
> interrupts in ARM. Could someone tell me where I could find a simple
> hello world like application that would have only the interrupt on
> timer0 or something like that.
>
> Thanks in advance,
> Jani
>



Reply by Stephen Manion March 7, 20082008-03-07
Google "building bare metal arm systems with GNU" to find a 10 part tutorial
that I found useful.

Steve
On Thu, Mar 6, 2008 at 10:14 PM, ICLI, Bekir (EXT) <
b...@siemens.com> wrote:

> Hi Jani,
>
> There are lots of examples in the atmel's corresponding web-site:
>
> http://www.atmel.com/dyn/products/tools_card.asp?family_id`5&family_name=AT91SAM+32%2Dbit+ARM%2Dbased+Microcontrollers&tool_id933
> You can download the complete cd.
>
> For the sake of simplicity, I have uploaded to rapidshare an example that
> covers interrupts with timers
> http://rapidshare.com/files/97662092/AT91SAM9260-Interrupt.zip.html
>
> Good luck..
>
> Mit freundlichem Gru/ Best regards
>
> Bekir ICLI
>
> ------------------------------
> *Von:* A... [mailto:A...] *Im
> Auftrag von *kumori0
> *Gesendet:* Donnerstag, 6. Mz 2008 21:36
> *An:* A...
> *Betreff:* [AT91SAM] arm926ejs simple interrupts
>
> Hello everyone,
>
> I'm a student, trying to move up from programming PIC micros to
> working with ARM microcontrollers.
>
> At the moment I have a lot of problems with the whole concept of
> interrupts in ARM. Could someone tell me where I could find a simple
> hello world like application that would have only the interrupt on
> timer0 or something like that.
>
> Thanks in advance,
> Jani
>
>
>

--
******************************
Steve Manion
S...@Metrozet.com
(626) 507-8025
(626) 437-6905

WWW.METROZET.COM
******************************