- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Hi,
I have a 16-bit pio (input) in my sopc and I want to access the data through IORD_16DIRECT. The data shown on the port is 0x00, 0x01, 0x02....0xff (verified through signaltap). However, the received data after IORD_16DIRECT is 0x01, 0x03, 0x05.... Please give me some help on that!! Below is my code: alt_u16 data_temp; for(j=0;j<1400;j++){ data_temp = IORD_16DIRECT(PIO_DATA_BASE, 0); if(data_temp&0x100==0x100){ data_t[j] = data_temp; } else j--; }Enlace copiado
5 Respuestas
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Why the data shown is 0x00, 0x01 on signal tap instead it should be 0x0000, 0x0001 as it is a 16 bit PIO
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
I don't see any synchronization system in your code, so you have no way of defining or detecting when you read the PIO port.
If the PIO port input changes faster than your software can read it, then you'll miss some values.- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Hi Daxiwen,
This code (if(data_temp&0x100==0x100)) is for synchronization, I keep reading the port, if the 9th bit is high, it means data is coming. For the speed, I got the same result when I use 500K and 2M clock in my verilog code. So I guess it is not the reason. Is there any special mechanism for PIO 16bits? --- Quote Start --- I don't see any synchronization system in your code, so you have no way of defining or detecting when you read the PIO port. If the PIO port input changes faster than your software can read it, then you'll miss some values. --- Quote End ---- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Is your pio returning the next value on each read request?
Are you decoding the address lines properly? Although you are using IORD_16DIRECT() the bus cycle requested by the nios cpu will be a 32bit one (with all byte enables asserted). Since your slave is 16bit it will see 2 read cycles, one for address 0 and one for address 2 (not sure what the address line is called by then! - might be A0 relative to your slave). In practise it is best to use 32bit slaves and set the high bits to zero on reads.- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
The PIO doesn't contain bytenables so any access to it should be atomic and not split into multiple transactions by the fabric.
I recommend you use the access macros that come with the PIO so that you don't have to worry about your offsets. IORD_16DIRECT uses 2 byte offsets by the way. The macros are defined in "altera_avalon_pio_regs.h" in the directory: \ip\sopc_builder_ip\altera_avalon_pio\inc
Responder
Opciones de temas
- Suscribirse a un feed RSS
- Marcar tema como nuevo
- Marcar tema como leído
- Flotar este Tema para el usuario actual
- Favorito
- Suscribir
- Página de impresión sencilla