JTAG Interfacing with the ST40 (STB71xx) boxes – HOW TO   

JTAG Interfacing with the ST40 (STB71xx) boxes – HOW TO This howto is dedicated to STb71xx SoC's JTAG interface (Hardware ‐ USB ). This is a resume of a thread published on : http://www.avi‐plus.com/repair‐tips‐forum/others/re‐st40‐stb71xx‐jtag‐interfacing‐234.html 1‐ THE “CLONE” HARDWARE 1.1 FTDI Modules The new low cost ST Micro Connect Lite interface (STMC Lite is an ST Microelectronics trade name) (still a ghost on the market) (see pdf in the last ST Micro Connection package 1.6.0) uses the FTDI FT4232H mini USB module. That module is rather cheap (about 50 USD) and easy to buy. This is the module from FTDI : The FT4232H is a USB to 4 ports module handling the basic jtag lines on ports A and B and virtual COM port on ports C and D. ST uses the standard drivers with that module. The FT4232H datasheet and module datasheet can be found here: http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT4232H.pdf http://www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_FT4232H_Mini_Module.pdf You can also use the 2 ports version, the FT2232H/L module, as the two FT4232H extra ports are not really necessary. http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT2232H.pdf http://www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_FT2232H_Mini_Module.pdf 1.2 Wiring the module First thing to do is to solder that module on a breadboard and connect the power lines as mentioned in the FTDI documentation. This module is sold fully assembled as shown on the picture above. Take care of using the correct module connectors pin numbering. That module can of course be USB powered and the internal voltage regulator delivers 3.3V for the external IC's. USB Bus-powered:
1) Connect VBUS to VCC (CN3, pin 1 to CN3, pin 3). This connection takes the power from the
USB bus (VBUS) and connects it to the voltage regulator input on the FT4232H Mini Module. The
voltage regulator, in turn, provides V3V3, VPLL and VUSB power inputs to the FT4232H chip.
2) Connect V3V3 to VIO (CN2, pins 1, 3 & 5 to CN2, pins 11 & 21 and CN3, pins 12 & 22).
This connection provides the correct 3.3VDC operating voltage for VCCIO on the FT4232H chip. Once the module is correctly wired, it can be connected to a PC and normally it would install the drivers without any problem. There are two side plugs (2 X 26 pin) that allows the user to connect whatever he want depending upon the application. If you do not want to etch a PCB, you have to use a breadboard (copper around each hole) easy to find in an electronic shop. As you can see on the second picture, the only thing to do is to solder 2 female 26 pin connectors in order to plug in the module and one connector for your jtag connection. (Depends upon your STB configuration, 14 pin, 20 pin ...) (If you want you may even solder the 2X 26 pin plugs if it's too difficult to find the female connectors.) The rest of the job is to wire the connections between the module and the jtag connector. Not very difficult: there are 16 wires to solder on my experimental board. (keep them short) It can be done even with a plumber soldering iron! Here is the final JTAG wiring for the ST40/STB71xx and the picture of that very simple interface. (A breadboard, 2 sockets, a JTAG connector and that’s it.) 1.3 The “CLONE” schematic and port A to JTAG wiring The JTAG signals shown here above have to be wired to a 20 pin JTAG connector as shown below. (20 pin connector on the left side of the picture) Please note that the pull down and pull up shown are usually located on the box board. You should verify if these resistors are existing on your board. If not, add them on the jtag board. It’s also a good idea to add a LED with a 470R resistor in series between 5Vcc and GND to show that the board is active. Please note that PORT B can also be wired as port A but using a 14 pin JTAG connector (see STMC lite pdf in the Targetpack package or STLinux 2.4 package.) Port C and D can be used as RS232 virtual com ports via MAX3232 logic level interfaces. debugging via rs232 terminal). Here is a picture of the wiring side. (I’ve used a little 4 pins connectors (green and black‐gray wires) near the module to make experiments with the nRST and nTRST wiring, but this option is not necessary.) It’s a good idea to add a 10uF 10V tantalium capacitor between the USB 5V cc power pins on the interface side. (noise reduction) 2‐ Converting the module into an STMC Clone (usb descriptors) In order to convert that module into an ST Micro Connect Lite interface, you need to change the SUB descriptors in the module EEPROM. This allows the module to automatically load the ST driver and descriptors when the USB module is connected to a PC. This can be easily done by using the MPROG utility from FTDI. You can download that utility from the FTDI website : http://www.ftdichip.com/Support/Utilities/MProg3.5.zip To use that utility, you have first to connect the module to your PC and load the original FT drivers, especially the FTD2XX driver. Once the drivers are fully installed, you may launch the MPROG utility and change the descriptors and options (right side) as shown below. You could personalize your Fixed Serial Number by changing the four digits serial number to whatever you want. The STMCLTxxxx name will be used to address the interface when using the STLinux package or the ToolSet. I’ve added the MPROG template in ANNEX 1 that can be used to change the options (click on File, load, and load the template.. Paste the template into a text file and save it with the .ept suffix. Once the template loaded, click on Device and Program to burn that template into the eeprom. Now, your module is an ST Micro Connect clone. Disconnect the module from your PC and install the ST drivers included in the ToolSet R 5.1.0 drivers directory (WIN version). You may automatically install the drivers if you select the driver install option when installing the Targetpack R 1.6.0. There is also a manual install in the drivers directory. (The Linux drivers are automatically installed with STLINUX 2.4 if you fully update the package after installation with stmyum. under Fedora 14 with STLinux 2.4, you simply connect the Clone module and it will be recognized as an ST Micro Connect Lite interface) Once the drivers are installed, connect your module and the drivers should automatically be installed. You may verify this using the Windows device manager under Windows : (Device manager under Win7 x64) 3‐ Software to use with the Clone interface The software installation will not be detailed here. Under Windows, you should install the last ST40 Toolset together with the last Targetpack manager. Take care of selecting the PATH update during the installation. Under Linux (it’s better to use Fedora 14 + updates for compatibility reasons), install STLinux 2.4 ( www.stlinux.com )and fully update the package with stmyum after installation, otherwise the new STMC Lite drivers will not be installed. 4‐ The STburner utility If you don’t use U‐BOOT (see STLinux), you may use the STBurner utility (download from the forum or PUDN) Decompress that utility in the TS examples directory and make the following modifications to the files mentioned hereafter: build.mkf Remove the + sign before = in build.mkf lines 23 and 24 (generates a macro error during compilation) targets.mkf in the mkf directory Modify the default target according to your needs in line 83 . flasher.c warning line 783 ‐ string too long ‐ OK need not be modified flashutil.c warning line 2162 Spanion not used ‐ OK need not be modified Added: poketable.h into the stburner directory (needed with mb442) memory_mb442xxxx.x files into the stburner directory (needed with mb442) These files can be found in the examples/os21/romxxxx examples. flasher.h added MW39W320DT device in the device list (see other similar flash descriptions in the same file) (flash in the Homecast HS5001 CI) flashutil.c added device ID 0x22ca and blockinfo for M29W320DT flash chip (see other similar flash descriptions in the same file) Recompile the utility : make clean make This will generate the flasher.out file that will run on your target SoC. Connect your interface to your target and switch the target board ON. Run the following command to test your installation with no risk for your flash : sh4xrun –c sh4tp ‐t STMCLT1000A:mb411:st40 ‐e ./flasher.out ‐a ‐r romdump.bin The sh4xrun –a option is to be used when you need to add arguments to the executable. The –c sh4tp tells sh4xrun to use the targetpack manager. This will dump the flash rom content to a file named romdump.bin saved in the stburner directory. If you want to see the stburner options, just type the following command which will show you the burner usage options. sh4xrun –c sh4tp ‐t STMCLT1000A:mb411:st40 ‐e flasher.out Screen output : flasher: Usage: flasher [‐t <target board>] [‐p <binary or hex image>[@<binary_base_address>]] | [‐r <binary image>] | [[‐v <bootvector image> [‐v...]] [‐s <bootstrap image> [‐s...]] [‐fs <fail‐safe image>] [‐i <application image>[@<slot>] [‐i...]] [‐d <slot> [‐d ...]] [‐b <slot>] [‐bootsep]] [‐f <option file>] [‐e] <slot> must be in the range 0..63 ‐v <imgfile> : install image as a CPU boot vector ‐s <imgfile> : install image as a CPU boot strap ‐fs <imgfile>: install image as the fail‐safe image ‐i <imgfile> : install image as an application image ‐d <slot> : delete the image in slot ‐b <slot> : make the image in slot a boot image ‐bootsep : separate FLASH blocks containing boot code and application code so they can be protected ‐p <binfile> : program with raw binary image (or ST20‐style hex file if .hex extension) ‐r <binfile> : dump all FLASH to binary image ‐f <optfile> : read options from file ‐e : erase the FLASH ‐t <board> : override default target board (mb411stb7100) mb411 mb411stb7100 mb442 mb442stb7100 stb7100ref Remark : To verify if your interface is OK, you could compile the “Hello World” simple example in the examples/bare/getstart directory: make clean make TARGET=mb411stb7100 Once compiled, run the test program with : sh4xrun -c sh4tp -t STMCLT1000A:mb411:st40 -e hello.out If everything is OK, you should see “Hello World” on your screen. That means that the test program has been successfully executed from the target RAM. This is a ‘harmless for your flash’ test, as it uses only the target RAM. You are now ready to go further with your experiments …. ####### ANNEX 1 : The .ept template for MPROG. (Paste it into a text file saved with the .ept suffix) [Basic Details] Device Type=10 VID PID Type=2 USB VID=0483 USB PID=3747 [USB Power Options] Bus Powered=1 Self Powered=0 Max Bus Power=200 [USB Serial Number Control] Prefix=FT Use Fixed Serial Number=1 Fixed Serial Number=STMCLT1000 [USB Remote WakeUp] Enable Remote WakeUp=1 [Windows Plug and Play] Enable Plug and Play=0 [USB String Descriptors] Manufacturer=ST Product=ST Micro Connect Lite [Programming Options] Only Program Blank Devices=0 [BM Device Specific Options] USB Version Number=0 Disable Serial Number=0 IO Pin Pull Down in Suspend=0 [Dual Device Specific Options A] RS 232 mode=1 245 FIFO mode=0 245 CPU FIFO mode=0 OPTO Isolate mode=0 High Current Drive=0 [Dual Device Specific Options B] RS 232 mode=1 245 FIFO mode=0 245 CPU FIFO mode=0 OPTO Isolate mode=0 High Current Drive=0 [Dual Device Driver Options A] Virtual Com Port Driver=1 D2XX Driver=0 [Dual Device Driver Options B] Virtual Com Port Driver=1 D2XX Driver=0 [R Device Specific Options] Invert TXD=0 Invert RXD=0 Invert RTS#=0 Invert CTS#=0 Invert DTR#=0 Invert DSR#=0 Invert DCD#=0 Invert RI#=0 C0 Signal=‐1 C1 Signal=‐1 C2 Signal=‐1 C3 Signal=‐1 C4 Signal=‐1 Enable Ext Osc=0 High Current I/O=0 Load D2XX Driver=0 In EndPoint Size=0 [DualHS Device Specific Options] IFAIsFifo7=0 IFAIsFifoTar7=0 IFAIsFastSer7=0 AIsVCP7=1 IFBIsFifo7=0 IFBIsFifoTar7=0 IFBIsFastSer7=0 BIsVCP7=1 IOPinDriveDual=0 UTMIDrive=0 UTMIVendor=0 SuspendOnD7Low=0 [QuadHS Device Specific Options] AIsVCP8=0 BIsVCP8=0 CIsVCP8=1 DIsVCP8=1 ARIisTXDEN=0 BRIisTXDEN=0 CRIisTXDEN=0 DRIisTXDEN=0 IOPinDriveQuad=13107