arduino / ArduinoCore-samd

Arduino Core for SAMD21 CPU
GNU Lesser General Public License v2.1
467 stars 714 forks source link

board_driver_i2c.c not visible at runtime #477

Open sanotronics opened 4 years ago

sanotronics commented 4 years ago

Hi!

I am trying to set-up a bootloader for my custom board, starting from the arduino zero bootloader.

I want to communicate with an external EEPROM with I2C on pins PA22 and PA23 (SERCOM3). I was able to do this succesfully, setting up a "library" starting from the ASF example for I2C master polled.

But the same code doesn't work on SAM-BA, because ASF is not included. Tried including it but I couldn't manage to make it work.

I found the included functions (_board_driveri2c.c and _board_driveri2c.h) and I included a few that use them in order to read and write to the EEPROM.

I can compile on Atmel Studio without errors, but I get warnings for "undefined reference" to all of the I2C functions.

I checked and the C files are included in the Makefile, so I am at lost as to why the final program can't find them.

If I run a step by step debugging session, and I try to step into these functions, it just skips them.

I leave a link to the repo for the code

I added to main.c lines 212 - 230, which call the functions to read and write to the EEPROM. These are the ones that use the included I2C functions, defined in extEEPROM.c

2019-12-09 19_21_35-samd21_sam_ba - AtmelStudio

Any help will be appreciated.

Thanks!

sanotronics commented 4 years ago

I found the cause.

It's the CONFIGURE_PMIC tag that wasn't defined anywhere and it was needed to compile all the i2c functions.

Now I'm having trouble to make the I2C work... I configured SERCOM3 but when debugging I think the registers don't seem to update when the assignments are done.