|
我在擦除和读ID都没问题。
读操作:
nand_select_chip();
clearRB();
write_cmd(0x00);
NFADDR=0x00;
NFADDR=0x00;
NFADDR=0x00;
NFADDR=0x00;
write_cmd(0x30);
wait_idle();
for(j=0;j<50;j++)
{
putc(read_data()); //putc()是我写的从串口输出函数
}
nand_deselect_chip();
写操作:
nand_select_chip();
write_cmd(0x80);
NFADDR=0x00;
NFADDR=0x00;
NFADDR=0x00;
NFADDR=0x00;
write_data(0x11);
write_data(0x22);
write_data(0x33);
write_data(0x44);
write_data(0x55);
write_data(0x66);
write_data(0x77);
write_data(0x88);
write_data(0x99);
write_cmd(0x10);
wait_idle();
write_cmd(0x70);
if(read_data()&1)
{
putc(0); //如果写数据失败,从串口发送00
}
nand_deselect_chip();
|
|