Arduino master to arduino slave code not working correctly

PLEASE FIND THE FULL CODE IN THE FIRST POST OF THIS THREAD.

so the architecture is four slave modules communicating with a master. The device does need separate processors. they are slave modules that plug into a master device. i have four. the BOM cost each was around 250$. ideally i wouldn't rev it again, but its not out-of-the-question.

the slave modules each have 4-channel DAC, 4-Channel ADC, IO expander, and Power Monitor on their internal i2c bus. the master turns on a switch to physically add and remove the slave modules from the main i2c bus. However, all the testing i have done so far has only been with one slave module.

i have heard calls for the whole code. ok. here it is. its a few thousand lines so i didn't think it necessary, however like most things i'm probably wrong.

@camsysca i looked at the trace-lengths and it seems worst case 5-6 inches of PCB traces, routed correctly away from noise sources. All my testing indicates its a software not hardware issue. I have updated the first post with all the code.

@DrDiettrich what i meant by "i know you cant do both at the same time" is that it has to be OR, i.e. Wire.begin(); OR Wire.begin(0x20), but you cant just do Wire.begin(0x20) and then have the micro control a ADC as master. is this correct? my testing shows it is, but perhaps i'm doing something else wrong?

1 Like