Forum Discussion

Fjato's avatar
Fjato
Icon for New Contributor rankNew Contributor
6 years ago

How do I use PIO which is configured as InOut?

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.

7 Replies

  • YuanLi_S_Intel's avatar
    YuanLi_S_Intel
    Icon for Regular Contributor rankRegular Contributor

    Hi Fabian,

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

    Thank You.

  • sstrell's avatar
    sstrell
    Icon for Super Contributor rankSuper Contributor

    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

  • Fjato's avatar
    Fjato
    Icon for New Contributor rankNew Contributor

    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.

  • Fjato's avatar
    Fjato
    Icon for New Contributor rankNew Contributor

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

  • YuanLi_S_Intel's avatar
    YuanLi_S_Intel
    Icon for Regular Contributor rankRegular Contributor

    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.

    • DylanD's avatar
      DylanD
      Icon for New Contributor rankNew Contributor

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