I'm testing a stand alone Arduino Edge Control (without any MKR shield installed) and can't find a way to activate the I2C bus pins that are available on both MKR1 and MKR2 slots.
In the Edge Control program, the following power lines are enabled
// Enable power lines
Power.enable3V3();
Power.enable5V();
Power.on(PWR_MKR1);
Power.on(PWR_MKR2);
Only if I insert a MKR module (in this case the MKR 1010) does the I2C (and apparently all other MKR pins) become enabled, and the I2C can be accessed by the Edge Control program.
The I2C bus should work of course.
As far as I can tell from the schematic, the I2C bus is only available on both MKR headers. There is no need to power the MKR modules, since the I2C bus is directly connected to the processor.
Both the pullup resistors and the expander are powered via a gated 3.3V controlled by GPIO46. I assume that enabling the 3.3V and 5V is enough to make it work.
What makes you think that the I2C bus does not work ?
There are already 10k pullup resistors on the board, and there is a I2C expander on the board. So if you run a I2C scanner, then it should find the expander.
You could do Wire.begin() in setup() and measure the SDA and SCL pins. The voltage should be near 3.3V. You could even measure the shortcut current of SDA to GND and of SCL to GND and you should be able to verify the 10k pullup resistors from the current.
I'm attaching a picture where 3 scenarios that I've tested are shown.
Scenario A :
MKR 1010 fitted in Edge slot for MKR1
In the Edge running program, power lines 3V3, 5V and MKR1 are enabled
Voltmeter measuring V between VCC and GND pins of MKR 1010
*I2C slave accelerometer board connected to MKR1010 pins (scl,sda,vcc,gnd)
Scenario B:
Empty Edge slot MKR1
In the Edge running program, power lines 3V3, 5V and MKR1 are enabled
Voltmeter measuring V between VCC and GND pins of MKR1 slot
I2C slave accelerometer board connected to MKR1 slot pins (scl,sda,vcc,gnd)
Scenario C:
Empty Edge slot MKR1
In the Edge running program, power lines 3V3, 5V are enabled; MKR1 is disabled
Voltmeter measuring V between VCC and GND pins of MKR1 slot
I2C slave accelerometer board connected to MKR1 slot pins (scl,sda,vcc,gnd)
Electrical Findings
Scenario A:
measured VCC voltage is 3.3 Vdc
I2C slave accelerometer LED fully bright
Scenario B:
measured VCC voltage is 1,8 Vdc
I2C slave accelerometer LED dimmed
Scenario C:
measured VCC voltage is 0 Vdc
I2C slave accelerometer LED is off
SW Findings
Only scenario A permitted the program running in the Edge cpu to be successful in getting data from the I2C slave but only if the MKR1010 cpu is also running a program that uses I2C comms; in this situation, if the program running in MKR1010 cpu is changed to another empty program or one that doesn't use I2C comms, followed by an Edge reboot, then the Edge program is no longer successful in I2C comms.
To regain I2C successful comms by the Edge, then a program using I2C has to be downloaded to MKR 1010 followed by an Edge reboot
These were my findings so far - and I'm a bit puzzled, or just a newbie
Checked SDA and SCL voltages, and they're ok.
On the EDGE I have now the I2C slave powered by GND and VIN pins of MKR slot.
I then proceeded to test an I2C program on 3 different arduinos: DUE, MKR1010 and EDGE (with empty MKR slots).
The test consisted of:
1 - connect a GY-521 to the I2C
2 - run I2C scanner; results on Monitor
3 - disconnect GY=521 from I2C
4 - run I2C scanner; results on Monitor
Note that with both Due and MKR1010 I could read values from the GY-521 but not with EDGE, even though the GY-521 was connected and found by the I2C scanner subroutine.
I also expected a similar output on each board from the I2C scanner without anything connected to it, but on the MKR it still shows I2C addresses 0x60, 0x68, and, on the EDGE, address 0x22.
I'm now able to get readings with standalone EDGE CONTROL from the GY-521 connected to MKR1 slot pins SDA, SCL, GND, VIN. Don't understand why it failed in the previous test (see previous post); could be some issue with the GY-521...
Solution to original problem:
Originally, when I couldn't get readings, I had the GY-521 connected to MKR1 slot pins SDA, SCL, GND, VCC
After looking at the circuit diagram (below) I realized that the Edge's MKR1 slot VCC pin is not connected anywhere (only an inserted MKR board will provide 3.3V on VCC pin) and so the solution was to power the I2C slave from the Edge's MKR1 slot VIN pin (5V).
Note: in the sketch setup, the following power lines enabled
void setup() {
// Enable power lines //Power.enable3V3();
Power.enable5V();
Power.on(PWR_MKR1); //Power.on(PWR_MKR2);
The board is not suitable to add a custom I2C sensor. There should be a header with a I2C bus and power. The best power is the gated 3.3V called "+3V3_GT" for a 3.3V sensor. But that signal is probably not available on a header.
If you have a module with a voltage regulator, then you can indeed use the 5V VIN signal meant to power the MKR board I don't even know an other solution.
The other I2C devices that are found are 0x60 for a crypto-chip, 0x6B for a battery chip, 0x22 for a I2C-expander. Everything you see with the I2C Scanner is correct