KK7P DSPx Flash Utility


Update! 2005 Nov 23

The serial port implemented in the Flash Utility program (all versions to date) has a limitation that can cause problems if you are trying to run an automated program, such as a loader, and you are not aware of it.

Specifically, if you send data to the DSPx while it is sending data to you, the data you send may be corrupted or missed. When typing at a keyboard, it is not a problem. But if you are writing an automated script or loader, or other utility that interacts with FLASHUTL, you need to ensure your program does not send data to the DSPx at the same time it is sending data to you.

Thanks to Bob Larkin, W7PUA, for pointing this out.


Update! 2005 Nov 17

The Flash Utility is considered stable. The response to the V command for the current version is: FLASHUTL Version: 1.1beta OK

The latest DSP-10 code, Version 3.50, takes advantage of the current DSPx Version D.1 Monitor's ability to boot the DSP-10 application without having to load the DSP code over the serial port every time you power up the radio.

FLASHUTL is used to load the DSP-10 code into the DPSx's Flash memory. Directions are on the DSP-10 website.


Update! 2005 Feb 01

Be sure the program you use to upload Intel Hex files has a 60 msec end-of-line pause capability enabled. Notes have been added in the Commands and Testing sections about this. No other changes.


Update! 2005 Jan 21

An updated version of FLASHUTL is now available. It appears to work OK on large files, like the EMRFD 17m Transceiver. The previous version failed to properly load this application.

New command: V reports FLASHUTL version.

New feature: pressing [ESC] when entering any required hex value will abort the current command.


FLASHUTL

FLASHUTL (Flash Utility) is a special purpose application that runs on the DSPx. It allows you to read, write, erase and manage the Flash memory of the DSPx module.

All addresses and data used in FLASHUTL are in hexadecimal (Hex) format. This uses the numerals 0..9 and the letters A...F. FLASHUTL can accept upper or lower case letters for Hex Address and Data values.

Note: When entering any hex value, pressing the [ESC] key will abort the command.

Commands are case sensitive. D and d are completely different commands!

Along with the Monitor release D.1, you can now upload an application to the DSPx Flash memory and have it execute at reset (power up or activating the reset line). This means the DSPx can be used in an embedded application, like a portable radio receiver, and it will not require a PC or other processor to upload the DSP application software. The latest DSP-10 DSP code uses this feature.


Commands

The commands most useful in FLASHUTL are:

	:	Upload Intel-format Hex File
	B	Specify Flash 64K Bank
	F	Display Flash Memory
	I	Display Flash Chip ID
	S	Erase Flash Sector

	d	Set Intel loader for Data file
	p	Set Intel loader for Program File

FLASHUTL prompts for each command with

	=>
: uploads an Intel-formatted Hex record. This is the first character of each line in an Intel-format Hex file, so it is automatic.

NOTE: It is very important that the program sending Intel Hex files to the DSPx insert a pause of 60 miiliseconds or longer at the end of each line of the Intel Hex file. The flash file will be corrupted if this is not done!

F prompts for an address in Flash memory and then displays the results.

For example, if you type F010000 you would see:

	=>Addr Hi: 01 Addr Lo: 0000 Data: FF OK
	=>
FF might be something else if you have programmed this location in Flash.

I displays the Flash chip manufacturer ID and the memory type as specified by that manufacturer. For example, DSPx modules with SST39VF040 Flash memory will display the following when you type I:

	=>ID: BF Type: D7 OK
	=>

B is used to specify the 64K bank of the Flash chip that the ":" command will be set to. For example, if you type B1 you'll see:

	=>Flash Bank (0-7): 1 OK
	=>
The default offset is 1. The Monitor Flash memory as supplied with the DSPx uses the banks as follows:
	0	Monitor Program
	1	Unused
	2	Filter Coefficients
	3	Filter Coefficients
	4	Filter Coefficients
	5	Filter Coefficients
	6	Unused
	7	Unused
The filter coefficients are to support the KDSP2 open software initiative, and allow the KDSP2 code to run in the DSPx module.

Note that the "Addr Hi:" prompted in many of the commands is the same as the "Bank" number in the Flash chip.

S erases a flash Sector. The SST39VF040 has 128 sectors of 4K bytes per sector. In order to program a location in Flash memory, it must first be erased. Erasure sets all bits in the sector to "1"; programming allows you to set bits to "0".

Since the sectors are 4K bytes in size, only the first hex value in the Address Lo field has meaning. Thus, to erase an entire 64K bank, you'd need to issue the S command 16 times:

	S010000
	S011000
	S012000
	...
	S01F000
If you want to upload a small file to bank 1, for example, you would first erase the lowest 4K bytes of Bank 1 by typing S010000 and see:
	=>Addr Hi: 01 Addr Lo: 0000 OK
	=>
NOTE: If you are using a program to command FLASHUTL to erase a sector, be sure to insert a pause of at least 25 ms after issuing the "S" command to allow the Flash sector erasure to complete.

You can verify the erasure by using the "F" command and seeing the data is "FF".

"p" is used to tell the Intel hex-format loader that the file represents a program.

"d" is used to tell the Intel hex-format loader that the file represents data, such as filter coefficients.

It is very important that this be set correctly when uploading files to Flash. This is because the Analog Devices PROM Splitter utility (SPL21) creates a small program at the beginning of the Intel hex file that tells the DSP where in Flash to fetch the program and data for this program. Since we may be loading programs into Bank 1..7, we need to modify, or patch, this tiny program. Issuing the "p" command does this, automatically correcting the file as it is uploaded into Flash.

Data, on the other hand, should not be patched, so issuing the "d" command before uploading such files is necessary.

FLASHUTL defaults to "p".

Other Commands

Other commands available are:

	D	Display DSP Data RAM
	H	Display last Intel-format Hex Record
	J	Display Jumper Settings
	P	Display DSP Program RAM
	V	Display FLASHUTL Version
	W	Write byte to last "F" Flash location
	X	Write last Intel-format Hex record to Flash
	Z	Display last upload Status and Zero it
D and P prompt you for an address then display the hex value of the data at that address.

H displays the complete Intel Hex record last received. If you have uploaded a complete file, this is usually the end-of-record file.

J displays the settings of JP1 and JP2 on the DSPx board as follows:

	Jmp: nn OK

	where nn means:
	  00 = JP1 and JP2 placed
	  01 = JP2 placed
	  02 = JP1 placed
	  03 = no jumpers placed
W is used to write a single byte to Flash. It uses the address from the last "F" command. It may be used as a diagnostic to verify that Flash can be written.

X writes the last Intel Hex record to Flash. Since ":" does this automatically, its primary purpose is in debugging the Flash routines.

Z displays the value of programming status, then zeros it for the next ":" load.

Back to the top of the page.

Back to my dsp home page.


Testing

Here is a simple procedure to verify that FLASHUTL is properly loaded and can manage the flash chip on your DSPx.

The procedure assumes you are running from Windows, and have downloaded and are using the following:

The procedure further assumes you have extracted FLASHUTL.EXE and FLASHUTL.BNM from the ZIP file and they are in a directory called c:\work.

1) Connect the DSPx/KDSP10 to your computer's serial port, apply power to the KDSP10 and switch it on.

2) Start EZLOAD.

3) Click File -> Read DSP File -> and navigate the c:\work.

4) Select FLASHUTL.EXE. (double click)

5) After the file is loaded ($GO with Valid response detected), Click File -> Exit to terminate EZLOAD.

6) Start Tera Term. If a dialog box appears asking about TCPP/IP or Serial setup, select Serial, then OK.

7) Click Setup -> Serial Port...

8) Verify the following parameters, changing them if necessary: Baud Rate: 9600, Data: 8 bit, Parity: none, Stop 1 bit, Flow control: none, Transmit delay 0 msec/char and 60 msec/line. Port: COM1 (or whatever your serial port is).

NOTE: Don't overlook the 60 msec/line parameter. It is very important, and you will likely corrupt the flash files if this is not set properly!

9) Click OK.

10) Type I (upper case, no carriage return)

	ID: BF Type: D7 OK
	=>
This indicates an SST Flash chip of 4 megabits/512 kilobytes capacity.

WARNING!

If this command returns

	ID: 1F Type: 03 OK
	=>
you have an Atmel 49BV512 Flash chip in your DSPx. DO NOT PROCEED WITH THESE TESTS! The Atmel chip has only a single 64K Bank of memory, and if you proceed you will corrupt the monitor, rendering your DSPx useless. If you have the Atmel Flash chip, but desire to use the new Flash features, consider replacing the Flash chip. Click here for details.

11) Type F010000

	=>Addr Hi: 01 Addr Lo: 0000 Data: FF OK
	=>
This indicates the memory is erased at this location. If you get something other than Data: FF, it means that Bank 1 of the Flash has already been programmed. If this is the case, please perform step 14 of this procedure, then return to this step (and do step 14 again, after performing step 13...)

12) Type W55

	=>Data: 55 OK
This writes the value of hex 55 to Flash memory location 010000.

13) Type F010000

	=>Addr Hi: 01 Addr Lo: 0000 Data: 55 OK
	=>
This indicates the Flash memory was successfully written.

14) Type S010000

	=>Addr Hi: 01 Addr Lo: 0000 OK
	=>
This erases the Flash sector.

15) Type F010000

	=>Addr Hi: 01 Addr Lo: 0000 Data: FF OK
	=>
This indicates the memory was successfully erased at this location.

16) Type B1

	=>Flash Bank (0-7): 1 OK
	=>
This sets the Intel hex file loader to the second 64K Flash bank (Bank 1).

17) Type Z

	=>Status: 00 OK
	=>
This initializes the checksum status register. The value you see may or may not be 00.

18) Type p

	=>program to Flash OK
	=>
This sets the Intel loader to expect a program, and patch it as it loads.

19) Click File -> Send file... and navigate to c:\work and select FLASHUTL.BNM There will be lots of activity as Tera Term loads the file to the DSP.

	=> OK
	=> OK
	...
	=> OK
	=>
This indicates the checksums were OK as the Intel files were loaded.

20) Wait a moment to ensure Tera Term has finished loading, then type Z

	=>Status: 00 OK
	=>
This indicates that all the checksums were good. If any were bad, the value would be something other than 00.

21) Type F010145

	=>Addr Hi: 01 Addr Lo: 0145 Data: 40 OK
	=>
This is a patched byte of the uploaded file. It should be as shown. If it is 00 then it wasn't patched, indicating that the "p" command might not have been issued in step 18, above.

22) Verify that there are no jumpers installed on your DSPx at JP1 or JP2 and type J

	=> Jmp: 03 OK
	=> OK
This indicates the jumpers are open.

23) Type S00F000

	=>Addr Hi: 00 Addr Lo: F000 JP2 ?
	=>
This indicates that jumper JP2 is not placed, and you are prevented from erasing any sectors in the first 64K bank (Bank 0) of Flash memory.

24) Type B0

	=>Flash Bank (0-7): 1 OK
	=>
Because JP2 is not placed, FLASHUTL will not allow you to program in the first 64K bank (Bank 0) where the monitor is located.

25) Install a jumper on the DSPx at JP1.

NOTE: Be sure to touch ground (earth) before you touch the DSPx with the jumper. The heatsink tab of regulator U5 on the KDSP-10 board is suitable spot, as is the metal shell of the DE-9 serial port connector. You can use a short piece of wire or a low value resistor, just bend the leads and insert it, there is no need to solder it in place.

After doing this, type J

	=> Jmp: 02 OK
	=>
This indicates that JP1 is placed and JP2 is open..

26) Type B0

	=>Flash Bank (0-7): 1 OK
	=>
Because JP2 is not placed, FLASHUTL will not allow you to program in the lowest 64K bank where the monitor is located. This confirms that FLASHUTL is not mistaking JP1 for JP2.

27) Move the jumper from JP1 toJP2 on the DSPx. After doing this, type J

	=> Jmp: 01 OK
	=>
This indicates that JP2 is placed and JP1 is open.

28) Type B0

	=>Flash Bank (0-7): 0 OK
	=>
Because JP2 is placed, FLASHUTL allows you to program in the first 64K bank (Bank 0) where the monitor is located. This confirms that FLASHUTL is not confusing JP1 and JP2.

29) Type S00F000

	=>Addr Hi: 00 Addr Lo: F000 OK
	=>
This indicates that jumper JP2 is placed, and you are allowed to erase any sector in the first 64K bank (Bank 0) of Flash memory. The sector used here is normally erased, so no damage was done!

30) Remove the jumper from JP2.

At this point, you have verified that the FLASHUTL is working; you have the correct Flash memory in your DSPx; and you can erase, read and write the Flash.

If your monitor is version C.1, you can't really make use of the Flash capability. Monitor D.1 allows you to boot into a Flash application. The next section of this page shows how to install the new monitor in your existing DSPx Flash memory chip.

Back to the top of the page.

Back to my dsp home page.


Uploading Monitor Version D.1

After completing the testing above, you may wish to upload the latest monitor into your Flash.

Note that Teraterm must be set up with a line pause as indicated in step (8) above.

YOU DO THIS AT YOUR OWN RISK! YOU MAY ERASE THE FLASH AND NOT BE ABLE TO PROGRAM IT FOR ANY NUMBER OF REASONS. KK7P, LLC AND LYLE JOHNSON ACCEPT NO LIABILITY FOR THIS OUTCOME. KK7P, LLC WILL PROGRAM YOUR FLASH OR REPLACE IT FOR A NOMINAL CHARGE. CLICK HERE FOR DETAILS.

If there is a power failure or other problem, you may not be able to erase or program the Flash memory on the DSPx.

New Monitor Features

The new monitor, Rev D.1, includes the following changes and features:

IMPORTANT NOTE! If your DSPx is an earlier unit with an Atmel AT49BV512 Flash chip, the new monitor is of little value. The Atmel device has only a single 64K Bank. You may wish to consider replacing the Flash chip in your DSPx with the much larger capacity 39VF040. Click here for details.

Download the latest KK7P Monitor file. Extract EZMON.BNM into the c:\work directory as above:

31) Verify that there are no jumpers installed on your DSPx at JP1 or JP2 and type J

	=> Jmp: 03 OK
	=>
This indicates the jumpers are open.

32) Install a jumper at JP2 and type J

	=> Jmp: 01 OK
	=>
This indicates that JP2 is placed.

33) Type S000000

	=>Addr Hi: 00 Addr Lo: 0000 OK
	=>
You've now started to erase the old Monitor program.

34) Type S001000

	=>Addr Hi: 00 Addr Lo: 1000 OK
	=>
35) Type S002000
	=>Addr Hi: 00 Addr Lo: 2000 OK
	=>
36) Type S003000
	=>Addr Hi: 00 Addr Lo: 3000 OK
	=>
You've now completely erased the old Monitor program.

37) Type B0

	=>Flash Bank (0-7): 0 OK
	=>
Because JP2 is placed, FLASHUTL allows you to program in the first 64K bank (Bank 0) where the monitor is located.

38) Type p

	=>program to Flash OK
	=>
This sets the Intel loader to expect a program, and patch it as it loads. In the case of the monitor, there will be no patching, but it is best to always specify "p" when uploading a program to Flash.

39) Type ZZ

	=>Status: nn OK
	=>Status: 00 OK
	=>
The first response may or may not be 00. The second will be, confirming the Status has been cleared.

40) Click File -> Send file... and navigate to c:\work and select EZMON.BNM There will be lots of activity as Tera Term loads the file to the DSP.

	=> OK
	=> OK
	...
	=> OK
	=>
This indicates the checksums were OK as the Intel files were loaded.

41) Wait a moment to be sure that Tera Term has finished loading the DSP code. This is indicated by the cursor chaning from a solid block to a blinking block. Press the reset button on the KDSP10. You should see the new Monitor sign-on banner (8 lines):

	!!!  KK7P DSP Module Version 1.0 Rev D.1  !!!
Congratulations! You have successfully reprogrammed the monitor. Note that the first character or two may be garbled due to software UART garbage characters potentially being generated as the DSPx initializes.

42) Move the jumper from JP2 to JP1.

43) Press the reset button on the KDSP10. You may or may not see a prompt. This is because the software UART may send a garbage character or two as it initializes.

44) Type I (upper case, no carriage return)

	ID: BF Type: D7 OK
	=>
This indicates an SST Flash chip of 4 megabits/512 kilobytes capacity. More importantly, it shows that the DSPx has booted and is running the FLASHUTL program you loaded in Flash Bank 1 under testing, step 18.

45) Remove JP1. There should now be no jumpers placed at JP1 or JP2.

46) Press the reset button on the KDSP10. You should see the new Monitor sign-on banner (8 lines):

	!!!  KK7P DSP Module Version 1.0 Rev D.1  !!!
This indicates you are once again booting from the first 64K Flash memory bank (Bank 0).

The DSPx is now ready for use with the new monitor. If you wish to load another application into the second bank of Flash to be run when the DSPX is powered on, follow the steps in Testing, above, to erase Flash Bank 1 (S010000). Then load your application!

Back to the top of the page.

Back to my dsp home page.


Why the Distinction Between Programs and Data?

The Analog Devices PROM Splitter utility (SPL21) creates a small program at the beginning of the Intel hex file that tells the DSP where in Flash to fetch the program and data for the application. Since we may be loading programs into Flash Bank 1..7, we need to modify, or patch, this tiny program.. The "p" command is used to tell FLASHUTL to patch uploads.

Data, on the other hand, should not be patched. Issuing the "d" command before uploading such files is necessary

Back to the top of the page.

Back to my dsp home page.


What if I Mistype a Command?

The current version of FLASHUTL is intolerant of errors. There is no editing capability. It is probably best suited for use with a "script" or a "batch" file. In particular, the S command is most dangerous as you may accidentally erase a sector that you did not intend to erase.

The Bank command is the second most dangerous, as FLASHUTL will happily load code or data into the incorrect 64K bank of memory if you specify a bank other than the one you intended. Up until the point of loading the Hex files, you can change the B, p and d commands/values.

It is safest to never leave a jumper installed at JP2. This will help prevent accidental erasure or over-writing of the Monitor.

Back to the top of the page.

Back to my dsp home page.


Preparing DSP Applications for FLASHUTL

The only requirement after normal program loading and debug is to use the Version 5.1 PROM Splitter program supplied by Analog Devices and on the DSPx CD-ROM. You must create an Intel-format hex file with an embedded loader.

The syntax is

	spl21 [filename1] [filename2] -I -loader -2181
where [filename1] is the dsp .EXE file created by the linker, LD21, and [filename2] is the desired filename for the Intel-format hex output file. The output file will have the extension .BNM.

Back to the top of the page.

Back to my dsp home page.


REPLACEMENT FLASH MEMORY

If your Flash memory becomes corrupted, pre-programmed replacement memory chips may be obtained from KK7P, LLC. Currently the cost of a programmed flash chip is $5.00 (US dollars), or 5 Euros, each plus postage. In the US and Canada, postage and packing will be $1.00 per order of up to two (2) Flash chips, sent first class mail. For Europe and the Pacific, the cost is $3.00 (US dollars or Euros) per order of up to two (2), sent airmail letter post.

Please email me before ordering to confirm availability:  none

Back to the top of the page.

Back to my dsp home page.


Last modified: 2007 February 25