Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20693 Discussions

Routing of I2C0 pins on SoC

Altera_Forum
Honored Contributor II
1,348 Views

Hello everybody, 

 

I'm a new player in the FPGA field and begun my journey with the DE0 board with Cyclone V SE. 

I would appreciate if someone help me figure out the I2C routing inside this SoC. Here's the thing. 

 

I'm using Qsys to develop my top-level entity. In my Qsys project I put the hard processor system block (HPS). 

I right-click on the block, chose Edit, then select the Peripheral Pins tab. I scroll down to the I2C section and see four I2C controllers. 

I read in the Cyclone V Device Handbook that the HPS provides four I2C controllers - so far so good. They can be configured as: 

- FPGA (every controller) - I understand that the controller pins are routed to the FPGA, 

- HPS I/O Set 0 (every controller) - I understand that the SDA/SCL pins are routed to the external pins A19 and C18 of the SoC (GPIO55 and GPIO56), 

- HPS I/O Set 1 (controller 0 and 1) - I understand that the SDA/SCL pins are routed to the external pins A21 and K18 of the SoC (GPIO51 and GPIO52). 

 

 

The DE0 board comes equipped with an ADXL345 on board connected to the I2C0 pins (hard wired to pins C18 and A19 of the SoC). 

I have a Linux app that gets readings from the ADXL345 over I2C0 and prints them out on screen. 

 

Here's the mind blower (at least for me): 

No matter how I configure the I2C0 pins in Qsys (either as FPGA, HPS Set 0, HPS Set 1, or just leave them as GPIO's) the readings from the ADXL345 still get printed. 

how is this possible? Is there some superior routing in the Soc that always connects the HPS I2C0 to the C18 and A19 pins, no matter how I configure it in Qsys? 

It doesn't make much sense for me. 

 

Please help me out with it. 

 

Thanks in advance. 

Łukasz
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
431 Views

Hi, the pin configuration for the HPS (for example, routing the I2C to HPS I/O set 0) takes place when the HPS boots up. If you set the HPS to boot from SD card for example, the preloader located inside the SDCard will configure the I/O configuration. Even if you reprogram the FPGA (giving it a new sof) the HPS pin configuration still remains, unless you explicitly update the preloader in the SD card.

0 Kudos
Altera_Forum
Honored Contributor II
431 Views

Hi sunshine, 

 

thanks for pointing that out. Now that I have read through some materials on the preloader everything seems clear.
0 Kudos
Altera_Forum
Honored Contributor II
431 Views

hello Luki B, 

 

I have a little bit confusion related to selection of HPS I/O set. On which basis I select the I/O Set? 

What is this 'Controller one', 'Controller two' or every controller? 

 

please help me to understand the basic concept behind selection of HPS I/O Set. 

 

 

Thanks
0 Kudos
Reply