# How to program the DSP using EZ-ICE and VisualDSP++

To program the DSP (for the xDR, Jinf, Jinj,...) you need to have an EZ-ICE box, connected to a PC running VisualDSP++ on Windows (a Windows virtual machine on a linux host is a very good solution). The advantage of such a configuration is that you can program the DSP on the windows side, and on the linux side you can perform tests (calibrations, DAQ, etc...) without even having to produce a flash file.

If you only need to produce a flash file from a known and tested project, you can avoid using the TDR and EZ-ICE setup. We will come back to it later.

## The TDR test setup

The photo illustrates a typical TDR test system, with microbackplane, EZ-ICE, EPP-BOX and power supply.

Let us focus on the DSP and its whereabouts:

On the figure we see the FPGA, the DSP, its EZ-ICE connector and the DSP test point, which state is programmable through the SET/RESET/TOGGLE FL0 commands.

Before starting VisualDSP++ you need to connect the EZ-ICE to your TDR. Here is the sequence to follow:

1. Make sure the EZ-ICE is not powered.
2. Switch on the TDR.
3. Connect the EZ-ICE cable on the TDR connector.
4. Switch on the EZ-ICE box.
5. Launch VisualDSP++.

If the DSP and EZ-ICE are working correctly, after a while your screen should look like this (it's important that there's something under the "Disassembly..." on the right. If not probably you´re in Simulation mode so select the ADSP-2187 EZ-ICE 218x one, otherwise the problem is more serious...). You can now open your project:

1. Project → Open and select a project file (usually located in the proj directory):
• For TDR: DAQ\proj\cdp_t.dpj
• For JINFT: DAQ\proj\cddc_jinft.dpj
2. In some cases, VisualDSP will ask you to indicate the location of some source files (main.asm and ivec.asm).
3. In Project → Project options → Link make sure that "Generate symbol map" is checked.
4. Compile the project by pressing F7 (Here you can have comunication problems. The solution is to power off EZ-ICE and to re-open VisualDSP++. May be usefull alsot power off TDR and reboot Windows).
5. Finally press F5 to run the DSP code.

You can now, with your preferred test program check that your DSP code is behaving correctly.

## Saving a running program into a flash file

There are two solutions, the "online" and the "offline" ones. First we will focus on the "online" solution. Basically, for the online solution, you dump the DSP memory into a text file on your computer. Then you can load the file content into a flash memory.

1. Make sure that the DSP program is running.
2. Open the file DAQ\proj\debug\cdp_t.map.xml (for TDR) or DAQ\proj\debug\cddc_jinft.map.xml (for JINFT).
3. You need the following values:
• The total number of words used in seg_inttab + seg_monitr (PM page 0);
• The number of words used in seg_pmpage4 (PM page 4);
• The number of words used in seg_pmpage5 (PM page 5) (only for TDR).
4. If one of those values are odd, you will have to round them to the lower even value. See the following example.
5. The sum of the 3 values has to be lower than 24KB (in the PM [all the ones above are here] one word equals 3 bytes, in the DM one word equals 2 bytes).
6. Those values will have to be written into include\boot.h, as shown for the TDR and for JINFT.
7. Now you will have to recompile once again the code:
1. If the DSP program is running, stop it by pressing SHIFT + F5.
2. Compile the code again, by pressing F7.
3. Run the program again, by pressing F5.
8. On your linux computer, create file named "file.par", which content should reflect the values you wrote in boot.h: TDR, JINFT.
9. With your preferred amswire communication program, send the command FF02 to your TDR (JINFT): on your disk you have now a "file.dat" containing the program contents, which can now be loaded into the flash memory of any TDR (or JINFT).

## The special case of the ROM monitor

With flight models, you do not have to care about the ROM monitor: it is installed into the flash memory, in protected sectors, and you cannot modify nor erase it. Nevertheless, with qualification models, it may be necessary in some cases to re-install the ROM monitor. Here is the procedure to follow.

2. Project → Open and select the rom monitor project file (usually located in the proj directory):
• For TDR: DAQ\proj\rom_cdp.dpj
• For JINF: DAQ\proj\rom_jinf.dpj
3. Compile the program, by pressing the F7 key.
4. Open the "Program control" window (from the Register menu).
5. Go, with the program counter (PC) to position 0x2000 (starts with "dmovlay").
6. Start program, by pressing the F5 key.
7. Wait... wait... A good check is to look at the 3.3 V power consumption: when it goes back to a low value it means the DPS has finished executing the program. If you cannot look at the 3.3V comsumption, just wait a good while.
8. Stop the program, by pressing the SHIFT + F5 key. Now your screen should look like this.
9. Quit VisualDSP.
10. Switch off EZ-ICE.
11. Reboot the TDR/JINF.
12. With your preferred amswire communication tool, check the status/version number of TDR/JINF.

## Working offline

### Create a simulation session

If you start VisualDSP++ with no EZ-ICE connected, you may see a series of dialog boxes informing you that VisualDSP++ does not succeed to establish the communication with the EZ-ICE. After a while, the following window will appear:

Click on the cancel button. You will be now asked to chose a new session:

If a simulation session has not been created previously, you will have to create it, by clicking on the "New Session" button. Chose the items as indicated in the following screen capture:

Now you can activate the simulation session.

### The elftoascii program

This program enables you to produce a text file which you can subsequently load into the flash memory of your preferred AMSwire node. Before using elftoascii though, you need to install it. The installer is located in the DAQ\elf2ascii directory. Depending on your Windows installation, the computer might have to download some packages from the Microsoft site. In such a case, be patient.

### Creating a .dat file to be loaded in the flash memory

This solution works for whatever session (simulation or not), even if it has more sense when you are working in simulation.

1. Compile your project by pressing the F7 key.
2. Run the program, by pressing F5.
3. Open the file DAQ\proj\debug\cdp_t.map.xml (for TDR) or DAQ\proj\debug\cddc_jinft.map.xml (for JINFT).
4. You need the following values:
• The total number of words used in seg_inttab + seg_monitr (PM page 0);
• The number of words used in seg_pmpage4 (PM page 4);
• The number of words used in seg_pmpage5 (PM page 5) (only for TDR).
5. If one of those values are odd, you will have to round them to the lower even value. See the following example.
6. The sum of the 3 values has to be lower than 24KB (in the PM [all the ones above are here] one word equals 3 bytes, in the DM one word equals 2 bytes).
7. Those values will have to be written into include\boot.h, as shown for the TDR and for JINFT.
8. Now you will have to recompile once again the code:
1. If the DSP program is running, stop it by pressing SHIFT + F5.
2. Compile the code again, by pressing F7.
3. Run the program again, by pressing F5.
9. Launch elftoascii. You will see the following screen:
10. First you will have to chose the .DXE file (e.g. for TDR: cdp_t.dxe), which is located in the DAQ\proj\Debug directory.
11. Then indicate the destination file name and path.
12. Click on the "Start" button.
13. The program will guide you asking for the files it still needs. In the case of the TDR, you will be asked for DAQ\proj\Debug\pm_page4.ovl and DAQ\proj\Debug\pm_page5.ovl. Advice: NEVER trust the path proposed by the program itself. Chose by yourself the right path and file, by clicking on the "Browse" button.
14. The output text file will then be produced. Note that the flash file name (first number in the file) is always the same (I mean the 2 central digits). You might feel the need to change them...

## What is the format a file.dat ?

If you are interested in the flash file format and structure, read section 5 of Andrei's documentation.

## Check the consistency of the file.dat produced

1. Upload the program on the flash (command 45) and load it (command 46)
2. Get the status of the node (command c)
3. Send the program test command (command 55)
4. Get the status of the node again (command c). If some problems are present you will see "program self-test error".

## A practical case: compile a new DAQ version

When a new DAQ version is released you usually have to proceed as follows:

2. From your old DAQ directory, copy the src\tdr dictory to the new DAQ\src\ directory (actually only TDR_*.asm, TDR_SUBRT_*.asm, CAL_*.asm, CAL_SUBRT*.asm, INIT_*.asm, JINF_SD_*.asm and jinf_sd.h must be copied).
3. From your old DAQ directory, copy the include\EVBLD_Vxxxx_Ryy.h file into your new DAQ\include dictory.
4. From your old DAQ directory, copy the proj\cdp_t.asm proj\cddc_jinft.asm proj\cddc_jinft.dpj files into the new DAQ\proj directory.
5. A control check on the differences between evbld.h (into DAQ\include) provided in the new DAQ archive and the one TDR uses may be useful (check the non-CDP part).
6. In VisualDSP, open your project from the new DAQ directory, and compile it.

-- PhilippAzzarello - 29-Sep-2010

Topic attachments
I Attachment History Action Size Date Who Comment
png 2187simulator.png r1 manage 10.7 K 2010-09-24 - 08:30 PhilippAzzarello
png TDRzoom2.png r1 manage 285.3 K 2010-09-07 - 16:14 PhilippAzzarello
png booth_jinft.png r2 r1 manage 48.4 K 2010-09-14 - 16:47 PhilippAzzarello
png booth_tdr.png r2 r1 manage 50.0 K 2010-09-14 - 16:49 PhilippAzzarello
png elftoascii1.png r1 manage 18.7 K 2010-09-24 - 09:45 PhilippAzzarello
png elftoasciioutput.png r1 manage 20.2 K 2010-09-24 - 10:08 PhilippAzzarello
png ezice_failure_startup3.png r1 manage 7.3 K 2010-09-24 - 07:26 PhilippAzzarello
png filejinft3a02modi.png r1 manage 43.5 K 2010-09-14 - 17:16 PhilippAzzarello
png filetdr3a63modi.png r1 manage 62.3 K 2010-09-14 - 17:09 PhilippAzzarello
par filetdr_3a63.par r1 manage 0.2 K 2010-09-14 - 16:58 PhilippAzzarello
png memorymap2.png r1 manage 97.9 K 2010-09-14 - 16:33 PhilippAzzarello
jpg microbackplane_setup.JPG r1 manage 107.3 K 2010-09-07 - 16:11 PhilippAzzarello
png sessionlist.png r1 manage 11.8 K 2010-09-24 - 08:28 PhilippAzzarello
png visualdsp_halt.png r1 manage 63.5 K 2010-09-15 - 14:02 PhilippAzzarello
png visualdsp_pc2000.png r1 manage 60.4 K 2010-09-15 - 14:01 PhilippAzzarello
png visualdsp_symbolmap.png r1 manage 30.1 K 2010-09-14 - 15:56 PhilippAzzarello
png visualdsp_welcome.png r1 manage 43.9 K 2010-09-14 - 15:49 PhilippAzzarello
Topic revision: r14 - 2011-03-03 - MatteoDuranti

Webs

Welcome Guest

 Cern Search TWiki Search Google Search Main All webs
Copyright &© 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback