This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Software I2C


Hello,


Excuse me, but I can't understand something here.

If working on interrupts have such an overhead that it's hard to work at 100 kHz than what's the reason of using interrupts here? All after all writing the code with simple coutning loops or "wait for timer overflow" loops is very easy and can work at 400 kHz without any problems.


--
Slawek Piotrowski

----- Original Message ----- 
From: "Eric de Jong" <list_ericdejong_10@gmx.net>
To: <ecos-discuss@sources.redhat.com>
Sent: Tuesday, July 08, 2003 9:18 AM
Subject: Re: [ECOS] Software I2C


> For a I2C implementation, have a look at the atmel at91 library. It works nice,
> although you have to adapt it for generic I2C. (currently it works with eeproms,
> wich have a start-writeaddress-restart-readdata-stop scheme)
> 
> On my artmel arm 66MHz core I got a 20khz I2C max. under ecos. After rewriting
> the interrupt code I get 80Khz with a C handler.
> 
> For the atmel AT91 family you will find the modified code attached. Compare the
> code to the original files to see what is changed, you will need all the code in
> AT91_misc.c and from vector.s only the FIQ, IRQ and ECOS_IRQ code. (and the
> extra stack space below).
> To use the code, do the following:
> 
> Acknowlage your interrupt with
>    *(volatile unsigned long*)(0xFFFFF130) = 0; // mag elke waarde zijn.
> acknowlage interrupt controller (dummy write to register)
> in stead of
>  cyg_drv_interrupt_acknowledge(vector);
> 
> Register your interrupt under ecos the normal way AND do a:
>  *(volatile unsigned long*)(0xFFFFF080+5*4) = (unsigned long) <your isr
> routine>; // (for timer int #5)
> 
> In your interrupt handler, return a CYG_ISR_CALL_DSR to call the dsr routine
> (slow!) in where you can set flags, or return 0 (or CYG_ISR_HANDLED) to end the
> interrupt.
> 
> I do like to hear comments or improvements on the code if you decide to use it.
> Unfortunate, this code is atmel specific as it uses the AIC interrupt
> controller.
> 
> Eric
> 
> 


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


> -- 
> Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
> and search the list archive: http://sources.redhat.com/ml/ecos-discuss


--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]