Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers

Problem PIO

Altera_Forum
Honored Contributor II
2,504 Views

Hello to all, 

 

I'm new in FPGA and I have a Cyclone II and I made a design with a Nios II. 

I just want to drive a component (LM629) and I have to send et receive data. 

 

I created a tri state PIO 

 

# define LM629_DON_NAME "/dev/LM629_DON" 

# define LM629_DON_TYPE "altera_avalon_pio" 

# define LM629_DON_BASE 0x01000010 

# define LM629_DON_SPAN 16 

# define LM629_DON_DO_TEST_BENCH_WIRING 0 

# define LM629_DON_DRIVEN_SIM_VALUE 0x0000 

# define LM629_DON_HAS_TRI 1 

# define LM629_DON_HAS_OUT 0 

# define LM629_DON_HAS_IN 0 

# define LM629_DON_CAPTURE 0 

# define LM629_DON_EDGE_TYPE "NONE" 

# define LM629_DON_IRQ_TYPE "NONE" 

# define LM629_DON_FREQ 85000000 

# define ALT_MODULE_CLASS_LM629_DON altera_avalon_pio 

 

 

To send a data I just write IOWR_ALTERA_AVALON_PIO_DATA(LM629_DON_BASE , mydata).... and the problem that it doesn't work, I can't send the data... 

 

I read I have to change the direction of my port and I use IOWR_ALTERA_AVALON_PIO_DIRECTION(base, data) 

 

But finally it's the same thing. :(  

 

Can you help me ?? 

 

Thanks
0 Kudos
7 Replies
Altera_Forum
Honored Contributor II
1,419 Views

did you get nios with an altera dev board? Look in the Examples directory within the kit install path for examples that use PIO.

0 Kudos
Altera_Forum
Honored Contributor II
1,419 Views

Did you check the header file altera_avalon_pio_regs.h? There are several defines there that can be of interest: 

 

 

# define IOADDR_ALTERA_AVALON_PIO_DIRECTION(base) __IO_CALC_ADDRESS_NATIVE(base, 1) 

# define IORD_ALTERA_AVALON_PIO_DIRECTION(base) IORD(base, 1)  

# define IOWR_ALTERA_AVALON_PIO_DIRECTION(base, data) IOWR(base, 1, data) 

 

 

# define ALTERA_AVALON_PIO_DIRECTION_INPUT 0 

# define ALTERA_AVALON_PIO_DIRECTION_OUTPUT 1
0 Kudos
Altera_Forum
Honored Contributor II
1,419 Views

I have almost the same problem. 

I created a component in Qsys with 3 differently Conduits (sd_clk, sd_cmd and sd_dat) and for this component I have just one Base. 

How can I use the function IOWR_ALTERA_AVALON_PIO_DIRECTION(component_base, _____) to write output and input for each of the conduits? 

Does anyone have an idea? 

Thank a lot in advance!!!
0 Kudos
Altera_Forum
Honored Contributor II
1,419 Views

Those functions are only for Avalon interfaces. Conduits, by their nature, are interfaces that don't conform to a standard supported in Qsys, like Avalon. If you want to use those functions, you have to implement Avalon interfaces on your custom component.

0 Kudos
Altera_Forum
Honored Contributor II
1,419 Views

 

--- Quote Start ---  

Those functions are only for Avalon interfaces. Conduits, by their nature, are interfaces that don't conform to a standard supported in Qsys, like Avalon. If you want to use those functions, you have to implement Avalon interfaces on your custom component. 

--- Quote End ---  

 

 

But I implemented Avalon interface for my component. When I created my component in Qsys, the Avalon interface actually appeared automatically and I just added the three conduits to it.
0 Kudos
Altera_Forum
Honored Contributor II
1,419 Views

I don't understand. What are those conduits connected to? They are single signals, not Avalon interfaces, so you can't use the functions you mention except for that slave interface.

0 Kudos
Altera_Forum
Honored Contributor II
1,419 Views

 

--- Quote Start ---  

I don't understand. What are those conduits connected to? They are single signals, not Avalon interfaces, so you can't use the functions you mention except for that slave interface. 

--- Quote End ---  

 

 

These conduits are connected to the PINs of my FPGA board. 

 

I followed this tutorial: http://scale.engin.brown.edu/classes/en2911xf14/qsys_comp.pdf 

 

and did the creation of a new component exactly as the reg16_avalon_interface, the only diference was the three conduits and not just one. 

This tutorial doesn't show how to use the functions IOWR_ALTERA_AVALON_PIO_DIRECTION and IOWR_ALTERA_AVALON_PIO_DATA, but I understood that I could do like this: 

IOWR_ALTERA_AVALON_PIO_DATA(reg16_avalon_interface_base, 0xFFFF) and IOWR_ALTERA_AVALON_PIO_DATA will not be needed since to_hex (conduit) is an output. 

 

I think it would be the same in my case, but I don't know how to write it in these functions, since I have three conduits (sd_clk : out, sd_cmd : inout, sd_dat : inout) and one of them (sd_dat) is a std_logic_vector of size 4. That means I have 6 signals altogether. 

 

The tutorial shows how to make an avalon interface slave and uses it. But does not show how to use these functions in a software (Nios II Eclipse, which I am using). 

 

Is it really not possible to use these functions for my case?
0 Kudos
Reply