[En-Nut-Discussion] TWI interrupts on AT91SAM7x256 and Ethernut 4.6.5/4.8.0

Ole Reinhardt ole.reinhardt at embedded-it.de
Fri Mar 27 20:37:50 CET 2009


Hi!

> I temporarily don't have access to a scope which is making my debugging a
> little hairy. Has anyone faced similar problems with TWI since 4.4.0, or
> can anyone give me some ideas on how to debug this issue further?

You use TWI on SAM7x? Have you enabled hardware TWI or the bitbanging
device? The hardware TWI driver had some problems in the past.
Supposingly this is a problem with edge triggered interrupts. If you use
the hardware TWI driver, try to change the interrupt mode of the TWI
interrupt to level sensetive. I did not fixed this as I currently don't
have any TWI slave hardware to test my fix.

Therefore you need to modify ih_at91twi.c line 118:

     case NUT_IRQCTL_INIT:
         /* Set the vector. */
         outr(AIC_SVR(TWI_ID), (unsigned int)TwoWireIrqEntry);
         /* Initialize to edge triggered with defined priority. */
-        outr(AIC_SMR(TWI_ID), AIC_SRCTYPE_INT_EDGE_TRIGGERED |
NUT_IRQPRI_TWI);
+        outr(AIC_SMR(TWI_ID), AIC_SRCTYPE_INT_LEVEL_SENSITIVE |
NUT_IRQPRI_TWI);
         /* Clear interrupt */ 
         outr(AIC_ICCR, _BV(TWI_ID));
         break;

Please test this fix and tell me if this fixes your problems. I'd be
happy to fix the code in the SVN HEAD and perhaps can have fixed code
just in NutOS 4.8

Best regards,

Ole

-- 
 _____________________________________________________________
|                                                             |
| Embedded-IT          Hard- und Softwarelösungen             |
|                                                             |
| Ole Reinhardt        Tel. / Fax:        +49 (0)271  7420433 |
| Luisenstraße 29      Mobil:             +49 (0)177  7420433 |
| 57076 Siegen         eMail:    ole.reinhardt at embedded-it.de |
| Germany              Web:         http://www.embedded-it.de |
|                      UstID / VAT:       DE198944716         |
|_____________________________________________________________|




More information about the En-Nut-Discussion mailing list