- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi all,
I am using bidirectional pio for my design.Can some one tell me how to set the directions. I am using IOWR_ALTERA_AVALON_PIO_DIRECTION(PIO_DATA_BASE, 0); for using pio as output and IOWR_ALTERA_AVALON_PIO_DIRECTION(PIO_DATA_BASE, 1); for input. is it correct or not,because my design is not working as expected. Thanks in advance, SaratLink Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Actually they are inverted: 0 is for input and 1 for output.
Moreover this is correct only for single I/O pio: if your pio is wider, you need to set all the required bits. Last thing you need to check is if you enabled the bidirecitonal feature in sopc/Qsys pio properties- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for your reply. I am using 8 bit PIO for my design.I have set it as bidirectional in QSYS. What I understood from your post is,if I have to write 8 bits from the bus I have to write like this IOWR_ALTERA_AVALON_PIO_DIRECTION(PIO_DATA_BASE, 0); IOWR_ALTERA_AVALON_PIO_DIRECTION(PIO_DATA_BASE+2, 0); IOWR_ALTERA_AVALON_PIO_DIRECTION(PIO_DATA_BASE+4, 0); IOWR_ALTERA_AVALON_PIO_DIRECTION(PIO_DATA_BASE+6, 0); IOWR_ALTERA_AVALON_PIO_DIRECTION(PIO_DATA_BASE+8, 0); IOWR_ALTERA_AVALON_PIO_DIRECTION(PIO_DATA_BASE+10, 0); IOWR_ALTERA_AVALON_PIO_DIRECTION(PIO_DATA_BASE+12, 0); IOWR_ALTERA_AVALON_PIO_DIRECTION(PIO_DATA_BASE+14, 0); IOWR_ALTERA_AVALON_PIO_DATA ( PIO_DATA_BASE , address ); and for reading IOWR_ALTERA_AVALON_PIO_DIRECTION(PIO_DATA_BASE, 1); IOWR_ALTERA_AVALON_PIO_DIRECTION(PIO_DATA_BASE+2, 1); IOWR_ALTERA_AVALON_PIO_DIRECTION(PIO_DATA_BASE+4, 1); IOWR_ALTERA_AVALON_PIO_DIRECTION(PIO_DATA_BASE+6, 1); IOWR_ALTERA_AVALON_PIO_DIRECTION(PIO_DATA_BASE+8, 1); IOWR_ALTERA_AVALON_PIO_DIRECTION(PIO_DATA_BASE+10, 1); IOWR_ALTERA_AVALON_PIO_DIRECTION(PIO_DATA_BASE+12, 1); IOWR_ALTERA_AVALON_PIO_DIRECTION(PIO_DATA_BASE+14, 1); data = IORD_ALTERA_AVALON_PIO_DATA(PIO_DATA_BASE); am I correct?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wrong!
You must write the same register but different bits bit 0 = I/O nr. 1 bit 1 = I/O nr. 2 ... bit 7 = I/O nr. 8 For example: IOWR_ALTERA_AVALON_PIO_DIRECTION(PIO_DATA_BASE, 0x43); sets I/O 1,2 and 7 as outputs and all the others as inputs, since 0x43 is binary 01000011 The same applies for writing output values or reading inputs In Qsys you have the option "Enable individual bit set/clear output register"; if you selected it, you can set/clear a single output through outset/outclear registers, otherwise you must write all of them jointly. i.e. IOWR_ALTERA_AVALON_PIO_DATA(PIO_DATA_BASE, 0x42) sets an high level on lines 2 and 7 (clearly they must have been previously set as outputs) Reading is simpler: you call data = IORD_ALTERA_AVALON_PIO_DATA(PIO_DATA_BASE) and simply test the required bits of data.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much for reply,
It is working.you really saved my life :).- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!!!
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page