FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
5986 Discussions

How do I use PIO which is configured as InOut?

Fjato
Beginner
1,277 Views

Hi,

 

For a Cyclone V project I configured a PIO as InOut with a width of 1 bit in Qsys. Unfortunately I am not quite sure how to use the PIO to write and read data. So, which value do I need to write to which register to read from this PIO and which value do I need to write to which register to write from this PIO?

 

Thank you in advance.

0 Kudos
7 Replies
YuanLi_S_Intel
Employee
1,145 Views

Hi Fabian,

 

Apologize that i dont know which PIO you are referring to? Are you referring to IP or what?

 

Thank You.

0 Kudos
Fjato
Beginner
1,145 Views

Hi Bruce,

 

sorry for the missing information. I am referring to the PIO Core with Avalon interace documented in https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/hb/nios2/n2cpu_nii51007.pdf.

 

Thank you in advance.

0 Kudos
sstrell
Honored Contributor III
1,145 Views

As the guide you pointed to states, you have to set direction in the direction register and then read or write the data register depending on the direction.

 

#iwork4intel

0 Kudos
Fjato
Beginner
1,145 Views

Hi, thanks for your reply. But I am not speaking about the bidirectional setting.

The IOs can be configured as Input, Output, Bidirectional and InOut. The first three ones are self-explanatory for me and are well documented. What I would like to know is the fourth setting InOut. If setting a single IO to InOut, I have access to two IO pins in Quartus, one being fixed input and the other one being fixed output. So I doubt, that I can set the direction for the pin. Instead I would expect, that I can write data for the output pin to the data register and read data from the input pin from another data register. But I can not find out what's the correct address / offset for both data register (offset "0" and bit "1" would be the case for all the other settings Input, Output and Bidirectional).

I hope could point out a problem a bit more. Pleas let me know if I misunderstood something. Thank you in advance and best regards.

0 Kudos
Fjato
Beginner
1,145 Views

Anyone, who can help? Thanks in advance and best regards.

0 Kudos
YuanLi_S_Intel
Employee
1,145 Views

OK, i understand what is your question already. For InOut, you have both input and output connected to the IP. Thus, you can just read / write the register 0 without the need to set register 1. Read Register 0 if you want to get the input and write register 0 if you want to write. Register 1 is only meant for bidirectional use only.

 

0 Kudos
DylanD
Novice
977 Views

Hello, I'm trying to do the same thing as Fjato. What are you referring too when you say register 0 and register 1?

0 Kudos
Reply