Flashing / Erasing Flash of new or bricked VS1005G board

Discussion about writing software for VS1005 and the VSOS Operating System. Also posts about VS1005-related hardware design and device drivers should be posted here.
User avatar
Panu
VSDSP Expert
Posts: 2829
Joined: Tue 2010-06-22 13:43

Flashing / Erasing Flash of new or bricked VS1005G board

Post by Panu »

Here are the necessary files and instructions for how to install the firmware and VSOS kernel version 0.20 to a VS1005G Developer Board which is either new or has a corrupted firmware so that it cannot boot:
vs1005g-firmware-preparations.zip
Flash images for VSOS Kernel 0.20, Nand Flash boot stub (required) and flashing instructions.
(58.8 KiB) Downloaded 1630 times
Note: you need vs3emu.exe v 2.2 (from the VSIDE installation) to reflash the card.

Here is the initial contents of the SD card:
DeveloperBoard_SDCard_Contents.zip
Contents of the SD card which is shipped with the Developer Board
(3.65 MiB) Downloaded 1783 times
Use this eeprom.img if you want to install or upgrade to vsos v0.21:
eeprom.img
EEPROM Image for VSOS kernel 0.21 (the zip file's eeprom.img contains kernel version 0.20, you can replace with this one to update to 0.21)
(19.65 KiB) Downloaded 1252 times
Update (2016-11-04) Reliable operation of VS1005G chips require that a boot helper rescue image is programmed to the beginning of the internal SPI flash. The internal flash prommer does this automatically. If your VSOS runs from the external SPI flash, you must run the Internal flash prommer in a Kernel solution once, like the picture below shows. Note that all lines except !R are commented away from eeprom_i.map to achieve this.
RescueImage.png
RescueImage.png (46.02 KiB) Viewed 17118 times
User avatar
Henrik
VLSI Staff
Posts: 1294
Joined: Tue 2010-06-22 14:10

Unbricking a VS1005 Developer Board

Post by Henrik »

This message gives instructions on how to unbrick a VS1005 Developer Board, or in other words, how to bring the DevBoard back alive after it has been rendered inoperable with software.

Three methods are presented, from easiest to hardest. It is recommended to try them in the order of these instructions and see which is the first that helps.


Unbricking Method 1: Preventing boot from external FLASH

This method helps if the bricked memory device is the external FLASH.

1.1) Keep BOOT SELECT pushed, and push RESET.
1.2) Release RESET. Wait two seconds, then release BOOT SELECT.
1.3) You should now be able to upload a new version of VSOS from your PC.


Unbricking Method 2: Using Internal FLASH rescue image to erase the rest of it

This method helps if the bricked memory device is the internal FLASH, and if the automatically generated Rescue Image in the first 4 KiB is still working.

2.1) If you have the VS1005 Dev. Board Extension (Hi-Res Recorder) daughterboard connected, remove it first. (Added 2020-10-08)
2.2) Put jumpers to JP15 pin header pairs 1, 2, 3, 5, and 6 (when counting from top to bottom). Don't connect pin header pairs 4 and 7.
2.3) Push and release RESET.
2.4) LEDs XTFT and XE1 should blink quickly for a second, then XE2 and XE1 should blink more slowly.
2.5) Remove jumpers from JP15
2.6) Now try rebooting as shown in (1.1)


Unbricking Method 3: Using ROM functions to erase even the rescue image

This method should help in all cases where the Internal FLASH contents have been damaged, inclusing the Rescue Image in the first 4 KiB of the Internal FLASH.

3.1) Disconnect all powers to the Development Board
3.2) Carefully remove the LCD daughterboard. Avoid excessive force
3.3) Disconnect USB->UART cable from the DevBoard and PC
3.4) Connect USB->UART cable ground (BLACK) to X2 pin 2 (GND; top, right), and +5V (RED) to X2 pin 4 (VHIGH; 2nd from top, right)
3.5) Connect jumpers to ALL seven JP15 pin header pairs
3.6) Connect USB->UART cable to PC
3.7) Push POWER and RESET. Three LEDs, PWRON, EXTP, and XIDLE, should now be on. Now push RESET a few more times.
3.8) Disconnect USB->UART cable from DevBoard. Remove jumpers from JP15.
3.9) Connect USB->UART cable back to normal RS232 pin header.
3.10) Now try rebooting as shown in (1.1)
3.11) If it works, you can now reconnect the LCD daughterboard

[Edited 2020-10-08]
Good signatures never die. They just fade away.
User avatar
Henrik
VLSI Staff
Posts: 1294
Joined: Tue 2010-06-22 14:10

Unbricking a VS1005 BreakOut Board

Post by Henrik »

This message gives instructions on how to unbrick a VS1005 BreakOut Board, or in other words, how to bring the BOB back alive after it has been rendered inoperable with software.


Unbricking Method 4: Using ROM functions to erase even the rescue image

This method should help in all cases where the Internal FLASH contents have been damaged. It is equivalent to message Unbricking VS1005 Developer Board Method 3.

4.1) Disconnect powers from the BOB
4.2) Connect D0 (pin header 9), D1 (10), D2 (11), D3 (12), TMS (31), TDI (32), and DBG (61) to IOVDD (7, 25, 43, or 54).
4.3) Connect powers, and power up the board by asserting PWRBTN (63). Release PWRBTN.
4.4) Assert XRESET (8) a few times by connecting it to GND.
4.5) Disconnect powers. Unconnect all connections you did in (2).
4.6) Restart board. Internal FLASH should now be empty and you should be able to upload VSOS through RS232 pins.
Good signatures never die. They just fade away.
jedm@vpitech.com
Senior User
Posts: 50
Joined: Wed 2016-11-02 22:50

Re: Flashing a new or bricked VS1005G board

Post by jedm@vpitech.com »

Breakout boards arrive with VSOS V3.10

I've been able to reload with V3.40 and V3.41 using the prommer to internal flash. It only takes a few seconds. However, when trying to load on top of V3.40 and V3.41 the prommer either goes away forever or I get:

Starting VS1005g internal SPI Flash prommer v2016-08-19...
Default SPI speed 39.9 Mbit/s
Serial Flash RDID: manufacturer c2 (C2), type 20 (20), density 14 (14)
Bad RDID, quitting
Failed in 23.30 seconds. Press Close/Cancel on VSIDE.

What can I do?
User avatar
Panu
VSDSP Expert
Posts: 2829
Joined: Tue 2010-06-22 13:43

Re: Flashing a new or bricked VS1005G board

Post by Panu »

I've been able to reload with V3.40 and V3.41 using the prommer to internal flash. It only takes a few seconds. However, when trying to load on top of V3.40 and V3.41 the prommer either goes away forever or I get:
...
Bad RDID, quitting
Hmmhmh, I wonder if it's the prommer, that is failing, and not the kernel.. The prommer was updated in a recent VSIDE release.

Hhmhmhmh... can you get an older prommer binary (c:\vside\bin\intflash1005g.bin) from an older VSIDE release and try to write the new kernel with that prommer bin.

You don't necessarily need to install an old VSIDE; you can use 7-Zip to open the VSIDE_xxxx.exe as archive and extract single files from there.

-Panu
jedm@vpitech.com
Senior User
Posts: 50
Joined: Wed 2016-11-02 22:50

Re: Flashing a new or bricked VS1005G board

Post by jedm@vpitech.com »

I loaded the intflash1005g.bin from the 2.40 VSIDE release (I'm running 2.41) into VSIDE\bin (saving the new one) and repeated the process.

First I ran initspi.bat from the command line with the following output. I'm not sure I have to do this.

User program entry address 0x757e
c:\Users\Jedm\VSIDE\bin\extflash1005g.bin: includes optional header, 29 sections, 1112 symbols
Section 1: startup page:0 start:128 size:3 relocs:2 fixed
Section 2: Build32YDowncount page:0 start:131 size:25 relocs:2
Section 3: ReadIFlashStatus page:0 start:156 size:20 relocs:2
Section 4: SetIFlashWriteEnable page:0 start:176 size:21 relocs:2
Section 5: WriteIFlashStatus page:0 start:197 size:19 relocs:2
Section 6: SpiWaitStatus2 page:0 start:216 size:50 relocs:8
Section 7: EraseIFlash page:0 start:266 size:128 relocs:24
Section 8: WriteIFlashPage page:0 start:394 size:112 relocs:26
Section 9: ReadIFlashPage page:0 start:506 size:48 relocs:8
Section 10: DumpFlash page:0 start:554 size:62 relocs:23
Section 11: IsFlashEmpty page:0 start:616 size:61 relocs:18
Section 12: ChipCrc32 page:0 start:677 size:34 relocs:6
Section 13: TestSpeed page:0 start:711 size:316 relocs:75
Section 14: WriteImage page:0 start:1027 size:501 relocs:119
Section 15: ProcessImageMap page:0 start:1528 size:572 relocs:215
Section 16: main page:0 start:2100 size:243 relocs:64
Section 17: init_x page:1 start:2160 size:16 relocs:3
Section 18: bss_x page:1 start:2176 size:2048 relocs:0
Section 19: bss_y page:2 start:1280 size:4096 relocs:0
Section 20: const_y page:2 start:5376 size:522 relocs:0
Section 21: const_x page:1 start:4224 size:2297 relocs:0
Section 22: FPutc page:0 start:2343 size:15 relocs:1
Section 23: fprintf page:0 start:2358 size:23 relocs:2
Section 24: printf page:0 start:2381 size:23 relocs:2
Section 25: VS_stdiolib page:0 start:2404 size:110 relocs:32
Section 26: OggCrcBlockChained page:0 start:2514 size:40 relocs:3
Section 27: atoi page:0 start:2554 size:64 relocs:10
Section 28: strcmp page:0 start:2618 size:11 relocs:2
Section 29: VS_stdiolib$0 page:0 start:2629 size:24 relocs:5
Starting erase
Ready. (Press Close/Cancel on VSIDE)
^CTerminate batch job (Y/N)? y

Then rebuild 3.40. I changed "Hello." to "Hello!" in main.c and the USB startup VoMassStorage startup to 'D' (probably dangerous).

Then went to Project/Prommer Flash Utility, selected VS1005G Internal Flash Prommer, then NEXT, image file to write is eeprom.img, final page shows:

VS1005G Internal Flash Prommer
Image file: eeprom.img (35747 bytes, last modified less than 1 minute ago)
Target platform: VS1005
Communicate via UART: COM6, intial speed 115200
Prommer: intflash1005g.bin (mem_desc.extflash)

Then click Start and get the error:

Starting VS1005g internal SPI Flash prommer v2015-12-11...
Default SPI speed 20.0 Mbit/s
Serial Flash RDID: manufacturer 0 (C2), type 0 (20), density 0 (14)
Bad RDID, quitting
Failed. Press Close/Cancel on VSIDE.

This looks like the 2.40 on as the SPI speed is 20 not 39 as in the new one.

Must be late there! Thanks for the response.
User avatar
Panu
VSDSP Expert
Posts: 2829
Joined: Tue 2010-06-22 13:43

Re: Flashing a new or bricked VS1005G board

Post by Panu »

Hi!

Sorry, it's unclear to me; what is the status now? Are you able to write anything to the internal flash? If not, can you try to unbrick/erase via GPIOs?

This problem seems to be often associated with trying to program an external-flash-kernel to internal flash or internal-flash-kernel to external flash, any ideas?

-Panu
jedm@vpitech.com
Senior User
Posts: 50
Joined: Wed 2016-11-02 22:50

Re: Flashing a new or bricked VS1005G board

Post by jedm@vpitech.com »

That sounds correct. What else do I have to do to make an internal flash image? I'm going on the vsos_341 solution readme.txt that says we don't have to change anything in vsos_vs1005g.c. Is this correct?
jedm@vpitech.com
Senior User
Posts: 50
Joined: Wed 2016-11-02 22:50

Re: Flashing a new or bricked VS1005G board

Post by jedm@vpitech.com »

I uncommented the USE_INTERNAL flash in vsos_vs1005g.c and recompiled but am still getting the error (240 prommer) when trying to load into internal flash using VSIDE:

Starting VS1005g internal SPI Flash prommer v2015-12-11...
Default SPI speed 20.0 Mbit/s
Serial Flash RDID: manufacturer 0 (C2), type 0 (20), density 0 (14)
Bad RDID, quitting
Failed. Press Close/Cancel on VSIDE.

When I try initspi.bat in this directory (VSOS_341) I get a bunch of error messages. This has references to extflash1005g (see next):

c:\Users\jedm\VSOS_341>c:\Users\Jedm\VSIDE\bin\vs3emu -chip vs1002b -m mem_desc.
extflash -monaddr 0x8000 -s 115200 -p 6 -l c:\Users\Jedm\VSIDE\bin\extflash1005g
.bin -c e.cmd
VSEMU 2.2 Nov 12 2010 16:48:42(c)1995-2010 VLSI Solution Oy
Could not read memory-description
Reading of mem_desc.extflash was not successful
Could not read memory-description
Reading of mem_desc.extflash was not successful
Could not read memory-description
Reading of mem_desc.extflash was not successful
Using serial port 6, COM speed 115200
Waiting for a connection to the board...

Caused interrupt
Chip version "1005"
Stack pointer 0x3e0, bpTable 0x92e8
User program entry address 0xa947
c:\Users\Jedm\VSIDE\bin\extflash1005g.bin: includes optional header, 29 sections
, 1112 symbols
Section 1: startup page:0 start:128 size:3 relocs:2 fixed
Write to unconnected memory! Skipping this section..
Section 2: Build32YDowncount page:0 start:131 size:25 relocs:2
Write to unconnected memory! Skipping this section..
Section 3: ReadIFlashStatus page:0 start:156 size:20 relocs:2
Write to unconnected memory! Skipping this section..
Section 4: SetIFlashWriteEnable page:0 start:176 size:21 relocs:2
Write to unconnected memory! Skipping this section..
Section 5: WriteIFlashStatus page:0 start:197 size:19 relocs:2
Write to unconnected memory! Skipping this section..
Section 6: SpiWaitStatus2 page:0 start:216 size:50 relocs:8
Write to unconnected memory! Skipping this section..
Section 7: EraseIFlash page:0 start:266 size:128 relocs:24
Write to unconnected memory! Skipping this section..
Section 8: WriteIFlashPage page:0 start:394 size:112 relocs:26
Write to unconnected memory! Skipping this section..
Section 9: ReadIFlashPage page:0 start:506 size:48 relocs:8
Write to unconnected memory! Skipping this section..
Section 10: DumpFlash page:0 start:554 size:62 relocs:23
Write to unconnected memory! Skipping this section..
Section 11: IsFlashEmpty page:0 start:616 size:61 relocs:18
Write to unconnected memory! Skipping this section..
Section 12: ChipCrc32 page:0 start:677 size:34 relocs:6
Write to unconnected memory! Skipping this section..
Section 13: TestSpeed page:0 start:711 size:316 relocs:75
Write to unconnected memory! Skipping this section..
Section 14: WriteImage page:0 start:1027 size:501 relocs:119
Write to unconnected memory! Skipping this section..
Section 15: ProcessImageMap page:0 start:1528 size:572 relocs:215
Write to unconnected memory! Skipping this section..
Section 16: main page:0 start:2100 size:243 relocs:64
Write to unconnected memory! Skipping this section..
Section 17: init_x page:1 start:2160 size:16 relocs:3
Write to unconnected memory! Skipping this section..
Section 18: bss_x page:1 start:2176 size:2048 relocs:0
Section 19: bss_y page:2 start:1280 size:4096 relocs:0
Section 20: const_y page:2 start:5376 size:522 relocs:0
Write to unconnected memory! Skipping this section..
Section 21: const_x page:1 start:4224 size:2297 relocs:0
Write to unconnected memory! Skipping this section..
Section 22: FPutc page:0 start:2343 size:15 relocs:1
Write to unconnected memory! Skipping this section..
Section 23: fprintf page:0 start:2358 size:23 relocs:2
Write to unconnected memory! Skipping this section..
Section 24: printf page:0 start:2381 size:23 relocs:2
Write to unconnected memory! Skipping this section..
Section 25: VS_stdiolib page:0 start:2404 size:110 relocs:32
Write to unconnected memory! Skipping this section..
Section 26: OggCrcBlockChained page:0 start:2514 size:40 relocs:3
Write to unconnected memory! Skipping this section..
Section 27: atoi page:0 start:2554 size:64 relocs:10
Write to unconnected memory! Skipping this section..
Section 28: strcmp page:0 start:2618 size:11 relocs:2
Write to unconnected memory! Skipping this section..
Section 29: VS_stdiolib$0 page:0 start:2629 size:24 relocs:5
Write to unconnected memory! Skipping this section..
Starting erase
<unconnected memory> Process hangs....

Switching the batch file to reference intflash1005g.bin I get pretty much the same thing.


c:\Users\jedm\VSOS_341>c:\Users\Jedm\VSIDE\bin\vs3emu -chip vs1002b -m mem_desc.
extflash -monaddr 0x8000 -s 115200 -p 6 -l c:\Users\Jedm\VSIDE\bin\intflash1005g
.bin -c e.cmd
VSEMU 2.2 Nov 12 2010 16:48:42(c)1995-2010 VLSI Solution Oy
Could not read memory-description
Reading of mem_desc.extflash was not successful
Could not read memory-description
Reading of mem_desc.extflash was not successful
Could not read memory-description
Reading of mem_desc.extflash was not successful
Using serial port 6, COM speed 115200
Waiting for a connection to the board...

Caused interrupt
Chip version "1005"
Stack pointer 0x3e0, bpTable 0x92e8
User program entry address 0xa979
c:\Users\Jedm\VSIDE\bin\intflash1005g.bin: includes optional header, 28 sections
, 977 symbols
Section 1: startup page:0 start:128 size:3 relocs:2 fixed
Write to unconnected memory! Skipping this section..
Section 2: bss_x page:1 start:2160 size:1665 relocs:0
Section 3: OpenRescueImage page:0 start:131 size:13 relocs:1
Write to unconnected memory! Skipping this section..
Section 4: ReadRescueImage page:0 start:144 size:41 relocs:3
Write to unconnected memory! Skipping this section..
Section 5: Build32YDowncount page:0 start:185 size:32 relocs:1
Write to unconnected memory! Skipping this section..
Section 6: ReadIFlashStatus page:0 start:217 size:22 relocs:2
Write to unconnected memory! Skipping this section..
Section 7: SetIFlashWriteEnable page:0 start:239 size:23 relocs:2
Write to unconnected memory! Skipping this section..
Section 8: WriteIFlashStatus page:0 start:262 size:20 relocs:2
Write to unconnected memory! Skipping this section..
Section 9: SpiWaitStatus2 page:0 start:282 size:65 relocs:9
Write to unconnected memory! Skipping this section..
Section 10: const_x page:1 start:3825 size:1911 relocs:0
Write to unconnected memory! Skipping this section..
Section 11: EraseIFlash page:0 start:347 size:116 relocs:23
Write to unconnected memory! Skipping this section..
Section 12: WriteIFlashPage page:0 start:463 size:107 relocs:24
Write to unconnected memory! Skipping this section..
Section 13: ReadIFlashPage page:0 start:570 size:41 relocs:7
Write to unconnected memory! Skipping this section..
Section 14: DumpFlash page:0 start:611 size:78 relocs:20
Write to unconnected memory! Skipping this section..
Section 15: TestSpeed page:0 start:689 size:422 relocs:75
Write to unconnected memory! Skipping this section..
Section 16: init_x page:1 start:5736 size:16 relocs:3
Write to unconnected memory! Skipping this section..
Section 17: WriteImage page:0 start:1111 size:422 relocs:87
Write to unconnected memory! Skipping this section..
Section 18: WriteImageMap page:0 start:1533 size:657 relocs:206
Write to unconnected memory! Skipping this section..
Section 19: main page:0 start:2190 size:231 relocs:58
Write to unconnected memory! Skipping this section..
Section 20: const_y page:2 start:1280 size:870 relocs:0
Write to unconnected memory! Skipping this section..
Section 21: const_x_str page:1 start:5752 size:37 relocs:0
Write to unconnected memory! Skipping this section..
Section 22: bss_y page:2 start:2150 size:4096 relocs:0
Section 23: FPutc page:0 start:2421 size:15 relocs:1
Write to unconnected memory! Skipping this section..
Section 24: fprintf page:0 start:2436 size:23 relocs:2
Write to unconnected memory! Skipping this section..
Section 25: printf page:0 start:2459 size:23 relocs:2
Write to unconnected memory! Skipping this section..
Section 26: VS_stdiolib page:0 start:2482 size:110 relocs:32
Write to unconnected memory! Skipping this section..
Section 27: strcmp page:0 start:2592 size:11 relocs:2
Write to unconnected memory! Skipping this section..
Section 28: VS_stdiolib$0 page:0 start:2603 size:24 relocs:5
Write to unconnected memory! Skipping this section..
Starting erase
<unconnected memory>

and the process hangs...

Evidently there is a lot more to do.
User avatar
pasi
VLSI Staff
Posts: 2120
Joined: Thu 2010-07-15 16:04

Re: Flashing a new or bricked VS1005G board

Post by pasi »

Reading of mem_desc.extflash was not successful
You need to have mem_desc.extflash in the directory, otherwise loading and executing the prommer code will not work as expected.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
Post Reply