|
谁帮忙看一下这个关于SST39VF040擦除的小问题(附短小的代码)
[复制链接]
下面是SST39VF040 Flash的扇区擦除代码,但是应该是有问题的,我擦除不成功,另外的读写和整片擦除都没有问题,就不贴出来了,哪位仁兄给我瞧瞧问题出在哪里?
- void Chip_Page_Erase(ulong s_addr)
- {
- ulong temp_address = 0;
- Sst39vf040_Oe=0;
- Sst39vf040_We=1;
- Address18=0;
- Address17=0;
- Address16=0;
- Address7_0=0x55;
- P0=Address7_0;
- ALE=1;
- Address15_8=0x55;
- ALE=0;
-
- Sst39vf040_Oe=1;
- Sst39vf040_We=0;
- DataOut=0xaa;//1
- Delay10us();
- Sst39vf040_We=1;
- Address7_0=0xaa;
- P0=Address7_0;
- ALE=1;
- Address15_8=0x2a;
- ALE=0;
- Delay10us();
- Sst39vf040_We=0;
- DataOut=0x55;//2
- Delay10us();
- Sst39vf040_We=1;
- Address7_0=0x55;
- P0=Address7_0;
- ALE=1;
- Address15_8=0x55;
- ALE=0;
- Delay10us();
- Sst39vf040_We=0;
- DataOut=0x80;//3
- Delay10us();
- Sst39vf040_We=1;
- Delay10us();
- Sst39vf040_We=0;
- DataOut=0xaa;//4
- Delay10us();
- Sst39vf040_We=1;
- Address7_0=0xaa;
- P0=Address7_0;
- ALE=1;
- Address15_8=0x2a;
- ALE=0;
- Delay10us();
- Sst39vf040_We=0;
- DataOut=0x55;//5
- Delay10us();
- Sst39vf040_We=1;
- temp_address=s_addr;
- Address7_0=temp_address&0x0000ff;
- P0=Address7_0;
- ALE=1;
- temp_address=s_addr;
- Address15_8=(temp_address&0x000f00)>>8;
- ALE=0;
- Delay10us();
- Sst39vf040_We=0;
- DataOut=0x30;
- Delay10us();
- Sst39vf040_We=1;
- while(!Wait_Data_Pulling());
- }
复制代码
|
|