New (2.0.1) core - TwoWire and compile time?

I’ve just come back to Artemis after a venture down the ESP32 rabbit hole, and gingerly tried out the new (standard v2.0.1) core with my extensive code, and Arduino IDE 1.8.12 on Windows10.

Compile fails with an error where a global TwoWire variable is declared, and that’s as far as I got. Anything obvious/known that needs doing? I’ll investigate in more detail (using the SD patch version) and post results, got to finish some other functionality and get a long-term test running before I can spend too much time integrating new cores and such.

It also took AGES to compile (estimated 5x with the previous core). Hopefully once the first compile is successful, subsequent ones will be less, otherwise it’s going to make development on the Artemis that much less exciting. I did see an issue about this on Github but can’t seem to find it again.

Interesting data point - I had expected compilation times to decrease as a large portion of the code is contained within a precompiled static library (libmbed-os.a) for each board. Perhaps you are right that subsequent compiles will use a cached version of the core and run faster.

Many interfaces have changed for the v2 core - including TwoWire constructors. Take a look at the new I2C example that demonstrates how to declare your own I2C ports:

https://github.com/sparkfun/Arduino_Apo … 2C/I2C.ino

I’ve spent a few more hours chipping away at the 2.0.1 core, and it’s very heavy going (backwards compatibility with any but the most basic Arduino functions of the 1.2.0 core is a minefield). It also seems to have trouble with the SD and EEPROM Arduino libraries (yes, even the SD-patch branch, unless I’m doing something wrong).

I’ve opened an issue with various gripes and errors here:

https://github.com/sparkfun/Arduino_Apollo3/issues/286

For anyone specifically interested in the twoWire problem, I personally found the example way overcomplicated and confusing, and to sum it up: replace the declaration “TwoWire myWire2(2);” with "MbedI2C myWire2(25,27); ". I don’t know if it works, but that at least sorted out the compile errors.

I agree that I2C example is far too complicated. It demonstrates the RTOS capabilities to read multiple Wire-interfaces in parallel using threads. Sparkfun should provide easier I2C examples which is used most of the time. I am using 1.8.13 and Wire.h has multiple issues that need to be overcome (posted as an issue https://github.com/sparkfun/Arduino_Apollo3/issues/289) and I expect will be solved in a next release.

For others some help

The Apollo3 has 6 IO-master (IOM) modules, which can be used for either I2c or SPI connection. Each module has fixed Pinpad for connecting, documented in 11.5.1 Implementing IO Master Connections of the Apollo3 datasheet.

Depending on which pins are made available on your board you can add another I2C channel by providing the right pin numbers . This is a bit reverse… but it is what it is.

Use the command : TwoWire myWire (SDA, SCL)

This table provides an overview on what pins you need to select for extra I2C channel

IOM     SDA      SCL

0       D6       D5           Is reserved for primary SPI channel, but if you are not using SPI :  SCL = SCK SDA = MISO
1       D9       D8
2       D25      D27          pin 25 is same as RX1 on ATP 
3       D43      D42          On Nano this is already used as for WIRE1
4       D40      D39          already used for standard WIRE / QIIC wire
5       D49      D48

Thanks Paul for taking the time to comment. Have you tried to compile “TwoWire myWire(SDA,SCL)”? I had to change it to “MbedI2C myWire2(SDA,SCL)” to get it to compile with the new core - the TwoWire type wasn’t recognised (there is some explanation in the comments of the new I2C example).

I have tried TwoWire and that worked for me . in Wire.h (my version 2.0.1) I see in line 67:

typedef arduino::MbedI2C TwoWire;

Also I am using 1.8.13 IDE.

Interesting, thanks.