Reply by Charles Manning November 28, 20062006-11-28
On Wednesday 29 November 2006 13:19, John Archbold wrote:
> I had success with FreeRTOS for other peripherals.

It does not appear that FreeRTOS provides TWI/I2C.
Reply by John Archbold November 28, 20062006-11-28
I had success with FreeRTOS for other peripherals.

But I was not using I2C .

_____

From: A... [mailto:A...] On Behalf Of
embeddedjanitor
Sent: Wednesday, 29 November 2006 9:52 AM
To: A...
Subject: [AT91SAM] Re: I2C driver

I looked at the code that Michael mentions. This seems to fix a few
issues, but not all.

The TWI hardware & docs seem buggier than a summer's breeze and as
yet I have not seen any really good software to drive it (ie. that is
robust and handles comms errors & timeouts, that is interrupt
driven)... basically the minimal features to use it in a real product.

A point to note is that if you just poll the status you will not see
the nak flag due to a register bug. The only way to reliably see the
nak flag is to wait for the tx comp interrupt before reading the
status.

Anyway, here's a plea.... If anybody has a robust I2C driver that is
interrupt driven, please post it in the files area.

--- In AT91SAM@yahoogroups .com,
"supertronic68"
wrote:
>
> Dear Pierre,
>
> please look at www.AT91.com >> FORUM
> I have posted a solution "TWI Problem using serial eeprom"
>
> Best Regards
> Michael
> --- In AT91SAM@yahoogroups .com,
"Pierre Laviolette"
wrote:
> >
> >
> >
> > I managed to get my driver to work but had to use a "sledge
hammer"
> > solution. THEre is a question below.
> >
> > I write to EEPROM, this works fine.
> >
> > After that the EEPROM is busy for a while. To determine if the
EEPROM
> > is finished I start a read operation (the first part of this is a
> > write) which is to be aborted until I get an answer.
> >
> > Anyway I see the writes going out on the wire on the logic
analyser,
> > but all I see is NACKS ad the trace ends. I assume there is an
ACK at
> > some point as it works if I put a delay before the read.
> >
> > So here's the hammer, upon getting a NACK, I completely reset the
TWI
> > using the reset bit of the control register and I reconfigure
> > everything (clock etc). This makes it work (not hang) and I get
the
> > right data.
> >
> > Rather than resetting, I tried various operations to try and
reset the
> > TWI For example another stop, msdis/msen. Nothing worked only the
reset.
> >
> > Anybody have any idea what is wrong or know a better way?
> >
> > Pierre
>
Reply by embeddedjanitor November 28, 20062006-11-28
I looked at the code that Michael mentions. This seems to fix a few
issues, but not all.

The TWI hardware & docs seem buggier than a summer's breeze and as
yet I have not seen any really good software to drive it (ie. that is
robust and handles comms errors & timeouts, that is interrupt
driven)... basically the minimal features to use it in a real product.

A point to note is that if you just poll the status you will not see
the nak flag due to a register bug. The only way to reliably see the
nak flag is to wait for the tx comp interrupt before reading the
status.

Anyway, here's a plea.... If anybody has a robust I2C driver that is
interrupt driven, please post it in the files area.
--- In A..., "supertronic68"
wrote:
>
> Dear Pierre,
>
> please look at www.AT91.com >> FORUM
> I have posted a solution "TWI Problem using serial eeprom"
>
> Best Regards
> Michael
> --- In A..., "Pierre Laviolette"
wrote:
> >
> >
> >
> > I managed to get my driver to work but had to use a "sledge
hammer"
> > solution. THEre is a question below.
> >
> > I write to EEPROM, this works fine.
> >
> > After that the EEPROM is busy for a while. To determine if the
EEPROM
> > is finished I start a read operation (the first part of this is a
> > write) which is to be aborted until I get an answer.
> >
> > Anyway I see the writes going out on the wire on the logic
analyser,
> > but all I see is NACKS ad the trace ends. I assume there is an
ACK at
> > some point as it works if I put a delay before the read.
> >
> > So here's the hammer, upon getting a NACK, I completely reset the
TWI
> > using the reset bit of the control register and I reconfigure
> > everything (clock etc). This makes it work (not hang) and I get
the
> > right data.
> >
> > Rather than resetting, I tried various operations to try and
reset the
> > TWI For example another stop, msdis/msen. Nothing worked only the
reset.
> >
> > Anybody have any idea what is wrong or know a better way?
> >
> > Pierre
>
Reply by supertronic68 November 2, 20062006-11-02
Dear Pierre,

please look at www.AT91.com >> FORUM
I have posted a solution "TWI Problem using serial eeprom"

Best Regards
Michael
--- In A..., "Pierre Laviolette" wrote:
>
> I managed to get my driver to work but had to use a "sledge hammer"
> solution. THEre is a question below.
>
> I write to EEPROM, this works fine.
>
> After that the EEPROM is busy for a while. To determine if the EEPROM
> is finished I start a read operation (the first part of this is a
> write) which is to be aborted until I get an answer.
>
> Anyway I see the writes going out on the wire on the logic analyser,
> but all I see is NACKS ad the trace ends. I assume there is an ACK at
> some point as it works if I put a delay before the read.
>
> So here's the hammer, upon getting a NACK, I completely reset the TWI
> using the reset bit of the control register and I reconfigure
> everything (clock etc). This makes it work (not hang) and I get the
> right data.
>
> Rather than resetting, I tried various operations to try and reset the
> TWI For example another stop, msdis/msen. Nothing worked only the reset.
>
> Anybody have any idea what is wrong or know a better way?
>
> Pierre
>
Reply by Pierre Laviolette November 1, 20062006-11-01
I managed to get my driver to work but had to use a "sledge hammer"
solution. THEre is a question below.

I write to EEPROM, this works fine.

After that the EEPROM is busy for a while. To determine if the EEPROM
is finished I start a read operation (the first part of this is a
write) which is to be aborted until I get an answer.

Anyway I see the writes going out on the wire on the logic analyser,
but all I see is NACKS ad the trace ends. I assume there is an ACK at
some point as it works if I put a delay before the read.

So here's the hammer, upon getting a NACK, I completely reset the TWI
using the reset bit of the control register and I reconfigure
everything (clock etc). This makes it work (not hang) and I get the
right data.

Rather than resetting, I tried various operations to try and reset the
TWI For example another stop, msdis/msen. Nothing worked only the reset.

Anybody have any idea what is wrong or know a better way?

Pierre