AnsweredAssumed Answered

imx6q EIM 异步模式读不到FPGA数据

Question asked by dawei li on May 21, 2020
Latest reply on May 31, 2020 by jimmychan

1、16位地址,16位数据,非复用模式。

pinctrl_fpga: weimgrp {
fsl,pins = <
MX6QDL_PAD_EIM_CS0__EIM_CS0_B 0xb0b1

MX6QDL_PAD_EIM_LBA__EIM_LBA_B 0xb0b1
MX6QDL_PAD_EIM_BCLK__EIM_BCLK 0xb0b1
MX6QDL_PAD_EIM_OE__EIM_OE_B 0xb0b1
MX6QDL_PAD_EIM_RW__EIM_RW 0xb0b1
MX6QDL_PAD_EIM_WAIT__EIM_WAIT_B 0x0b060
MX6QDL_PAD_EIM_A25__GPIO5_IO02 0x130b0

// MX6QDL_PAD_EIM_EB0__EIM_EB0_B 0x1b0b0
// MX6QDL_PAD_EIM_EB1__EIM_EB1_B 0x1b0b0
// MX6QDL_PAD_EIM_EB2__EIM_EB2_B 0x1b0b0
// MX6QDL_PAD_EIM_EB3__EIM_EB3_B 0x1b0b0
MX6QDL_PAD_EIM_EB2__EIM_EB2_B 0x30a8
MX6QDL_PAD_EIM_EB3__EIM_EB3_B 0x30a8

 

MX6QDL_PAD_EIM_D16__EIM_DATA16 0x1b0b0
MX6QDL_PAD_EIM_D17__EIM_DATA17 0x1b0b0
MX6QDL_PAD_EIM_D18__EIM_DATA18 0x1b0b0
MX6QDL_PAD_EIM_D19__EIM_DATA19 0x1b0b0
MX6QDL_PAD_EIM_D20__EIM_DATA20 0x1b0b0
MX6QDL_PAD_EIM_D21__EIM_DATA21 0x1b0b0
MX6QDL_PAD_EIM_D22__EIM_DATA22 0x1b0b0
MX6QDL_PAD_EIM_D23__EIM_DATA23 0x1b0b0
MX6QDL_PAD_EIM_D24__EIM_DATA24 0x1b0b0
MX6QDL_PAD_EIM_D25__EIM_DATA25 0x1b0b0
MX6QDL_PAD_EIM_D26__EIM_DATA26 0x1b0b0
MX6QDL_PAD_EIM_D27__EIM_DATA27 0x1b0b0
MX6QDL_PAD_EIM_D28__EIM_DATA28 0x1b0b0
MX6QDL_PAD_EIM_D29__EIM_DATA29 0x1b0b0
MX6QDL_PAD_EIM_D30__EIM_DATA30 0x1b0b0
MX6QDL_PAD_EIM_D31__EIM_DATA31 0x1b0b0

 

MX6QDL_PAD_EIM_DA15__EIM_AD15 0xb0b1
MX6QDL_PAD_EIM_DA14__EIM_AD14 0xb0b1
MX6QDL_PAD_EIM_DA13__EIM_AD13 0xb0b1
MX6QDL_PAD_EIM_DA12__EIM_AD12 0xb0b1
MX6QDL_PAD_EIM_DA11__EIM_AD11 0xb0b1
MX6QDL_PAD_EIM_DA10__EIM_AD10 0xb0b1
MX6QDL_PAD_EIM_DA9__EIM_AD09 0xb0b1
MX6QDL_PAD_EIM_DA8__EIM_AD08 0xb0b1
MX6QDL_PAD_EIM_DA7__EIM_AD07 0xb0b1
MX6QDL_PAD_EIM_DA6__EIM_AD06 0xb0b1
MX6QDL_PAD_EIM_DA5__EIM_AD05 0xb0b1
MX6QDL_PAD_EIM_DA4__EIM_AD04 0xb0b1
MX6QDL_PAD_EIM_DA3__EIM_AD03 0xb0b1
MX6QDL_PAD_EIM_DA2__EIM_AD02 0xb0b1
MX6QDL_PAD_EIM_DA1__EIM_AD01 0xb0b1
MX6QDL_PAD_EIM_DA0__EIM_AD00 0xb0b1
>;
};

 

2、寄存器设置

&weim {
compatible = "fsl,imx6q-weim";
reg = <0x021b8000 0x4000>;
clocks = <&clks IMX6QDL_CLK_EIM_SLOW>;
pinctrl-names = "defaults";
pinctrl-0 = <&pinctrl_fpga>;
#address-cells = <2>;
#size-cells = <1>;
ranges = <0 0 0x08000000 0x08000000>;
fsl,weim-cs-gpr = <&gpr>;
// ranges = <0 0 0x08000000 0x08000000>;
status = "okay";


#if 1
fpga@0,0 {
compatible = "cfi-flash";
reg = <0 0 0x10000>;
#address-cells = <1>;
#size-cells = <1>;
bank-width = <2>;
fsl,weim-cs-timing = <0x00020081 0x00000001 0x0c171300
0x00000000 0x0a000000 0x00000000>;
};
#endif

};

 

3、波形描述

调整6个寄存器。cs lba oe信号能出来,但是eb2,eb3始终为高,不随cs改变。

 

4、读写程序

#define WEIM_CTRL_BASE (0x21B8000)
#define FPGA_ADDRESS (0x8000000)
#define FPGA_SIZE (0x20000)

 

ptr_fpga = mmap(0, FPGA_SIZE, PROT_READ, MAP_SHARED, ffpga, FPGA_ADDRESS);

if(ptr_fpga == NULL)
{
perror("mmap failed\n");
exit(-1);
}
ptr_fpga_ori = ptr_fpga;

 

for(i=0;i< (FPGA_SIZE/4);i++)
{
buf[i] = *ptr_fpga_ori++;
if(buf[i]!=0)
printf("address value %8x \n",buf[i]);
}
munmap(ptr_fpga, FPGA_SIZE);

 

5、结果

程序中如果指定内存有非零数据,打印出来。结果没有打印,都是零。

 

用devmem 0x8000000 16      查看,结果也是0x0000。

Outcomes