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.
Link Copied
Hi Fabian,
Apologize that i dont know which PIO you are referring to? Are you referring to IP or what?
Thank You.
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.
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
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.
Anyone, who can help? Thanks in advance and best regards.
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.
For more complete information about compiler optimizations, see our Optimization Notice.