Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
11 years ago

Bidirectional pin problem

Hi,

I am using bidirectional SDIO pin for implementing an ADC SPI controller.

As the ADC doesn't have separate SDO line, I Am left with no choice but to use the bidirectional pin.

The controller takes RD/WR,DATA and ADDRESS LINE as input.

In the beginning of each cycle it writes the RD/WR and ADDRESS signal to the ADC through SDIO line.

Then depending on the RD/WR signal it switches its polarity to either write DATA into ADC through that SDIO line or read data from ADC using the same SDIO line.

I am getting no error during synthesis.

But as I try to simulate the same, the SDIO line gets into 'X' state at all those points where a transition in its value is expected.

Please help me with the same.

I have attached my code and testbench and application note related to the same

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Its because you've enabled the sdio from the testbench and inside the entity. So both are driving the bus at the same time. You need to ensure one side is always 'Z'.

    Looking at the waveform, tri_en = '0', and bus_en = '1' (whcih sets tri_en internally to '0'), so the TB and the spi_interface are driving the same wire.