I'm actually trying to send some data between two Arduino Nanos using I2C.
My bus master sets up the start condition on the bus, but doesn't transmit the slave adress nor any data.
I'm currently not using the Arduino IDE, but Sloeber for Eclipse. All projects to date worked fine.
Master code snippet
uint16_t asd = 0;
uint8_t array1[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t CW1 = 6207;
uint8_t Wave1 = 7;
uint8_t subVolume1 = 127;
uint8_t Pulsewidth1 = 127;
uint8_t cutoff1 = 47;
uint8_t feedback1 = 0;
uint8_t volume1 = 255;
void setup()
{
DDRB |= (1 << PB0);
TCCR2A = (1 << WGM21);
TCCR2B = (1 << CS22) | (1 << CS21) | (1 << CS20);
OCR2A = 60;
//enable timer 1 overflow interrupt
Wire.begin(20);
TWBR = 12;
TIMSK2 = (1 << OCF2A);
}
ISR (TIMER2_COMPA_vect) {
PORTB |= 0x01;
array1[0] = CW1;
array1[1] = (CW1 >> 8);
array1[2] = (CW1 >> 16);
array1[3] = (CW1 >> 24);
array1[4] = Wave1;
array1[5] = subVolume1;
array1[6] = Pulsewidth1;
array1[7] = cutoff1;
array1[8] = feedback1;
array1[9] = volume1;
Wire.beginTransmission(10);
for (int i = 0; i < 10; i++){
Wire.write(array1[i]);
}
uint8_t err = Wire.endTransmission(true);
asd +=1;
asd &= 4095;
volume1 = asd >> 4;
PORTB &= 0xFE;
}
Port B is used as debug (CPU load), pin A4 is connected to A4, A5 to A5, both have 2k7 pullups.
When the ISR starts PB0 goes high, I2C bus outputs start condition and hangs.
What am I doing wrong?