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?Link Copied
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 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.
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.Thank you!
Your method is good enough, I have solved the problem. :)For more complete information about compiler optimizations, see our Optimization Notice.