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

Problem about PIO

Altera_Forum
Honored Contributor II
1,024 Views

Here is my code: 

# include <stdio.h># include <system.h># include "altera_avalon_pio_regs.h"# include "alt_types.h" 

 

 

int main() 

alt_u8 led = 0x1; 

IOWR(0x00000800,0,led); 

printf("Hello from Nios II!\n"); 

return 0; 

 

Here, 0x00000800 comes from "#define PIO_0_BASE 0x00000800" 

in system.h. But when I run the application in Modelsim. The out_port_from_the_pio_0 (2 bits) is zero all the time (I run it for 800us).  

Anybody know why? Thank you very much!
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
340 Views

Have you set the direction? If it is defined as an output port only it might not be needed but give it a try. In NIOS 1 I found that the PIO component did as expected but in NIOS2 I have to tell the port to go into output or input mode as required. 

 

Victor Schutte 

www.zerksus.com
0 Kudos
Reply