simulavr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Simulavr-devel] Trigger external interrupt?


From: Lars Noschinski
Subject: Re: [Simulavr-devel] Trigger external interrupt?
Date: Wed, 7 Sep 2005 14:37:15 +0200
User-agent: mutt-ng devel (Linux)

* Klaus Rudolph <address@hidden> [2005-09-07 08:53]:
I just installed simulavrxx (0.8.006) and I am trying now to simulate
some inputs. Namely I want to trigger an External Interrupt.
Following checkdebug.py, I created an ExtPin and connected it to "D2"
(where INT0 is located on a at90s4433). But toggling the pin in the UI
doesn't trigger the interrupt.

OK, please send me your original avr source code, I will try to reproduce your problem as soon as possible.

My interrupt routine is

__attribute__ ((naked)) SIGNAL (SIG_INTERRUPT1) {
   asm __volatile__ (
           "sbic %[pind], %[clock]\n\t"
           "reti\n\t"
           "rjmp step_out\n\t"
           : /* no outputs */
           : [pind] "I" (_SFR_IO_ADDR(PIND)),
             [clock] "I" (CLOCK));
}

and the following settings are made to setup INT0:

MCUCR = 0x08;                       /* Trigger ext. IR1 on falling edge */
/* TODO 0x80 = 0b10000000 should be sufficient */
GIFR = 0xf0;                        /* clear IR flags to avoid unintend step */
GIMSK = 0x80;                       /* enable ext. IR1 */

(Full source in private mail)

The interrupt triggers flawlessy in an real atmega8 and was copied from
a source file, which works on an at90s4433.

I have never used python in my life so I prefer tcl code. But please send me also your py file so that I am able
to learn about :-)

I just took checkdebug.py from CVS and replaced the pin setup by

pd2 = ExtPin(Pin.TRISTATE, ui, "pd2", ".x")

portd = Net()
portd.Add(pd2)
portd.Add(dev1.GetPin("D2"))

So how can I generate such an interrupt? (From the UI or better yet from
a python script).
Simply by changing the signal according to the interrupt mask you have set (rising, falling or on level).

Ok, so

set pd2 H
set pd2 L
set pd2 H

should trigger it, independent from the actual setup for INT0.

So please send me your original source file and the command line you have used to build your program. Also
your avr-libc (if used) and compiler versions are sensefull.

I use the avr toolchain from Debian/Testing, and (aside from the
pgmspace macros) didn't use the avr-libc.

% avr-gcc -c -mmcu=at90s4433 -I. -gdwarf-2 -DF_CPU=4000000UL  -Os
-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall
-Wstrict-prototypes -Wa,-adhlns=hpstep.lst  -std=gnu99 -mint8 -MD -MP
-MF .dep/hpstep.o.d hpstep.c -o hpstep.o

% avr-gcc -mmcu=at90s4433 -I. -gdwarf-2 -DF_CPU=4000000UL  -Os
-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall
-Wstrict-prototypes -Wa,-adhlns=hpstep.o  -std=gnu99 -mint8 -MD -MP -MF
.dep/hpstep.elf.d hpstep.o dac.o --output hpstep.elf
-Wl,-Map=hpstep.map,--cref    -lm

% avr-gcc -v
Reading specs from /usr/lib/gcc/avr/3.4.3/specs
Configured with: ./configure -v --enable-languages=c,c++ --prefix=/usr
--infodir=/usr/share/info --mandir=/usr/share/man --enable-shared
--with-system-zlib --enable-long-long --enable-nls
--without-included-gettext --disable-checking --build=i486-linux-gnu
--host=i486-linux-gnu --target=avr --with-dwarf2
Thread model: single
gcc version 3.4.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]