共2条
1/1 1 跳转至页
flash 玩flash的朋友,过来看看阿
问
我用单片机读写三星flash,能读出ID,能擦除。但是写不进去,各大侠帮我看看呀。
Flash_Write
ld r0,#0ffh; p2 as output
ld P2CONH,r0
ld P2CONL,r0
bits WE_IO.WE
bits RE_IO.RE
bitc CE_IO.CE
bitr ALE_IO.ALE
bits CLE_IO.CLE
;write 80h
bitr WE_IO.WE
ld r0,#80h; ;write 80
ld p2,r0;
bits WE_IO.WE
nop
;address
bitr CLE_IO.CLE
bits ALE_IO.ALE //adress
bitr WE_IO.WE
ld r0,col_adressL
ld p2,r0;
bits WE_IO.WE ;col add1
bitr WE_IO.WE
ld r0,col_adressH
ld p2,r0;
bits WE_IO.WE ;col add2
bitr WE_IO.WE
ld r0,row_adressL
ld p2,r0;
bits WE_IO.WE ;row add1
bitr WE_IO.WE
ld r0,row_adressH
ld p2,r0;
bits WE_IO.WE ;row add2
nop
;write data
bitr ALE_IO.ALE
bitr CLE_IO.CLE
ld r2,#256
ld r1,write_data
Flash_Write_2:
bitr WE_IO.WE
;ld r1,write_data
ld p2,r1; //write data
bits WE_IO.WE
inc r1
dec r2
jr nz,Flash_Write_2
;write 10h
bitr ALE_IO.ALE
bits CLE_IO.CLE //command
bitr WE_IO.WE
ld r0,#10h
ld p2,r0
bits WE_IO.WE
nop
ld r0,#200 //delay ? s
Flash_Write_3:
dec r0
jr nz,Flash_Write_3
;write 70h ,to read status
bitr ALE_IO.ALE
bits CLE_IO.CLE //command
bitr WE_IO.WE
ld r0,#70h;
ld p2,r0;
bits WE_IO.WE
bitr CLE_IO.CLE
nop
nop
nop
nop
;read status
ld r0,#01010101b; p2 as input
ld P2CONH,r0
ld P2CONL,r0
Flash_Write_1:
;bitt p2.6
bitt RB_IO.RB
jr z,Flash_Write_1
nop
bitr RE_IO.RE;
bitt p2.0
jr nz,Flash_Write_end
;erro
ld r3,#55h
Flash_Write_end
bits RE_IO.RE;
ret;
答 1: 在每 答 2: 在每个数据写之间加些延时试试
Flash_Write
ld r0,#0ffh; p2 as output
ld P2CONH,r0
ld P2CONL,r0
bits WE_IO.WE
bits RE_IO.RE
bitc CE_IO.CE
bitr ALE_IO.ALE
bits CLE_IO.CLE
;write 80h
bitr WE_IO.WE
ld r0,#80h; ;write 80
ld p2,r0;
bits WE_IO.WE
nop
;address
bitr CLE_IO.CLE
bits ALE_IO.ALE //adress
bitr WE_IO.WE
ld r0,col_adressL
ld p2,r0;
bits WE_IO.WE ;col add1
bitr WE_IO.WE
ld r0,col_adressH
ld p2,r0;
bits WE_IO.WE ;col add2
bitr WE_IO.WE
ld r0,row_adressL
ld p2,r0;
bits WE_IO.WE ;row add1
bitr WE_IO.WE
ld r0,row_adressH
ld p2,r0;
bits WE_IO.WE ;row add2
nop
;write data
bitr ALE_IO.ALE
bitr CLE_IO.CLE
ld r2,#256
ld r1,write_data
Flash_Write_2:
bitr WE_IO.WE
;ld r1,write_data
ld p2,r1; //write data
bits WE_IO.WE
inc r1
dec r2
jr nz,Flash_Write_2
;write 10h
bitr ALE_IO.ALE
bits CLE_IO.CLE //command
bitr WE_IO.WE
ld r0,#10h
ld p2,r0
bits WE_IO.WE
nop
ld r0,#200 //delay ? s
Flash_Write_3:
dec r0
jr nz,Flash_Write_3
;write 70h ,to read status
bitr ALE_IO.ALE
bits CLE_IO.CLE //command
bitr WE_IO.WE
ld r0,#70h;
ld p2,r0;
bits WE_IO.WE
bitr CLE_IO.CLE
nop
nop
nop
nop
;read status
ld r0,#01010101b; p2 as input
ld P2CONH,r0
ld P2CONL,r0
Flash_Write_1:
;bitt p2.6
bitt RB_IO.RB
jr z,Flash_Write_1
nop
bitr RE_IO.RE;
bitt p2.0
jr nz,Flash_Write_end
;erro
ld r3,#55h
Flash_Write_end
bits RE_IO.RE;
ret;
答 1: 在每 答 2: 在每个数据写之间加些延时试试
共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分 |