In the arduino/hardware/libraries/Wire/utility directory I had to modify
twi_init() in twi.c
twi_init does not include a definition for the atmega644[p] and such
incorrectly set's the pull up registers for the wrong ports.
The atmega644[p] TWI are ports PORTC0/PORTC1 not PORTD0/PORTD1 as the
source states.
I added:
#elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__)
sbi(PORTC, 0);
sbi(PORTC, 1);
to
void twi_init(void)
{
// initialize state
twi_state = TWI_READY;
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega8__) ||
defined(__AVR_ATmega328P__)
// activate internal pull-ups for twi
// as per note from atmega8 manual pg167
sbi(PORTC, 4);
sbi(PORTC, 5);
#elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__)
sbi(PORTC, 0);
sbi(PORTC, 1);
#else
// activate internal pull-ups for twi
// as per note from atmega128 manual pg204
sbi(PORTD, 0);
sbi(PORTD, 1);
#endif
I am running Arduino version 0017.
Original issue reported on code.google.com by sancho...@gmail.com on 2 May 2010 at 6:30
Original issue reported on code.google.com by
sancho...@gmail.com
on 2 May 2010 at 6:30