Hi,
I am working with a Terasic DE0-Nano-SoC board, and am working in DS-5 Community Edition 17.1.
I have created some PIO peripheral registers in Qsys / Platform Designer, connected to some well tested firmware, containing registers;
This data register PIO is bidirectional :
So in a c program, how do I change the data transfer direction ?
I appear to be able to write from an output only PIO, but so far only read from this bi-directional PIO.
Works when reading a read only register in my firmware :
SkelData_read = *(uint32_t *)h2p_lw_pio_d_addr;
Writing then reading a R/W register in my firmware always returns 0 :
*(uint32_t *)h2p_lw_pio_d_addr = Data;
Help appreciate,
Beau
I have had a reply on the Altera Forumn, that has given me the answer :
h2p_lw_pio_d_dirn = virtual_base + ( ( unsigned long )( ALT_LWFPGASLVS_OFST + PIO_D_BASE + 4 ) & ( unsigned long)( HW_REGS_MASK ) );
I understand the 1 vs 4 is due to word or byte addressing.
Working nicely now, able to read and write the registers in my own firmware, from C in Linux, via the SoC PIOs.Time to add the rest of my firmware .... Much appreciated austin944.Beau Webber