FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
5921 Discussions

altera_avalon_pio data remains constant

astrocyte
Novice
671 Views

I have an altera_avalon_pio in the Platform Designer configured as 1-bit wide input. All the required signals are connected (with the slave peripheral connected to a Nios2 Processor) and the external connection is exported. In the VHDL instantiation of the Platform Designer, the export is mapped to a signal driven by a GPIO pin of mode input, on the DE10-Nano board.

In addition to the PIO, the same signal is driving an LED port of mode output (directly from VHDL). And there is one more PIO, configured as output, which is mapped to an additional LED).

Now, the GPIO pin is connected externally to a microcontroller which drives it low.

When the microcontroller is connected, the LED driven from VHDL is off, and when it's disconnected the LED is on - so far so good. However, when I read the value of the PIO register from Nios2 code, the value remains constant (0), regardless of whether the microcontroller is connected or not and if I write this value to the LED PIO, I have the same issue. For reading the value, I'm using the IORD_ALTERA_AVALON_PIO_DATA( PIO_BASE ) macro function.

I'm using the following code to read the PIO data:

 

 

	while (1) {
		int in = IORD_ALTERA_AVALON_PIO_DATA( PIO_BASE );
		printf("pio data: %d\n", in);
		IOWR_ALTERA_AVALON_PIO_DATA( LED_BASE, in );
		usleep(1000000);
	}

 

 


The output from nios2-terminal is:

 

 

pio data: 0
pio data: 0
pio data: 0
pio data: 0

 

 

regardless of whether the microcontroller is connected or not.

Could you please advise what I need to do in order for the PIO data to be consistent with the state of the GPIO pin?

Can be ignored, I was using the wrong PIO_BASE in the C code..

0 Kudos
3 Replies
RichardTanSY_Intel
640 Views

Could you help to share your design project .qar file? It is hard to visualize with a lot of connection mentioned here. 

Best Regards,
Shyan Yew

0 Kudos
astrocyte
Novice
633 Views

Hi Shyan, many thanks for getting back. I found the issue - I was overriding the base address with a variable I introduced as a placeholder before generating the new .sopcinfo which contained the correct address. After removing the no longer necessary variable, it works as expected.

RichardTanSY_Intel
629 Views

Great to know that you are able to solve the issue! With that, I will now transition this thread to community support. If you have a new question, feel free to open a new thread to get the support from Intel experts. Otherwise, the community users will continue to help you on this thread. Thank you.

Best Regards,
Shyan Yew (Richard)

p/s: If any info from the community or Intel support are helpful, please feel free to give Kudos. 

Reply