fpga配置为地址/数据复用,16bit/nor同步模式,时钟使用gpmc_csn1 mode1,fpga single read/write用片选2。现在往fpga里写数据没有问题,但读的数据全是0,时钟管脚已设置为允许输入,读出的寄存器0x44E10880的值为0x00000031,管教应该设置正确,时序配置应该也没问题,请问还有什么没考虑到的吗?
pinmux配置如下:
static struct pinmux_config fpga_pin_mux[] = {
{"gpmc_ad0.gpmc_ad0", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
{"gpmc_ad1.gpmc_ad1", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
{"gpmc_ad2.gpmc_ad2", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
{"gpmc_ad3.gpmc_ad3", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
{"gpmc_ad4.gpmc_ad4", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
{"gpmc_ad5.gpmc_ad5", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
{"gpmc_ad6.gpmc_ad6", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
{"gpmc_ad7.gpmc_ad7", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
{"gpmc_ad8.gpmc_ad8", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
{"gpmc_ad9.gpmc_ad9", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
{"gpmc_ad10.gpmc_ad10", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
{"gpmc_ad11.gpmc_ad11", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
{"gpmc_ad12.gpmc_ad12", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
{"gpmc_ad13.gpmc_ad13", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
{"gpmc_ad14.gpmc_ad14", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
{"gpmc_ad15.gpmc_ad15", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
{"gpmc_csn0.gpmc_csn0", OMAP_MUX_MODE0 | AM33XX_PULL_DISA},
{"gpmc_csn1.gpmc_clk", OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLUP},
{"gpmc_csn2.gpmc_csn2", OMAP_MUX_MODE0 | AM33XX_PULL_DISA},
{"gpmc_wait0.gpmc_csn4", OMAP_MUX_MODE2 | AM33XX_PULL_DISA},
{"gpmc_wpn.gpmc_csn5", OMAP_MUX_MODE2 | 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},
{NULL, 0},
};
7个寄存器:
gpmc_config1_2: 0x28001200
gpmc_config2_2: 0xf0600
gpmc_config3_2: 0x60100
gpmc_config4_2: 0xe090602
gpmc_config5_2: 0x1051006
gpmc_config6_2: 0x9070280
gpmc_config7_2: 0xf41
驱动里直接读指定偏移地址里的16位数据:
data = readw(fpga_membase+offset_addr);
Jian Zhou:
之前论坛里很多人碰到过类似问题,如果写进去正常读出来不正常,首先测下读写信号,其次就是检查FPGA的配置。