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++
12600 Discussions

Read back PIO output status

Altera_Forum
Honored Contributor II
1,016 Views

I have a Qsys PIO component that is 7 bits wide. It is configured as an output (it drives 7 LEDs). I would like to be able to determine which bits of the output are set and which are cleared (or alternatively, what 7-bit data the PIO is outputting). 

 

When I create my BSP project in Eclipse, I get the attached altera_avalon_pio_regs.h. It looks like I should be able to use IORD_ALTERA_AVALON_PIO_DATA(base) to read back the current output state, or one of the macros for reading the set or cleared bits. However, none of them seem to work. 

Has anyone tried to do this? Is it possible? 

0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
283 Views

I actually found the answer to this question on page 10-6 of this document. 

 

Heres the document the forum won't let me post links. Do a google search for Altera embedded peripherals IP user guide. 

According to the documentation, what I want to do is not possible. 

 

data Register 

Reading from data returns the value present at the input ports. If the PIO core 

hardware is configured in output-only mode, reading from data returns an undefined 

value. 

Writing to data stores the value to a register that drives the output ports. If the PIO 

core hardware is configured in input-only mode, writing to data has no effect. If the 

PIO core hardware is in bidirectional mode, the registered value appears on an output 

port only when the corresponding bit in the direction register is set to 1 (output). 

 

If anyone has a different answer than this, I'd be interested to know it.
0 Kudos
Reply