9:16:37
现RGAME主板有一块是芯片下方USB D+D-两条下短路,无法正常工作,但用JTAG可以找到CPU的JTAG ID,今天想修修这个板,并试用这个板调试NORFLASH写入功能。
用NANDFLASH写入程序试验:
F:\Eagle\work>eisc_jtag_nand.exe -CEAGLE
*********** EISC JTAG NAND ***********
*********** VERSION: 1.02 **********
LPT 0x378 Port is detected.
OK!, JTAG ID: 00000000101011101100101011011101
Device maker is not support
Fail, Read Flash ID
看来是NANDFLASH有问题,先看看是不是焊接上有问题。
9:33:48
对NANDFLASH管脚的焊接重新修整一下,再启动
在SecureCRT上显示出了下面的信息:
==== EAGLE DEMO PROGRAM =======
SYSTEM PLL : 100Mhz
NAND CFG Timing : 0X1121
Nand Flash ID = ECDA
2048Mbit / 256MByte
User Offet Block Start = 200
NAND FLASH BANK = 0
NAND BLOCK SIZE = 131072
------------------------------
NAND
FAT 32 File System Information
Eagle FileSystem Build Version : Mar 16 2009
------------------------------
Offset Block Size = 200
Spare Block Size = 40
freq : 44100 , bits : 16 , channel : 1
0 channel allocated
main.c,170 :main
Loading starwars\bg09.suf
All done :BackGround Image
All done :Reel Image
说明是NANDFLASH的问题,且已经修好了。
再读JTAG ID和NANDFLASH的ID:
F:\Eagle\work>eisc_jtag_nand.exe -CEAGLE
*********** EISC JTAG NAND ***********
*********** VERSION: 1.02 **********
LPT 0x378 Port is detected.
OK!, JTAG ID: 00000000101011101100101011011101
Maker = 0xEC, Device = 0xDA
NAND DEVICE: Samsung 256MBytes(K9F2G08U0M)
接上VGA显示器,却看不到显示内容(黑屏),不知是什么原因,先不管他,先看看NORFLAH是不是可以识别出来。
F:\Eagle\work>eisc_jtag_nor.exe -CEAGLE -eall
*********** EISC JTAG NOR **********
*********** VERSION: 1.01 **********
OK!, JTAG ID: 00000000101011101100101011011101
Select your flash model name !
To exit, Enter 'q'
[1] : S29AL008D
[2] : S29AL004D
[3] : EN29LV040A
[4] : AM29LV040B
[5] : S29GL064M
[6] : K8D6316
[7] : S29GL128N
[8] : SST39VF6401
3
Enter flash Bus width [8 or 16] ? 8
Enter flash interface number [1 or 2] ? 1
Maker ID = 0x0000, Device ID = 0x0000
Typical timeout for word write: 7[us]
Typical timeout for buffer write: 0[us]
Typical timeout for block erase: 1000[ms]
Typical timeout for chip erase: 14000[ms]
Block region #0 block numbers : 1, size: 16[KB]
Block region #1 block numbers : 2, size: 8[KB]
Block region #2 block numbers : 1, size: 32[KB]
Block region #3 block numbers : 15, size: 64[KB]
Device size: 1024[KBytes]
Flash erasing all ...., Start: 0x00000000
Erasing ALL
Flash erasing & Verifying OK
擦除了所有的块
不过为什么MakerID和DeviceID是0呢?
试着编程看看:
F:\Eagle\work>eisc_jtag_nor.exe -CEAGLE -i1 -w8 -f BootLoader_Rom.elf.bin
*********** EISC JTAG NOR **********
*********** VERSION: 1.01 **********
OK!, JTAG ID: 00000000101011101100101011011101
Select your flash model name !
To exit, Enter 'q'
[1] : S29AL008D
[2] : S29AL004D
[3] : EN29LV040A
[4] : AM29LV040B
[5] : S29GL064M
[6] : K8D6316
[7] : S29GL128N
[8] : SST39VF6401
3
Maker ID = 0x0000, Device ID = 0x0000
Typical timeout for word write: 7[us]
Typical timeout for buffer write: 0[us]
Typical timeout for block erase: 1000[ms]
Typical timeout for chip erase: 14000[ms]
Block region #0 block numbers : 1, size: 16[KB]
Block region #1 block numbers : 2, size: 8[KB]
Block region #2 block numbers : 1, size: 32[KB]
Block region #3 block numbers : 15, size: 64[KB]
Device size: 1024[KBytes]
Flash erasing ...., Start: 0x00000000, Size: 0x36DA8
Flash needs 7 Blocks
1th Block, 0x00000000 2th Block, 0x00004000 3th Block, 0x00006000
4th Block, 0x00008000 5th Block, 0x00010000 6th Block, 0x00020000
7th Block, 0x00030000
Writing address: 0x0
Write: 0 / 224680 [Byte]
Program Error, Write: 0x50, Read: 0x0
编程失败,看来还是不对。其中显示的Device Size也是不对的,应该是512KB(4Mbit)。
经检查发现NORFLASH的电源没有供上,修复后重新运行
10:31:32
F:\Eagle\work>eisc_jtag_nor.exe -CEAGLE
*********** EISC JTAG NOR **********
*********** VERSION: 1.01 **********
OK!, JTAG ID: 00000000101011101100101011011101
Select your flash model name !
To exit, Enter 'q'
[1] : S29AL008D
[2] : S29AL004D
[3] : EN29LV040A
[4] : AM29LV040B
[5] : S29GL064M
[6] : K8D6316
[7] : S29GL128N
[8] : SST39VF6401
3
Enter flash Bus width [8 or 16] ? 8
Enter flash interface number [1 or 2] ? 1
Cannot read flash ID or Unknow flash
Your flash, Maker ID = 0x00FF, Device ID = 0x00FF
13:00:18
由于NANDFLASH可以找到,并可以运行程序,便想编写一个简单的程序,在NandFlash中运行,由这个程序读取NorFlash的ID,直接改原板上的Bootloader程序,在main()中加入下面的程序段:
while(1)
{
U8 id;
* (volatile U8*) 0x20000000 = 0xAA;
id= * (volatile U8*) 0x20000000 ;
* (volatile U8*) 0x555 = 0xAA;
* (volatile U8*) 0x2AA = 0x55;
* (volatile U8*) 0x555 = 0x90;
id= * (volatile U8*) 0x100;
str[1]=id;
DebugString(str);
}
然后用示波器测量总线上的波形,查找错误。
经测量发现U9的第6脚与地短路,该脚是74HC245的DIR,即外部总线的方向控制脚,如果它对地短路就无法实现数据读入了。
再仔细查找DIR这条网络上的连线,找到线路板焊接面上的元件C41与地有焊锡对地短路,修理后再运行eisc_jtag_nor.exe后,读出了正确的NORFLASH ID:
F:\Eagle\work>eisc_jtag_nor.exe -CEAGLE -i1 -w8
*********** EISC JTAG NOR **********
*********** VERSION: 1.01 **********
OK!, JTAG ID: 00000000101011101100101011011101
Select your flash model name !
To exit, Enter 'q'
[1] : S29AL008D
[2] : S29AL004D
[3] : EN29LV040A
[4] : AM29LV040B
[5] : S29GL064M
[6] : K8D6316
[7] : S29GL128N
[8] : SST39VF6401
3
Maker ID = 0x001C, Device ID = 0x004F
Typical timeout for word write: 300[us]
Typical timeout for buffer write: 0[us]
Typical timeout for block erase: 1000[ms]
Typical timeout for chip erase: 5000[ms]
Block region #0 block numbers : 8, size: 64[KB]
Device size: 512[KBytes]
Error, not specify erase size
试着写文件到NORFLASH中去:
F:\Eagle\work>eisc_jtag_nor.exe -CEAGLE -i1 -w8 -f BootLoader_Rom.elf.bin
*********** EISC JTAG NOR **********
*********** VERSION: 1.01 **********
OK!, JTAG ID: 00000000101011101100101011011101
Select your flash model name !
To exit, Enter 'q'
[1] : S29AL008D
[2] : S29AL004D
[3] : EN29LV040A
[4] : AM29LV040B
[5] : S29GL064M
[6] : K8D6316
[7] : S29GL128N
[8] : SST39VF6401
3
Maker ID = 0x001C, Device ID = 0x004F
Typical timeout for word write: 300[us]
Typical timeout for buffer write: 0[us]
Typical timeout for block erase: 1000[ms]
Typical timeout for chip erase: 5000[ms]
Block region #0 block numbers : 8, size: 64[KB]
Device size: 512[KBytes]
Flash erasing ...., Start: 0x00000000, Size: 0x36DA8
Flash needs 4 Blocks
1th Block, 0x00000000 2th Block, 0x00010000 3th Block, 0x00020000
4th Block, 0x00030000
Writing address: 0x0
Write: 224680 / 224680 [Byte]
Flash writing & verifying OK
Write elapsed time: 35[min] 59[sec]
F:\Eagle\work>
写入文件OK,这个过程花了近半个小时的时间,实在是太慢了,不过还好,以后生产时,NorFlash是要用编程器来写的。
将J5开关拨至NorFlash启动的位置,复位RGAME主板:
===================================
BootLoader via USB , version 1.2
Advanced Digital Chips Inc.
======================================
System Operating Clock : 100Mz
SDownload Mode
已经可以从NORFLASH启动了,并正确运行了BootLoader程序。