The original project is based on ADS v1.2 and uses J-Flash ARM V4.14c to write the compilation file to Flash.
Try to port the project to IAR 6.3. After downloading and running the Debug NOR Flash mode of the sample project GettingStarted in IAR, the following error message is displayed when J-Flash ARM V4.14c is used to connect to Flash:
Connecting...
-Connecting via USB to J-Link device 0
-J-Link firmware: V1.20 (J-Link ARM V8 compiled Sep 22 2011 16:23:23)
-JTAG speed: 8000 kHz (Auto)
-Initializing CPU core (Init sequence )...
-Executing Reset (0,200 MS)
-Initialized successfully
-JTAG speed: 8000 kHz (Auto)
-J-Link found 1 JTAG device. Core ID: 0x07926009 (arm9)
-ERROR: Flash Id error. Expected 0x1227E, found: 0xF018E28F
-ERROR: Failed to connect
Similar problems are found on the online search page, but there is no clear solution. The general idea of success today is that since the Flash Id is overwritten, we must consider how to recover it.
Find the Device ID item after referring to the S29GL128N Command Definitions and x16 table in the chip manual.
| Addr | Data |
| 555 | AA | 2AA | 55 | 555 | 90 | X01 | 227E | X0E | Note17 | X0F | Note17 |
X = Don't care
Note17. S29GL512NH/L = 2223 h/23 h, 220 h/01 h; S29GL256NH/L = 2222 h/22 h, 2201 h/01 h; s29GL128NH/L = 2221 h/21 h, 2201 h/01 h.
Still in the example project GettingStarted, but select Debug xRAM mode to run it on external memory, and add the following code before the main loop to reset the Device ID:
Typedef uint16 flashunit;
Const uint32 flashBase = 0x10000000;
/* Flash Reset */
* (Volatile flashunit *) flashBase = (flashunit) 0x00F0;
For (volatile int I = 20; I --);
Volatile flashunit Dummy = * (flashunit *) flashBase;
/* Device ID */
* (Volatile flashunit *) flashBase + 0x555) = (flashunit) 0x00AA;
* (Volatile flashunit *) flashBase + 0x2AA) = (flashunit) 0x0055;
* (Volatile flashunit *) flashBase + 0x555) = (flashunit) 0x0090;
* (Volatile flashunit *) flashBase + 0x001) = (flashunit) 0x227E;
* (Volatile flashunit *) flashBase + 0x00E) = (flashunit) 0x2201;
* (Volatile flashunit *) flashBase + 0x00F) = (flashunit) 0x0001;
After debugging and running, connect to the instance through J-Flash ARM V4.14c again, that is, the authentication is successful.
Connecting...
-Connecting via USB to J-Link device 0
-J-Link firmware: V1.20 (J-Link ARM V8 compiled Sep 22 2011 16:23:23)
-JTAG speed: 8000 kHz (Auto)
-Initializing CPU core (Init sequence )...
-Executing Reset (0,200 MS)
-Initialized successfully
-JTAG speed: 8000 kHz (Auto)
-J-Link found 1 JTAG device. Core ID: 0x07926009 (arm9)
-Flash ID (Chip 0) = 0x1227E (Verified)
-Connected successfully