Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12603 Discussions

niosII in port data read problem

Altera_Forum
Honored Contributor II
1,234 Views

HI,I want to read in port data ,but I can't read correct value :( 

 

I use 

 

i=IORD(IN_PIO_BASE, 0); 

printf(" %d %d",IORD(IN_PIO_BASE, 0),i); 

 

 

 

Regardless of the input 1 or 0,it always print 1. 

 

 

i have no idel what wrong? 

anybody can help me?
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
282 Views

The function you are using seems to be reasonable. There are many possibilities to your problem. 

 

Make sure: 

1. The physical pin is assigned properly in your Quartus project (correct location, voltage standard). 

2. The pin assignment in your top level design is connected to the proper path to your SOPC or Q-SYS instantiation. 

3. The base address (IN_PIO_BASE) directly corresponds to the expected value in SOPC or Q-SYS. 

 

If you have looked at all of these and you are 100% sure they are correct, begin testing at the firmware level to make sure your pin is behaving properly. (tie it to an LED or use signaltap to monitor). Also, you can try hard-coding the input to SOPC/Q-SYS to a '1' or '0' and make sure software reads the proper value.
0 Kudos
Altera_Forum
Honored Contributor II
282 Views

 

--- Quote Start ---  

The function you are using seems to be reasonable. There are many possibilities to your problem. 

 

Make sure: 

1. The physical pin is assigned properly in your Quartus project (correct location, voltage standard). 

2. The pin assignment in your top level design is connected to the proper path to your SOPC or Q-SYS instantiation. 

3. The base address (IN_PIO_BASE) directly corresponds to the expected value in SOPC or Q-SYS. 

 

If you have looked at all of these and you are 100% sure they are correct, begin testing at the firmware level to make sure your pin is behaving properly. (tie it to an LED or use signaltap to monitor). Also, you can try hard-coding the input to SOPC/Q-SYS to a '1' or '0' and make sure software reads the proper value. 

--- Quote End ---  

 

 

I determined that the 1 and 3 are correct,but I don't understand 2 how to check.
0 Kudos
Altera_Forum
Honored Contributor II
282 Views

To verify your pin is connected to the proper path to your SOPC/Q-SYS instantiation: 

 

1. Open up your project in Quartus II. On the "Project navigator" pane, select the "Hierarchy" tab. (if you do not see the "Project Navigator" pane, there is a button in the toolbar to open it)  

2. You should see a Verilog or VHDL file at the top of the tree. Double click on it. 

3. Look for the pin name in the top level file. Verify that it is connected to the PIO of your SOPC/Q-SYS design.
0 Kudos
Altera_Forum
Honored Contributor II
282 Views

Thank you! 

Your method is good enough, I have solved the problem. :)
0 Kudos
Reply