I have used the Q2687RD parallel port interface with FPGA, using CS3 and A24 to access two 16bits register of FPGA. here is my code:
#define Addr_Reg_Addr 0x24000000 //A24=0
#define Data_Reg_Addr 0x25000000 //A24=1
u16 addr_read,addr_write;
adl_busParallelSettings_t ParallelBusConfig=
{
ADL_BUS_PARALLEL_WIDTH_16_BITS, // 16 bits parallel bus
ADL_BUS_PARALLEL_MODE_ASYNC_INTEL,// Intel mode,
{0,0},
{3,2,2,2,0,{0,0,0}},
{2,2,2,2,0,{0,0,0}},
{
ADL_BUS_PARA_CS_TYPE_CS, 3, // Use CS3 pin
{0x00,0x00}
},
{ 0, 0 },
{ 0, 0, 0, 0, 0 },
0x01FFFFFF,
};
Parallel_Handle = adl_busSubscribe (ADL_BUS_PARALLEL , 1 , ( adl_busSettings_u *) &ParallelBusConfig);
ret = adl_busDirectWrite (Parallel_Handle, Addr_Reg_Addr,2,&addr_write);
ret = adl_busDirectRead (Parallel_Handle, Addr_Reg_Addr,2,&addr_read);
…
the problem is no matter what data I write to register, I always read back 0.
I’m not sure whether I have correctly using the "adl_busDirectWrite " and “adl_busDirectRead”
especially the address chipaddress, I supposed to be 0x24000000 for CS3, also the datasize, I supposed as two byte (16 bits), can anyone pointed out my mistake?
thanks
K.Y