I am trying to read and write to registers on an Actel FPGA using the LPC 3131.
I have setup the CPU to read the FPGA as external static RAM in 16 bit mode and am able to read registers from the FPGA but am unable to write to registers on the FPGA. I probe the Read/write(J2 on the CPU) signal to see if it goes low when I do a write (to tell the FPGA that I am writing to it) but it does not strobe low. The EBI_CS_0 does strobe low. Could you please help me figure out what the problem is.
The pins we have routed to the FPGA are EBI_NSTCS_0 and the EBI_NWE. We are selecting addresses between 0x2000 0000 and 2000 FFFF.
Below is the code I use to write to an FPGA register.
Void main (void) { //address to be written to #define FPGA_ADDR1 (*((volatile Int32U *) 0x20004024)) volatile Int32U WriteVal=0x4321ABCD; //initialization stuff //initialize SRAM InitSRAM(); //write value to the FPGA FPGA_ADDR1 = WriteVal; //Read back FPGA register volatile Int32U * ValRevReg = (Int32U *)FPGA_ADDR1; Int16U tester = *ValRevReg; } /*-------------------------------------------------------------------------------*/ void InitSRAM(void) { /*Select EBI/MPMC pins*/ SYSCREG_MUX_LCD_EBI_SEL_bit.Mux_LCD_EBI_sel = 1; /*Enable EBI Clock*/ CGU_Run_Clock(EBI_CLK); /*Enable MPMC clocks*/ CGU_Run_Clock(MPMC_CFG_CLK); CGU_Run_Clock(MPMC_CFG_CLK2); CGU_Run_Clock(TIMER0_PCLK); MPMCStaticWaitWen0 = 0x6; //wait of 2 clock cycles MPMCStaticWaitRd0 = 0x6; //wait of 2 clock cycles MPMCStaticConfig0 = 0x1; //8 bit mode = 0x0, 16 bit mode =0x1 MPMCStaticConfig0_bit.PM = 0x1; //asynch page mode MPMCDynamicControl= 0x0; //Disable dynamic control /*HCLK to MPMC_CLK ratio 1:1*/ MPMCConfig_bit.CLK = 0; /*Big Endian mode = 1, Little Endian Mode =0*/ MPMCConfig_bit.N = 0; /*Enable MPMC */ MPMCControl = 0x1; }
Thanks for the help.