Accessing RPi I2C Pins

Hello

I’m using a Matrix Voice at the moment. I have an external sensor that uses I2C to communicate with its host.

I’m referring to this pinout diagram:

https://matrix-io.github.io/matrix-documentation/matrix-voice/resources/pinout/

I can’t see where in the Matrix Voice GPIO expansion I would connect the SDA or SCL pins from my sensor. Pins 3 and 5 of the RPi don’t appear to be broken out. Is there a solution to this; i.e. a way for me to use an I2C device while the Voice is connected to the RPi?

Thanks

Hi @paul.m,

Thank you for posting! The MATRIX Voice GPIOs do not currently have I2C pins. We will be working on this in the future.

One way you could still make it work, would be to solder your device’s I2C pins directly to the SDA and SCL pins on the Raspberry Pi. However, be advised that this needs skill to avoid creating unwanted connections.

Hi there, isn’t it directly possible to passthrough the I2C signals from the Pi to the Matrix GPIO ?
Thanks :slight_smile:

Btw @paul.m you can connect the Voice to the Pi using Dupont wires, therefore you can access to the I²C pins :slight_smile:

Yes, you are correct, we can route the I2C pins from the Pi to the MATRIX Voice’s GPIOs through the FPGA. We will be working on this soon :slight_smile:

is there a solution now or not yet?

@mirame,

Yes! The FPGA is now fully open, so you can route the RPi’s I2C pins to whichever MATRIX Voice GPIO you’d like.

If you look at the MATRIX Voice pinout here, you will see that the RPi’s i2c pins are connected to FPGA C11 & FPGA C13.

You can follow this Hackster guide to setup the FPGA programming environment & follow this example for FPGA C11 (RPi BCM pin 2- SDA) & FPGA C13 (RPi BCM pin 3- SCL).

So, you will need to add these 2 new lines in the voice.ucf file:

NET "rpi_sda" LOC="C11" | IOSTANDARD = LVCMOS33;
NET "rpi_scl" LOC="C13" | IOSTANDARD = LVCMOS33;

and then route rpi_sda & rpi_scl to the MATRIX Voice GPIO pins of your choice.

Let us know if you have more questions!

Best,
Samreen

1 Like

ok thank you a lot for the fast reply. i am going to try it now and let you know. thanks again

2 Likes

hello,
I followed the tutorial step by step and hence I added in voice.ucf the 2 lines you sent me :slight_smile: " NET “rpi_sda” LOC=“C11” | IOSTANDARD = LVCMOS33;
NET “rpi_scl” LOC=“C13” | IOSTANDARD = LVCMOS33;
"
AND also I added for the matrix voice expansion board the 2 lines:
NET “gpio_io_15” LOC=“R2” | IOSTANDARD = LVCMOS33;
NET “gpio_io_14” LOC=“R2” | IOSTANDARD = LVCMOS33;

also
in system.v :slight_smile:

GPIO_WIDTH=14(since i changed 2 )
ALSO
in mux_io.v:

"parameter GPIO_WIDTH=14

I added also in system.v:
"assign gpio_io_14= rpi_scl ;
assign gpio_io_15 =rpi_sda

i compiled it with no error and flashed the fpga on the matrix voice like your tutorial.

now when i put my accelerometer(MPU9250) to use it, its giving me error. (bus.write_byte_data(self.address, PWR_MGMT_1, 0X00)
and when im doing sudo i2cdetect -y 1 , it is showing me empty lines, no addresses.
how can i fix it.?

thanks in advance.

i really hope you can answer me :frowning: @Samreen

@mirame,

Did you do the part where you declare rpi_scl & rpi_sda as inouts?

Best,
Samreen

yes i declared in system.v
inout rpi_sda
inout rpi_scl
inout gpio_io_14
inout gpio_io_15

@samreen,

do the whole code looks good to you?

Hi @mirame,

I apologize for the silence the past few days. We are looking into this internally, and will get back to you after some testing tomorrow.

Thank you for your patience!

Best,
Samreen

1 Like

Hi @mirame,

I am testing the I2C example now with some additional changes to the FPGA code other than the ones I told you. One error I noticed just now with what you sent before. You mentioned you have the following in your voice.ucf file.

The above code has gpio 15 and 14 both defining connection R2. For gpio_io_14 LOC should be R1.

Just wanted to point that out real quick! Will update you shortly with my results.

Hello Samreen,

yes, I refixed it but still, it is not working.

Thank youuu:)

Hey @mirame,

Turns out it’s a bit more complex than we thought, and not as simple as connecting the bus to the MATRIX Voice GPIO. We will be trying some more over this weekend, and will get back to you soon!

Best,
Samreen

ok thank you so much

Hi @mirame,

I wanted to provide an update since I received your email earlier today.

We need to build out some i2c infrastructure inside the FPGA to be able to route the SDA and SCL pin to the MATRIX Voice pinout. I have been trying some methods, but have not found a complete solution yet. I will keep you posted on progress.

Thank you for your patience!

Best,
Samreen