最近在做一个项目,中间有个gpmc'与fpga通信的模块,我的gpmc配置如下,异步、无复用、单读模式
am335x引脚配置如下:
static struct pinmux_config fpga_pin_mux[] = { {"gpmc_ad0.gpmc_ad0", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP}, {"gpmc_ad1.gpmc_ad1", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP}, {"gpmc_ad2.gpmc_ad2", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP}, {"gpmc_ad3.gpmc_ad3", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP}, {"gpmc_ad4.gpmc_ad4", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP}, {"gpmc_ad5.gpmc_ad5", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP}, {"gpmc_ad6.gpmc_ad6", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP}, {"gpmc_ad7.gpmc_ad7", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP}, {"gpmc_ad8.gpmc_ad8", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP}, {"gpmc_ad9.gpmc_ad9", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP}, {"gpmc_ad10.gpmc_ad10", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP}, {"gpmc_ad11.gpmc_ad11", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP}, {"gpmc_ad12.gpmc_ad12", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP}, {"gpmc_ad13.gpmc_ad13", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP}, {"gpmc_ad14.gpmc_ad14", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP}, {"gpmc_ad15.gpmc_ad15", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP}, {"gpmc_a1.gpmc_a1", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA}, {"gpmc_a2.gpmc_a2", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA}, {"gpmc_a3.gpmc_a3", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA}, {"gpmc_a4.gpmc_a4", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA}, {"gpmc_a5.gpmc_a5", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA}, {"gpmc_a6.gpmc_a6", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA}, {"gpmc_a7.gpmc_a7", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA}, {"gpmc_a8.gpmc_a8", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA}, {"gpmc_advn_ale.gpmc_advn_ale", OMAP_MUX_MODE0 | AM33XX_PULL_DISA}, {"gpmc_oen_ren.gpmc_oen_ren", OMAP_MUX_MODE0 | AM33XX_PULL_DISA}, {"gpmc_wen.gpmc_wen", OMAP_MUX_MODE0 | AM33XX_PULL_DISA}, {"gpmc_ben0_cle.gpmc_ben0_cle", OMAP_MUX_MODE0 | AM33XX_PULL_DISA}, {"gpmc_csn1.gpmc_csn1", OMAP_MUX_MODE0 | AM33XX_PULL_DISA}, {"gpmc_clk.gpmc_clk", OMAP_MUX_MODE0 | AM33XX_PULL_DISA}, {NULL, 0}, };
gpmc配置如下:(根据技术手册上的时序图配置的)
#define STNOR_GPMC_CONFIG1 0x00001000 #define STNOR_GPMC_CONFIG2 0x00121201 #define STNOR_GPMC_CONFIG3 0x00060602 #define STNOR_GPMC_CONFIG4 0x100a1a0a #define STNOR_GPMC_CONFIG5 0x00101213 #define STNOR_GPMC_CONFIG6 0x10000000
在fpga中用逻辑分析仪所得结果如下:
与手册上的时序很接近,但是我用万用表测量cs1引脚,电压很稳定,一直为高(3.25左右),不应该是为低吗,逻辑分析仪怎么测的为正常呢
panpan zuo:
有人没,在线等呀,用fpga仿真模块仿真同样的gpmc写时序时,fpga能正常读数据至fifo;而实际连接时,fpga判断nCS = 0 AND nADV = 0 一直为false,就进进入不了读地址的状态,一直停留在Idle状态
CASE MSTATE ISWHEN IDLE =>DELAY<=0;FIFO_CLEAR<='0';IO_EN<='0';flag_reg<="000";IF(nCS='0' AND nADV='0') THENMSTATE <=LOCK_ADV;ELSEMSTATE <=IDLE;END IF;WHEN LOCK_ADV =>flag_reg<="001";IF(DELAY<1) THENDELAY<=DELAY+1;ADDR_REG <=ADDR;ELSEIF(ADDR_REG=X"26") THENMSTATE <=READ_S1;DELAY<=0;ELSEMSTATE <=IDLE;END IF;END IF;
Steven Liu1:
回复 panpan zuo:
这个问题应该和你对片选的配置有关,请确认两点:
1. 对于你想使用的CS1,是否有做pinmux的初始化,确保pinmux是正确的;
2. 你上述的时序配置,是对于GPMC_Confign_1,这组寄存器进行的吗? (因为所有的片选信号共用了同样的数据线和地址线,如果你错误的配置到了片选0上,你一样能从数据线上、地址线上,检测到这些信号,只是CS1上没有信号。)