本人新手一个,求大神解答,或者给出引导方向。。。。
最近在L137上搞vxWorks的flash驱动,开发板是合众达的SEED-DEC137,BSP用的是ti_omapl137evm,已经用uboot成功加载跑起来,操作系统跑起来后,用示波器检测nandflash的CE引脚,发现为高电平,并没有被选中。
我是暂时没有按照vxWorks的flash驱动机制去依次编写sysTffs.c,tffsConfig.c,xxMTD.c,而是想先暂时写个nandflash的芯片状态读函数,所以就先初始化了EMIFA、flash等,并将初始化代码放在BSP目录的syslib.c里面,然后在用户程序(usrAppInit.c)里加了读芯片状态的函数,但读失败,并出现data abort。
初始化代码如下:
*(volatile unsigned int*)(0x68000000 + 0x14 ) =(0 //配置CE3_CFG,即A2CR
|(0<<31) // selectStrobe
|(0<<30) // extWait
|(2<<26) // writeSetup // 0 ns//0
|(8<<20) // writeStrobe // 50 ns
|(2<<17) // writeHold // 0 ns
|(2<<13) // readSetup // 0 ns//0
|(6<<7) // readStrobe // 80 ns
|(2<<4) // readHold // 30 ns
|(3<<2) // turnAround // 10 ns//2
|(0<<0)); // asyncSize // 8-bit bus
*(volatile unsigned int*)(0x68000000 + 0x60 ) |= (1<<2); //配置NANDFCR,select EMA_CS3
*(volatile unsigned int*)(0x68000000 + 0x4 ) =0xFF; //配置AWCC,setup WP and MAX_EXT_WAIT
/* write the kick registers to unlock the PINMUX registers */
*(volatile unsigned int*)(0x01C14000 + 0x038) = 0x83e70b13; /* Kick0 unlock */
*(volatile unsigned int*)(0x01C14000 + 0x03c) = 0x95a4f1e0; /* Kick1 unlock */
//*(volatile unsigned int*)(0x01C40000 + 0x8) | = 0x00000004;
*(volatile unsigned int*)(0x01C14000 + 0x154) &= 0x00FFFFFF;
*(volatile unsigned int*)(0x01C14000 + 0x154) |= ((1<<28)|(1<<24)); //PINMUX13,Selects Output Function EMA_D[0-1]
*(volatile unsigned int*)(0x01C14000 + 0x158) |= 0x111111; //PINMUX14,Selects Output Function EMA_D[2-7]
*(volatile unsigned int*)(0x01C14000 + 0x15C) |= (1<<28); //PINMUX15,Selects Output Function EMA_A[1]
*(volatile unsigned int*)(0x01C14000 + 0x160) |= (1<<0); //PINMUX16,Selects Output Function EMA_A[2]
*(volatile unsigned int*)(0x01C14000 + 0x168) |= ((1<<4)|(1<<16)|(1<<20)); //PINMUX18,Selects Output Function EMA_WE,EMA_CS[3],EMA_OE
*(volatile unsigned int*)(0x01C14000 + 0x16c) &= 0xFFFFFFF0;
*(volatile unsigned int*)(0x01C14000 + 0x16c) |= 0x1; //PINMUX19,Selects Output Function EMA_WAIT[0]
/* write the kick registers to lock the PINMUX registers */
*(volatile unsigned int*)(0x01C14000 + 0x038) = 0x0; /* Kick0 lock */
*(volatile unsigned int*)(0x01C14000 + 0x03c) = 0x0; /* Kick1 lock */
然后 读flash芯片状态的代码如下:
#define FLASH_BASE_ADRS 0x62000000
#define FLASH_COMMAND *(volatile unsigned char*)(FLASH_BASE_ADRS+0x10)
#define DATA_ADDRESS *(volatile unsigned char*)(FLASH_BASE_ADRS+0x08)
#define FLASH_DATA *(volatile unsigned char*)(FLASH_BASE_ADRS)
unsigned char chipStatus;/*芯片状态*/
FLASH_COMMAND = 0x70;/*读芯片状态命令*/
chipStatus=FLASH_DATA;/*读取状态*/
printf("%x",chipStatus);
Gary Wu:
可以参考starterware中的nand flash代码
junjie li2:
回复 Gary Wu:
我的也是合众的板子,不过我是L138核心板。我也正在搞nandflash驱动,但是我把在CCS下运行正常的nandflash代码移植到vxworks中后却不能正常运行了!!
追问:
TI有没这方面(vxworks)的的BSP可供参考?
楼主能否分享或者共同探讨下关于NandFlash的驱动以及TFFS文件系统相关的技术?
另外:楼主的CS脚为高,应该是管脚没有配置对!
junjie li2:
回复 junjie li2:
我把CCS中的代码移植到vxworks中去,显示的结果和楼主一样——Data abort
查了几天,不知何原因!!期待解答!!
Tony Tang:
回复 junjie li2:
检查NAND地址段是否在MMU配置中映射了。