共2条
1/1 1 跳转至页
am29lv160dt,flash am29lv160dt flash 擦除
问
am29lv160dt flash 擦除某一sector时怎么全片都擦除了
这是下面的代码,请高手看看有没有写错。
void flash_erase(P_U16 base_addr){
P_U16 Temp;
U32 i=35000000;
/* Issue the Sector Erase command to am29lv160dt */
Temp = (P_U16)((0x0000555<<1)+FLASH_ADDRESS); *Temp = 0xAA;
Temp = (P_U16)((0x00002AA<<1)+FLASH_ADDRESS); *Temp = 0x55;
Temp = (P_U16)((0x0000555<<1)+FLASH_ADDRESS);
*Temp = 0x80;
Temp = (P_U16)((0x0000555<<1)+FLASH_ADDRESS);
*Temp = 0xAA;
Temp = (P_U16)((0x00002AA<<1)+FLASH_ADDRESS);
*Temp = 0x55;
Temp = base_addr;
*Temp = 0x30;
while(i--);//Delay
} 答 1: 有没有人用过个flash呢有没有人用过个flash呢 答 2: re:woaini看看我的擦除操作:
#define WRITE_FLASH(uiAddr,usData) *((volatile INT16U *)(uiAddr << 1))= usData
void bSST39VF160SectorErase(INT32U uiAddr)
{
WRITE_FLASH(0x5555, 0xAA);
WRITE_FLASH(0x2AAA, 0x55);
WRITE_FLASH(0x5555, 0x80);
WRITE_FLASH(0x5555, 0xAA);
WRITE_FLASH(0x2AAA, 0x55);
WRITE_FLASH(uiAddr, 0x30);
bWaitForEndOfPrg();//判断是否写入完成函数
}
答 3: SST39VF160 的我的程序也可以用在SST39VF160的是可以的.
#define WRITE_FLASH(uiAddr,usData) *((volatile INT16U *)(uiAddr << 1))= usData
void bSST39VF160SectorErase(INT32U uiAddr)
{
WRITE_FLASH(0x5555, 0xAA);
WRITE_FLASH(0x2AAA, 0x55);
WRITE_FLASH(0x5555, 0x80);
WRITE_FLASH(0x5555, 0xAA);
WRITE_FLASH(0x2AAA, 0x55);
WRITE_FLASH(uiAddr, 0x30);
bWaitForEndOfPrg();//判断是否写入完成函数
}
但在am29lv160dt就不行,代码如下:
#define WRITE_FLASH(uiAddr,usData) *((volatile INT16U *)(uiAddr << 1))= usData
void bAM29VF160SectorErase(INT32U uiAddr)
{
WRITE_FLASH(0x555, 0xAA);
WRITE_FLASH(0x2AA, 0x55);
WRITE_FLASH(0x555, 0x80);
WRITE_FLASH(0x555, 0xAA);
WRITE_FLASH(0x2AA, 0x55);
WRITE_FLASH(uiAddr, 0x30);
bWaitForEndOfPrg();//判断是否写入完成函数
} 答 4: 我用过没问题啊//--------------------------------
//Erase all data on chip
//--------------------------------
void chip_erase( void )
{
SFRPAGE = 0x0F ;
CE_H() ;
WE_H() ;
OE_H() ;
out_byte( 0xAAA, 0xAA );
out_byte( 0x555, 0x55 );
out_byte( 0xAAA, 0x80 );
out_byte( 0xAAA, 0xAA );
out_byte( 0x555, 0x55 );
out_byte( 0xAAA, 0x10 );
wait_ready1();
}
//--------------------------
//Erase a sector
//--------------------------
void sec_erase( ulong addre )
{
SFRPAGE = 0x0F ;
CE_H() ;
WE_H() ;
OE_H() ;
out_byte( 0xAAA, 0xAA );
out_byte( 0x555, 0x55 );
out_byte( 0xAAA, 0x80 );
out_byte( 0xAAA, 0xAA );
out_byte( 0x555, 0x55 );
out_byte( addre, 0x30 );
wait_ready2();
}
这是下面的代码,请高手看看有没有写错。
void flash_erase(P_U16 base_addr){
P_U16 Temp;
U32 i=35000000;
/* Issue the Sector Erase command to am29lv160dt */
Temp = (P_U16)((0x0000555<<1)+FLASH_ADDRESS); *Temp = 0xAA;
Temp = (P_U16)((0x00002AA<<1)+FLASH_ADDRESS); *Temp = 0x55;
Temp = (P_U16)((0x0000555<<1)+FLASH_ADDRESS);
*Temp = 0x80;
Temp = (P_U16)((0x0000555<<1)+FLASH_ADDRESS);
*Temp = 0xAA;
Temp = (P_U16)((0x00002AA<<1)+FLASH_ADDRESS);
*Temp = 0x55;
Temp = base_addr;
*Temp = 0x30;
while(i--);//Delay
} 答 1: 有没有人用过个flash呢有没有人用过个flash呢 答 2: re:woaini看看我的擦除操作:
#define WRITE_FLASH(uiAddr,usData) *((volatile INT16U *)(uiAddr << 1))= usData
void bSST39VF160SectorErase(INT32U uiAddr)
{
WRITE_FLASH(0x5555, 0xAA);
WRITE_FLASH(0x2AAA, 0x55);
WRITE_FLASH(0x5555, 0x80);
WRITE_FLASH(0x5555, 0xAA);
WRITE_FLASH(0x2AAA, 0x55);
WRITE_FLASH(uiAddr, 0x30);
bWaitForEndOfPrg();//判断是否写入完成函数
}
答 3: SST39VF160 的我的程序也可以用在SST39VF160的是可以的.
#define WRITE_FLASH(uiAddr,usData) *((volatile INT16U *)(uiAddr << 1))= usData
void bSST39VF160SectorErase(INT32U uiAddr)
{
WRITE_FLASH(0x5555, 0xAA);
WRITE_FLASH(0x2AAA, 0x55);
WRITE_FLASH(0x5555, 0x80);
WRITE_FLASH(0x5555, 0xAA);
WRITE_FLASH(0x2AAA, 0x55);
WRITE_FLASH(uiAddr, 0x30);
bWaitForEndOfPrg();//判断是否写入完成函数
}
但在am29lv160dt就不行,代码如下:
#define WRITE_FLASH(uiAddr,usData) *((volatile INT16U *)(uiAddr << 1))= usData
void bAM29VF160SectorErase(INT32U uiAddr)
{
WRITE_FLASH(0x555, 0xAA);
WRITE_FLASH(0x2AA, 0x55);
WRITE_FLASH(0x555, 0x80);
WRITE_FLASH(0x555, 0xAA);
WRITE_FLASH(0x2AA, 0x55);
WRITE_FLASH(uiAddr, 0x30);
bWaitForEndOfPrg();//判断是否写入完成函数
} 答 4: 我用过没问题啊//--------------------------------
//Erase all data on chip
//--------------------------------
void chip_erase( void )
{
SFRPAGE = 0x0F ;
CE_H() ;
WE_H() ;
OE_H() ;
out_byte( 0xAAA, 0xAA );
out_byte( 0x555, 0x55 );
out_byte( 0xAAA, 0x80 );
out_byte( 0xAAA, 0xAA );
out_byte( 0x555, 0x55 );
out_byte( 0xAAA, 0x10 );
wait_ready1();
}
//--------------------------
//Erase a sector
//--------------------------
void sec_erase( ulong addre )
{
SFRPAGE = 0x0F ;
CE_H() ;
WE_H() ;
OE_H() ;
out_byte( 0xAAA, 0xAA );
out_byte( 0x555, 0x55 );
out_byte( 0xAAA, 0x80 );
out_byte( 0xAAA, 0xAA );
out_byte( 0x555, 0x55 );
out_byte( addre, 0x30 );
wait_ready2();
}
共2条
1/1 1 跳转至页
回复
有奖活动 | |
---|---|
【有奖活动】分享技术经验,兑换京东卡 | |
话不多说,快进群! | |
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
打赏了!打赏了!打赏了! |
打赏帖 | |
---|---|
与电子爱好者谈读图四被打赏50分 | |
与电子爱好者谈读图二被打赏50分 | |
【FRDM-MCXN947评测】Core1适配运行FreeRtos被打赏50分 | |
【FRDM-MCXN947评测】双核调试被打赏50分 | |
【CPKCORRA8D1B评测】---移植CoreMark被打赏50分 | |
【CPKCORRA8D1B评测】---打开硬件定时器被打赏50分 | |
【FRDM-MCXA156评测】4、CAN loopback模式测试被打赏50分 | |
【CPKcorRA8D1评测】--搭建初始环境被打赏50分 | |
【FRDM-MCXA156评测】3、使用FlexIO模拟UART被打赏50分 | |
【FRDM-MCXA156评测】2、rt-thread MCXA156 BSP制作被打赏50分 |