Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.

Reading Input Pin

Altera_Forum
Honored Contributor I
755 Views

Hi, I want to read a signal from a PIN. 

Everything ist fine I built it up in the SOPC Builder and declare a 8bit for Input. 

I chose 8Pins in Quartus and everything wotks fine. 

 

I can write Output to other Pins and it works also fine. 

 

But now I want to read a Pin if it 1 or 0. 

 

int in = IORD_ALTERA_AVALON_PIO_DATA(PIO_IN_BASE); 

printf("%i\n",in); 

 

Always they console print me 255. It doesen´t matter which PIN is on 3,3V from the Board. What I do wrong?? 

 

thx everybody for help.
0 Kudos
4 Replies
Altera_Forum
Honored Contributor I
54 Views

Hi,maybe i ask my question in another way. 

 

What must i normally do when i want to read an input pin. 

In the SOPC Builder I chose an 8bit wide input. The Pins are correct connected in the Pin planner. 

The Quartus II Software runs correct and I have communication with the Nios II Prozessor.  

What must i normally do when i want to read an input pin now??
Altera_Forum
Honored Contributor I
54 Views

IT looks like you are doing everything right. Using signaltap you can check the actual value of the 8-bti signal that you provide to the PIO, and verify that it is the value you set the pins to.

Altera_Forum
Honored Contributor I
54 Views

And if your pins are defined as inputs with weak pull-ups (which is the default on most devices) then they will read 1 unless you connect them to ground. Connecting them to Vccio won't change their value.

Altera_Forum
Honored Contributor I
54 Views

You are right.I did everything right but the only problem is I did`t put them on Ground. Now it works thx a lot Daixiwen. (http://www.alteraforum.com/forum/member.php?find=lastposter&t=35770

 

Problem solved!
Reply