SAMD21 I2C support


leonard.bise@...
 

I'm currently working on the board configuration for the SODAQ One which is very similar to the Adafruit Feather M0 already supported by Zephyr.
 
Console is working and I setup the SPI bus. I also managed to operate the RN2483 LoRa chip through UART.
 
This board has an uBlox EVA 8M GPS and LSM303AGR Accelerometer connected to the I2C bus (SERCOM3) which I'm trying to configure properly.
 
My problem is that the other SAM0 Family boards supported don't mention any I2C in their configuration.
I was expecting of finding something like for the UART/SPI i.e. CONFIG_I2C_SAM0 but it doesn't exist. I found however a generic SAM one, can I use this one? (CONFIG_I2C_SAM_TWI).
 
Any pointer on how to configure the i2c device please?
 
Thank you,
Léonard.


Michael Hope
 

Hi Leonard. I did a bit of the original SAMD21 bring up. There's no support for I2C ATM but you're welcome to add it.


On Fri, 29 Jun 2018, 12:45 , <leonard.bise@...> wrote:
I'm currently working on the board configuration for the SODAQ One which is very similar to the Adafruit Feather M0 already supported by Zephyr.
 
Console is working and I setup the SPI bus. I also managed to operate the RN2483 LoRa chip through UART.
 
This board has an uBlox EVA 8M GPS and LSM303AGR Accelerometer connected to the I2C bus (SERCOM3) which I'm trying to configure properly.
 
My problem is that the other SAM0 Family boards supported don't mention any I2C in their configuration.
I was expecting of finding something like for the UART/SPI i.e. CONFIG_I2C_SAM0 but it doesn't exist. I found however a generic SAM one, can I use this one? (CONFIG_I2C_SAM_TWI).
 
Any pointer on how to configure the i2c device please?
 
Thank you,
Léonard.


Léonard Bise <leodido99@...>
 

I'm currently working on the board configuration for the SODAQ One which is very similar to the Adafruit Feather M0 already supported by Zephyr.

Console is working and I setup the SPI bus. I also managed to operate the RN2483 LoRa chip through UART.

This board has an uBlox EVA 8M GPS and LSM303AGR Accelerometer connected to the I2C bus (SERCOM3) which I'm trying to configure properly.

My problem is that the other SAM0 Family boards supported don't mention any I2C in their configuration.
I was expecting of finding something like for the UART/SPI i.e. CONFIG_I2C_SAM0 but it doesn't exist. I found however a generic SAM one, can I use this one? (CONFIG_I2C_SAM_TWI).

Any pointer on how to configure the i2c device please?

Thank you,
Léonard.


Léonard Bise <leonard.bise@...>
 

Hello Michael,
 
I would be willing to try at least. Hopefully with some guidance it wouldn't be too hard.
I'm currently setting up my fork to have a clean dev env.
 
Just so I'm clear on what exactly needs to be done.
  • I need to write an I2C driver (i2c_sam0.c) that provides the required functionalities to the i2c driver API
  • Provide a binding dts file for atmel,sam0-i2c
  • Add fixups of the form CONFIG_I2C_SAM0_SERCOMX in zephyr/arch/arm/soc/atmel_sam0/samd21/dts.fixup
Anything else I'm missing?
 
Do you think I should open an issue regarding this ?
 
Best regards,
Léonard.