Is there a functionally I2C Communication on Arduino Zero?
In Arduino Zero's Schematic there is two ports with I2C communication, D3/D4(PA09/PA08) e I2C_SDA/I2C_SCL(PA22/PA23). The two ports are marked as I2C. Can I use D3/D4 ports for I2C communitacion without any change in variant.cpp?
The two pins SDA/SCL can be used with the usual Wire library.
The other two pins requires a change in the variant.h and to the Wire.h/cpp, in particular the begin() method do not yet support multiple I²C pins definitions from the variant.h. Moreover we must figure out how to share the SERCOM instances between multiple I²C / SPI / UARTS, and allocate them only as needed.
Making this simple for the final user is a complex topic :-), if you have any suggestion, you're more than welcome!
for use the D3/D4 as I2C ports, and not work! I want to use just one device in communication I2C, but i need to use this pins (D3/D4). Is there other change that i need to do for work?
I may not understand this correctly. However, I am trying to use an LCD screen over I2C using the LiquidCrystal_I2C.h Library. This library work on the current I2C pins and I can have it lcd.print to the screen just fine. However, I am unable to get the same functionality on different I2C pins. I have tried to follow the Adafruit example but it doesn't explain enough of what is happening in the code for me to be able to adapt it to my needs(hence why I am interested in the way Rfuzer fixed this issue).
Any further clarification would be appreciated.
I am using the SAMD21 Mini Breakout from sparkfun. D3 (PA09) and D4(PA08) are the pins I want to use.
The issue with using Rfuzer's approach is that it requires changing the "variant.h" and "variant.cpp" Arduino core files. Changes to these file will be overwritten each time the core files are updated, plus changes to "variant" files will also affect any other sketches using the Sparkfun SAMD21 Mini Breakout.
I tried the approach you stated. It does not work for some reason. This may have something to do with me wanting to use the Liquidcrystal_I2C library as well.
For further clarification, my end use with this is a custom board for a very specific project. This means modifying the variant.h and .cpp files won't be changed because it has its own variant.h and .cpp files. The mini dev board is just for me to test with for the time being. However, I was able to find and modify the varient.h and .cpp files and get the i2c working with the liquidcrystal library. That being said I didn't need to change anything in the wire.cpp file.