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

Harald Kipp harald.kipp at egnite.de
Tue Mar 31 15:21:24 CEST 2009


Harald Kipp wrote:
> Ole Reinhardt wrote:
>> -        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);
> 
> Tried this, without success. :-(
> 
> I'm working on this.

So far I'd consider this code broken. A severe bug is in TwMasterTransact:

 NutEnterCritical();
...
 if ((tw_mt_len == 0) && (tw_mr_siz == 0)) return -1;
...
 NutExitCritical();

Interrupts should be enabled again before returning -1.

So far I spent some time on this and never saw any TWI interrupt
occurring. For now I'll switch back to bit-banging.

Harald




More information about the En-Nut-Discussion mailing list