You are on page 1of 18

JTAGInterfacingwiththeST40(STB71xx)boxes

HOWTO(rev2)
THECLONEHARDWARE .. page2 Wiringthemodule. page3
TheCLONEschematicandportAtoJTAGwiring.. page4

ConvertingthemoduleintoanSTMCClone(usbdescriptors) page5 SoftwaretousewiththeCloneinterface. page7 TheSTburnerutility page8


FT2232HUSBJTAGinterfacebasedonthesameprinciples.(ThankstoGrantor).. page10

Usingamodule(ThankstoDuxzero). page12
ANNEX1:the.eptfile(usbdescriptors).. page16


FT4232HMiniModule orFT2232HMiniModule

UM232Hminimodule

1 Revision210.04.2011

JTAGInterfacingwiththeST40(STB71xx)boxesHOWTO
ThishowtoisdedicatedtoSTb71xxSoC'sJTAGinterface(HardwareUSB). Thisisaresumeofathreadpublishedon: http://www.aviplus.com/repairtipsforum/others/rest40stb71xxjtaginterfacing234.html

1 THECLONEHARDWARE

1.1 FTDIModules
ThenewlowcostSTMicroConnectLiteinterface(STMCLiteisanSTMicroelectronicstradename)(stilla ghostonthemarket)(seepdfinthelastSTMicroConnectionpackage1.6.0)usestheFTDIFT4232Hmini USBmodule. Thatmoduleisrathercheap(about50USD)andeasytobuy. ThisisthemodulefromFTDI:

TheFT4232HisaUSBto4portsmodulehandlingthebasicjtaglinesonportsAandB andvirtualCOMportonportsCandD. STusesthestandarddriverswiththatmodule. TheFT4232Hdatasheetandmoduledatasheetcanbefoundhere: http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT4232H.pdf http://www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_FT4232H_Mini_Module.pdf Youcanalsousethe2portsversion,theFT2232H/Lmodule,asthetwoFT4232Hextraportsarenotreally 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 2 Revision210.04.2011

1.2 Wiringthemodule
Firstthingtodoistosolderthatmoduleonabreadboardandconnectthepowerlinesasmentionedinthe FTDIdocumentation.Thismoduleissoldfullyassembledasshownonthepictureabove. Takecareofusingthecorrectmoduleconnectorspinnumbering.

ThatmodulecanofcoursebeUSBpoweredandtheinternalvoltageregulatordelivers3.3Vfortheexternal 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.

Oncethemoduleiscorrectlywired,itcanbeconnectedtoaPCandnormallyitwouldinstallthedrivers withoutanyproblem. Therearetwosideplugs(2X26pin)thatallowstheusertoconnectwhateverhewantdependinguponthe application.IfyoudonotwanttoetchaPCB,youhavetouseabreadboard(copperaroundeachhole)easy tofindinanelectronicshop. Asyoucanseeonthesecondpicture,theonlythingtodoistosolder2female26pinconnectorsinorderto pluginthemoduleandoneconnectorforyourjtagconnection. (DependsuponyourSTBconfiguration,14pin,20pin...) (Ifyouwantyoumayevensolderthe2X26pinplugsifit'stoo difficulttofindthefemaleconnectors.) Therestofthejobistowiretheconnectionsbetweenthe moduleandthejtagconnector. Notverydifficult:thereare16wirestosolderonmy

3 Revision210.04.2011

experimentalboard.(keepthemshort) Itcanbedoneevenwithaplumbersolderingiron! HereisthefinalJTAGwiringfortheST40/STB71xxandthepictureofthatverysimpleinterface. (Abreadboard,2sockets,aJTAGconnectorandthatsit.) 1.3 TheCLONEschematicandportAtoJTAGwiring

TheJTAGsignalsshownhereabovehavetobewiredtoa20pinJTAGconnectorasshownbelow. (20pinconnectorontheleftsideofthepicture) 4 Revision210.04.2011

Pleasenotethatthepulldownandpullupshownareusuallylocatedontheboxboard. Youshouldverifyiftheseresistorsareexistingonyourboard. Ifnot,addthemonthejtagboard.ItsalsoagoodideatoaddaLEDwitha470Rresistorinseries between5VccandGNDtoshowthattheboardisactive. PleasenotethatPORTBcanalsobewiredasportAbutusinga14pinJTAGconnector(seeSTMClitepdf intheTargetpackpackageorSTLinux2.4package.) PortCandDcanbeusedasRS232virtualcomportsviaMAX3232logiclevelinterfaces. debuggingviars232terminal). Hereisapictureofthewiringside.(Iveusedalittle4pinsconnectors(greenandblackgraywires)near themoduletomakeexperimentswiththenRSTandnTRSTwiring,butthisoptionisnotnecessary.) Itsagoodideatoadda10uF10VtantaliumcapacitorbetweentheUSB5Vccpowerpinsonthe interfaceside.(noisereduction)

2 ConvertingthemoduleintoanSTMCClone(usbdescriptors)

5 Revision210.04.2011

InordertoconvertthatmoduleintoanSTMicroConnectLiteinterface,youneedtochangetheSUB descriptorsinthemoduleEEPROM.ThisallowsthemoduletoautomaticallyloadtheSTdriverand descriptorswhentheUSBmoduleisconnectedtoaPC. ThiscanbeeasilydonebyusingtheMPROGutilityfromFTDI. YoucandownloadthatutilityfromtheFTDIwebsite: http://www.ftdichip.com/Support/Utilities/MProg3.5.zip Tousethatutility,youhavefirsttoconnectthemoduletoyourPCandloadtheoriginalFTdrivers, especiallytheFTD2XXdriver. Oncethedriversarefullyinstalled,youmaylaunchtheMPROGutilityandchangethedescriptorsand options(rightside)asshownbelow.

YoucouldpersonalizeyourFixedSerialNumberbychangingthefourdigitsserialnumbertowhateveryou want. TheSTMCLTxxxxnamewillbeusedtoaddresstheinterfacewhenusingtheSTLinuxpackageortheToolSet. 6 Revision210.04.2011

IveaddedtheMPROGtemplateinANNEX1thatcanbeusedtochangetheoptions(clickonFile,load,and loadthetemplate.. Pastethetemplateintoatextfileandsaveitwiththe.eptsuffix. Oncethetemplateloaded,clickonDeviceandProgramtoburnthattemplateintotheeeprom. Now,yourmoduleisanSTMicroConnectclone. DisconnectthemodulefromyourPCandinstalltheSTdriversincludedintheToolSetR5.1.0drivers directory(WINversion).Youmayautomaticallyinstallthedriversifyouselectthedriverinstalloptionwhen installingtheTargetpackR1.6.0.Thereisalsoamanualinstallinthedriversdirectory. (TheLinuxdriversareautomaticallyinstalledwithSTLINUX2.4ifyoufullyupdatethepackageafter installationwithstmyum.underFedora14withSTLinux2.4,yousimplyconnecttheClonemoduleanditwill berecognizedasanSTMicroConnectLiteinterface) Oncethedriversareinstalled,connectyourmoduleandthedriversshouldautomaticallybeinstalled. YoumayverifythisusingtheWindowsdevicemanagerunderWindows:

(DevicemanagerunderWin7x64FT4232Hmodule) 7 Revision210.04.2011

3 SoftwaretousewiththeCloneinterface
Thesoftwareinstallationwillnotbedetailedhere. UnderWindows,youshouldinstallthelastST40ToolsettogetherwiththelastTargetpackmanager. TakecareofselectingthePATHupdateduringtheinstallation. UnderLinux(itsbettertouseFedora14+updatesforcompatibilityreasons),installSTLinux2.4 (www.stlinux.com)andfullyupdatethepackagewithstmyumafterinstallation,otherwisethenewSTMC Litedriverswillnotbeinstalled.

4 TheSTburnerutility
IfyoudontuseUBOOT(seeSTLinux),youmayusetheSTBurnerutility(downloadfromtheforumorPUDN) DecompressthatutilityintheTSexamplesdirectoryandmakethefollowingmodificationstothefiles mentionedhereafter: build.mkf Removethe+signbefore=inbuild.mkflines23and24(generatesamacroerrorduringcompilation) targets.mkfinthemkfdirectory Modifythedefaulttargetaccordingtoyourneedsinline83. flasher.c warningline783stringtoolongOKneednotbemodified flashutil.c warningline2162SpanionnotusedOKneednotbemodified Added: poketable.hintothestburnerdirectory(neededwithmb442) memory_mb442xxxx.xfilesintothestburnerdirectory(neededwithmb442) Thesefilescanbefoundintheexamples/os21/romxxxxexamples. flasher.h addedMW39W320DTdeviceinthedevicelist(seeothersimilarflashdescriptionsinthesamefile) (flashintheHomecastHS5001CI) flashutil.c addeddeviceID0x22caandblockinfoforM29W320DTflashchip (seeothersimilarflashdescriptionsinthesamefile) Recompiletheutility: makeclean 8 Revision210.04.2011

make Thiswillgeneratetheflasher.outfilethatwillrunonyourtargetSoC. (Ignorethetestapp.exeerror) ConnectyourinterfacetoyourtargetandswitchthetargetboardON. Runthefollowingcommandtotestyourinstallationwithnoriskforyourflash: sh4xruncsh4tptSTMCLT1000A:mb411:st40e./flasher.outarromdump.bin Thesh4xrunaoptionistobeusedwhenyouneedtoaddargumentstotheexecutable. Thecsh4tptellssh4xruntousethetargetpackmanager. Thiswilldumptheflashromcontenttoafilenamedromdump.binsavedinthestburnerdirectory. Ifyouwanttoseethestburneroptions,justtypethefollowingcommandwhichwillshowyoutheburner usageoptions. sh4xruncsh4tptSTMCLT1000A:mb411:st40eflasher.out Screenoutput:
flasher: Usage:flasher[t<targetboard>] [p<binaryorheximage>[@<binary_base_address>]]| [r<binaryimage>]| [[v<bootvectorimage>[v...]] [s<bootstrapimage>[s...]] [fs<failsafeimage>] [i<applicationimage>[@<slot>][i...]] [d<slot>[d...]] [b<slot>] [bootsep]] [f<optionfile>] [e] <slot>mustbeintherange0..63 v<imgfile>:installimageasaCPUbootvector s<imgfile>:installimageasaCPUbootstrap fs<imgfile>:installimageasthefailsafeimage i<imgfile>:installimageasanapplicationimage d<slot>:deletetheimageinslot b<slot>:maketheimageinslotabootimage bootsep:separateFLASHblockscontainingbootcodeandapplicationcodesothey canbeprotected p<binfile>:programwithrawbinaryimage(orST20stylehexfileif.hexextension) r<binfile>:dumpallFLASHtobinaryimage f<optfile>:readoptionsfromfile e:erasetheFLASH t<board>:overridedefaulttargetboard(mb411stb7100) mb411mb411stb7100mb442mb442stb7100stb7100ref

Remark:

9 Revision210.04.2011

ToverifyifyourinterfaceisOK,youcouldcompiletheHelloWorldsimpleexampleinthe examples/bare/getstartdirectory: makeclean makeTARGET=mb411stb7100 Oncecompiled,runthetestprogramwith: sh4xrun -c sh4tp -t STMCLT1000A:mb411:st40 -e hello.out IfeverythingisOK,youshouldseeHelloWorldonyourscreen. ThatmeansthatthetestprogramhasbeensuccessfullyexecutedfromthetargetRAM. Thisisaharmlessforyourflashtest,asitusesonlythetargetRAM. Youarenowreadytogofurtherwithyourexperiments. #######

10 Revision210.04.2011

5FT2232HUSBJTAGinterfacebasedonthesameprinciples.(ThankstoGrantor) IhopetodosomethingpleasantfortheimplementationoftheinterfacesupportFT4232H.

11 Revision210.04.2011

UM232HUSBJTAGinterfacebasedonthesameprinciples.(ThankstoGrantor) Andthisisthewiringforthenew,cheapsinglechannelUM232Hminimodule: Revision210.04.2011

12

6 Examples:Usingamodule(ThankstoDuxzero)

Duxzerohasdecidedtodirectlywirethe connectionstothemoduleusingmini connectors.

Directwiring

AcoupleofMacbookPro's


WiringontheSTBside.

13 Revision210.04.2011


ThisismysuccessstoryunbrickinganIPBox910HD(CubeRevomini2board).ThishastheSTi7109cut30CPU. ThanksalottoYLG80formakingthispossibleinthefirstplace,withouthisgreatworkonallthisIwouldstill haveanIPBoxbricklayingaround! Toolsused: FT4232Hmicromodule AcoupleofMacbookPro's UC232USB>serialinterfacefromATEN(guesstheserialportsontheFT4232coulebeusedtoo) RS232nullmodemcable SeveralwireswithsingleDILconnectors BrickedIPBox910HD Fedora14(fullyupdated) STLinux2.4(fullyupdated) TomaketheFT4232HmoduleintoaSTMicroConnectLitecloneandwireitallup,readthegreatguidehere fromYLG80.(updatesareavailableintheforum) Now,wheneverythingiswiredupandloaded,firstoffyouneedaUBootELFfile.Eithergrabsomeofthe precompiledonesfromtheSTLinux2.3distro(the2.4distrodonothavethemyet),orcompileyourownU Bootfiles.MyreceiverdidnotgiveoutanyoutputfromtheserialportwhenItriedtheprecompiledones,so IhadtocompilemyownfromtheUBootsourcesincludedwiththeSTLinux2.4distro.Followthese procedurestoavoidfilesnotfounderrorsetc,interminal: Code:

su export PATH=/opt/STM/STLinux-2.4/devkit/sh4/bin:$PATH cd /opt/STM/STLinux-2.4/devkit/sources/u-boot/u-boot-sh4 make distclean make mb442_27_config make

14 Revision210.04.2011

Wheremb442_27_confighavetomatchwhateverconfigsuitsyourboardbest.LookinsidetheMakefile (scrolldownalmostatthebottom)toseeallSH4supportedboards.Ihadtodosomemodificationstothe mb442headerfiletoo. Theheaderisfoundin/opt/STM/STLinux2.4/devkit/sources/uboot/ubootsh4/include/configs/mb442.h ThemodificationsIhadtomaketohaveitworkingwithmyboardwastomakeituseUART3insteadof UART2.Bydefaultitsendsconsoleoutputtothefirstserialport,onmyboardthatportisusedbythefront processor(Ibelieve)andthesecondportUART3(/dev/ttyAS1)istheRS232serialportonthebacksideofthe STB. TheotherchangesImadewaschangingCFG_SDRAM_SIZEto0x080000000(itwas0x040000000)and CFG_MAX_FLASH_SECTto256(was128Ithink). IknowthesechangescanactuallybeaddedtotheMakefiletooaddingthemasparameterstotheboard config,butIdiditthequickwayandeditedthemb442.h.Ifthecompilationcompletedsuccessfullyyou shouldnowhave4newfilesinyourdirectory.ubootuboot.binuboot.mapanduboot.srec.Thefilewewant hereisuboot,whichistheELFfile.Tokeepthingsniceandtidymovethesefilestothe...target/uboot folder. Code:

mv u-boot* /opt/STM/STLinux-2.4/devkit/sh4/target/boot/u-boot/

openanewtabinyourterminal(keepingthingstidy,remember?)and: Code:

export PATH=/opt/STM/STLinux-2.4/devkit/sh4/bin:$PATH

MakesureeverythingisconnectedasitshouldbeandturntheSTBon,then: Code:

st40load_gdb -t STMCLT1000_A:mb442:st40 -b /opt/STM/STLinux2.4/devkit/sh4/target/boot/u-boot/u-boot

Nowyoushouldseesomeinterestingthingshappening,UBootshouldbeloadedintoyourreceiver memory,nowjusttypectocontinueandwatchtheserialconsoleoutput(youhavehopefullyhookedupthe STBtoaserialportrunningaterminalemulatoralready).Thegeneric(andstrippedImaysay)UBootthatI compileddidnothavethenetworkdriverscompiledintoitthatmySTBhas(RTL8201)soIhadtouse ymodemtouploadauboot.bintomemoryandwritethattoflash(Imadethatuboot.binoutfromthe 15 Revision210.04.2011

uboot.imgfileformyreceiver,justremembertoremovetheheaderinformationfirst,thatishowIbricked mineinthefirstplace!)InUBootconsole: Code:

loady (default it loads to 0x84000000, start ymodem upload with your uboot.bin from the terminal emulator) protect off 1:0-2 erase all cp.b 0x84000000 0xA0000000 0x41000 protect on 1:0-2 reset

ThatisprettymuchhowIunbrickedmySTBanyway...tookalotoftrialanderrortogetitallrightbuthey.. nobodyisbornwithJTAGinformationalreadypresentinthebrainright?

##########
16 Revision210.04.2011

ANNEX1:The.epttemplateforMPROG.(Pasteitintoatextfilesavedwiththe.eptsuffix)
(YoucanchangetheFixedSerialNumbertowhateveryouwant,providingthatyouuseyourcustomized Serialnumberasatargetname) [STARTCOPYPASTEFROMTHELINEBELOW] [BasicDetails] DeviceType=10 VIDPIDType=2 USBVID=0483 USBPID=3747 [USBPowerOptions] BusPowered=1 SelfPowered=0 MaxBusPower=200 [USBSerialNumberControl] Prefix=FT UseFixedSerialNumber=1 FixedSerialNumber=STMCLT1000 [USBRemoteWakeUp] EnableRemoteWakeUp=1 [WindowsPlugandPlay] EnablePlugandPlay=0 [USBStringDescriptors] Manufacturer=ST Product=STMicroConnectLite [ProgrammingOptions] OnlyProgramBlankDevices=0 [BMDeviceSpecificOptions] USBVersionNumber=0 DisableSerialNumber=0 IOPinPullDowninSuspend=0 [DualDeviceSpecificOptionsA] RS232mode=1 245FIFOmode=0 245CPUFIFOmode=0 OPTOIsolatemode=0 HighCurrentDrive=0 [DualDeviceSpecificOptionsB] RS232mode=1 245FIFOmode=0 245CPUFIFOmode=0 OPTOIsolatemode=0 HighCurrentDrive=0 [DualDeviceDriverOptionsA] VirtualComPortDriver=1 D2XXDriver=0 [DualDeviceDriverOptionsB] VirtualComPortDriver=1 D2XXDriver=0 [RDeviceSpecificOptions] InvertTXD=0 17 Revision210.04.2011

InvertRXD=0 InvertRTS#=0 InvertCTS#=0 InvertDTR#=0 InvertDSR#=0 InvertDCD#=0 InvertRI#=0 C0Signal=1 C1Signal=1 C2Signal=1 C3Signal=1 C4Signal=1 EnableExtOsc=0 HighCurrentI/O=0 LoadD2XXDriver=0 InEndPointSize=0 [DualHSDeviceSpecificOptions] IFAIsFifo7=0 IFAIsFifoTar7=0 IFAIsFastSer7=0 AIsVCP7=1 IFBIsFifo7=0 IFBIsFifoTar7=0 IFBIsFastSer7=0 BIsVCP7=1 IOPinDriveDual=0 UTMIDrive=0 UTMIVendor=0 SuspendOnD7Low=0 [QuadHSDeviceSpecificOptions] AIsVCP8=0 BIsVCP8=0 CIsVCP8=1 DIsVCP8=1 ARIisTXDEN=0 BRIisTXDEN=0 CRIisTXDEN=0 DRIisTXDEN=0 IOPinDriveQuad=13107 [ENDOFCOPYPASTESECTION] 18 Revision210.04.2011

You might also like