I2C_x initialisation

Hello,
I copy code from the daisy field to initialise I2C_1 Peripheral. So far, this is working great :

I2CHandle i2c_led;
static constexpr I2CHandle::Config i2c_led_config
= {I2CHandle::Config::Peripheral::I2C_1,
{{DSY_GPIOB, 8}, {DSY_GPIOB, 9}},
I2CHandle::Config::Speed::I2C_1MHZ};

i2c_led.Init(i2c_led_config);

I can communicate with my device using ReadDataAtAddress and WriteDataAtAddress function :

if(i2c_led.ReadDataAtAddress(136, 2, 1, kb_data, 1, 10) == I2CHandle::Result::OK) {…

But when I try to replicate this using other I2C peripheral (I2C_3 and I2C_4), the communication with the device did not work.
I tried :

static constexpr I2CHandle::Config i2c_kb1_config
= {I2CHandle::Config::Peripheral::I2C_3,
{{DSY_GPIOB, 12}, {DSY_GPIOC, 9}},
I2CHandle::Config::Speed::I2C_400KHZ};

i2c_kb1.Init(i2c_kb1_config);

static constexpr I2CHandle::Config i2c_kb2_config
= {I2CHandle::Config::Peripheral::I2C_4,
{{DSY_GPIOB, 6}, {DSY_GPIOB, 7}},
I2CHandle::Config::Speed::I2C_400KHZ};

i2c_kb2.Init(i2c_kb2_config);

but I’m not sure about this : {{DSY_GPIOB, 12}, {DSY_GPIOC, 9}} (I get the information in the daisy_seed.cpp file.)

Does anyone have a working example on how to use other I2C peripheral?

thanks!

I believe the issue is twofold:

  1. I2C3 is not fully accessible on the Daisy Seed. PC9 is connected to the I2C3_SDA pin, but PB12 is not connected to the I2C3_SCL pin. So that would explain why that one is not working.
  2. I2C4 not working actually appears to be a bug. The Alternate Function setting during initialization is hard coded to the AF# for I2C1 on either set of pins.

I’ve opened an issue on github, and we’ll try to get this resolved ASAP.

According to the daisy pinout, I2C3_SCL is on daisy pin 1 (GPIO 0). I thought it was PB12. How can I find the port / pin of this daisy GPIO ?

Since I2C_4 is currently not working, I can use I2C_2 (I need 3 different I2C peripheral), but on what GPIO is it available? (and how to know the port / pin of this GPIO?)

thanks

Oh wow, I missed that the graphic itself has that described.

The csv file is correct, and most, if not all alternate functions available on the Daisy Seed. It also has the port/pin combo listed.

Unfortunately only two I2C peripherals are fully exposed on the Daisy Seed. We’ll fix the diagram (and add the port/pin information to it) ASAP.

The processor’s datasheet has the complete list of alternate functions for every pin on the chip.

Though, I2C is designed to support multiple devices per bus. (Up to 64 devices on each peripheral) as long as they have their own addresses.

What devices are you trying to connect? You may be able to make this work with only one or two of the peripherals.

wow, this CSV file is exactly what I was looking for since months!

I have 1 PCA9685 for the leds, and 6 IS31SE5100 for capacitive touch control.
The 5100 only have 4 possible addresses. And I don’t want to mixes them with the 9685 since they do not run at the same bus frequency, and it will make all scheduling lot’s more complex…

I design my prototype based on advertised function of the daisy, I can’t really step back.

Maybe use an i2c multiplexer

yes, thanks, that’s a solution. (not a good one, but I can’t find a better for now)
But I’m a bit grumpy that I have to make an other prototype (with all cost and delay implied) just because i2c3 is not available as advertised…