|
EDA365欢迎您!
您需要 登录 才可以下载或查看,没有帐号?注册
x
S29GL064N90TFI04:R4模式。' g$ d. h; B5 l3 F
在ARM下写入读取ID命令,代码如下:
1 ^* {2 @) g0 C8 \3 I' A f ovolatile unsigned short *baseAddress = (volatile unsigned short *) pFlash->pFlashInfo->baseAddress;6 P7 e5 Q! T5 P, {( z7 w
unsigned int id;& {' U+ m0 g, x, p0 @8 D
' K1 X0 k% c4 A8 x9 Y" n
//* Enter Software Product Identification Mode
7 Z5 v4 D' J* \7 G; L- D *(baseAddress + FLASH_SEQ_ADD1) = FLASH_CODE1;
: Y9 N; |" e1 f0 J+ G *(baseAddress + FLASH_SEQ_ADD2) = FLASH_CODE2;9 k. O: d$ o: {) o& g
*(baseAddress + FLASH_SEQ_ADD1) = ID_IN_CODE;
1 j3 p& } l/ ^% |: W' g2 D6 e- F8 ] C( L* O3 {
//* Read Manufacturer and device code from the device
4 b7 ~" W$ W5 D$ S m8 Z! D* R id = (short) *baseAddress; B* \1 R* z( x6 L* D
id |= *(baseAddress+1) << 16;
& X/ K# u$ \6 Z3 n3 R6 q/ h& D1 r* l$ E8 f/ |5 W/ @! s8 b/ \6 m
//* Exit Software Product Identification Mode
$ l, m @- f) v$ e; f1 r *(baseAddress + FLASH_SEQ_ADD1) = ID_OUT_CODE;
3 y$ s+ X# n" b8 m; A9 A return id;
3 `8 x# w6 Q- j& i- R( e
& f3 D- b0 ?5 }baseAddress 为0x10000000,ARM片选NCS0.* i1 j6 I" x% D s& M+ p: a6 c Q$ \
结果读出来的id是0x00900090,单步显示:每写入一条命令指令,通过AXD读出来的Flash的内容都随着指令码而改变,譬如写入FLASH_CODE1,Flash内容随之变成0x55,FLASH_CODE2变成0xAA,ID_IN_CODE变成0x0090,故最后读取的id为0x00900090.不知何解啊?有没有高手解答解答的?非常感谢了。
2 j8 @1 C/ |4 y* c" Q' c, a1 J+ g$ D( F% }( ~( Q' B3 E
另:FLASH_SEQ_ADD1为0x555,FLASH_SEQ_ADD2为0x2AA。 |
|