ts-7000
[Top] [All Lists]

[ts-7000] VIC, IRQ and FIQ programming for the EP9302

To:
Subject: [ts-7000] VIC, IRQ and FIQ programming for the EP9302
From: Per Öberg <>
Date: Wed, 02 Jul 2008 08:43:22 +0200
Hi everyone

I'm writing my own OS for my TS7250. I use redboot for basic
initialization and then i take over with my own code.

I've been reading "EP93xx_Users_Guide_UM1.pdf" but I can't understand
what I am doing wrong when programming the VIC. The documentation is a
little hard to follow and I'm not sure about how the prioritizing
hardware works for example. Links to code examples or extra
documentation would come in really handy.

The scenario is as follows:

A process is running in system mode with it's own stack and with FIQ and
IRQ turned on. The GPIO's are programmed to to generate a FIQ when a key
on the keypad is pressed or released. The 508 kHz clock is programmed to
generate a vectorized IRQ and is coupled to a clock handler function. I
also have a default IRQ handler that flashes the green light on my board
but all other interrupts are turned off so it shouldn't be needed.

The FIQ handler routine, written in assembler with C-calls, stashes away
all registers that is going to be modified. It then turns off the GPIO
interrupts and reprograms PortB, scans the keyboard and finally
reenables the GPIO interrupts. B.t.w does anyone know why gcc favours
register 0-3 even when told to generate code for a FIQ routine
regardless of optimization flags?

The IRQ clock handler routine, also written in assembler with C-calls,
handles the clock and checks for context switches. This routine makes
sure that if it's running the red light flashes once a second.

Everything seems to work fine except for glitches that happens randomly
when pressing keys on the keypad. Sometimes the default IRQ handler is
run, but the program keeps working as expected when it's finished
flashing the green light. Sometimes the IRQ's are turned off (the red
light stops flashing) but the program running at the time keeps running
and if it enables IRQ now and then everything kicks in and starts
working again. Sometimes everything is messed up and data abort or
undefined mode is entered. I have been doing some research by using the
green light flashing as an output and found out that when the default
IRQ routine is run it always SEEMS to come from IRQ mode when entering
the IRQ routine. The strange thing is that IRQ's are disabled throughout
the IRQ routine.

All events that leeds to total crap SEEMS to follow the following line
of execution

SYS mode -> clock event -> IRQ mode -> keypad event -> FIQ mode ->
return from FIQ -> IRQ mode -> random event to default handler -> IRQ
mode -> return from IRQ mode -> CRAP

This indicates that the problem is that after the switch from IRQ mode
to IRQ mode, while the IRQs should have been disabled the SPSR_IRQ, and
LR_IRQ is overwritten with new values which leeds to surprising results
when returning from the default IRQ handler.

The other problem, the one where the IRQs are simply disabled is just
strange since there seems to be no other side effects.

I've been thinking that it might have to do with the fact that the GPIO
IRQ line and the clock IRQ line comes from different VIC's and if they
happen simultaneously something weird might happen. The EP93xx guide
indicates something like this but i am unsure of what it really means.

Someone with a good knowledge of the internals of the EP9302 out there?

Regards
Per Öberg

--
Per Öberg, Ph.D. Student
Address: Division of Vehicular Systems
Department of Electrical Engineering
Linköpings universitet
581 83 Linköping, SWEDEN
Phone: +46 (0)13-28 23 69
e-mail: 
PGP: http://www.fs.isy.liu.se/~oberg/0x61984A9D.asc

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
    
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Attachment: oberg.vcf
Description: Vcard

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU