Upload
juancarlosm
View
358
Download
12
Tags:
Embed Size (px)
DESCRIPTION
JTAG MANUAL
Citation preview
1Revision210.04.2011
JTAGInterfacingwiththeST40(STB71xx)boxes
HOWTO(rev2)
THECLONEHARDWARE .. page2Wiringthemodule. page3TheCLONEschematicandportAtoJTAGwiring.. page4ConvertingthemoduleintoanSTMCClone(usbdescriptors) page5SoftwaretousewiththeCloneinterface. page7TheSTburnerutility page8FT2232HUSBJTAGinterfacebasedonthesameprinciples.(ThankstoGrantor).. page10Usingamodule(ThankstoDuxzero). page12ANNEX1:the.eptfile(usbdescriptors).. page16FT4232HMiniModuleorFT2232HMiniModule UM232Hminimodule
2Revision210.04.2011
JTAGInterfacingwiththeST40(STB71xx)boxesHOWTO
ThishowtoisdedicatedtoSTb71xxSoC'sJTAGinterface(HardwareUSB).Thisisaresumeofathreadpublishedon:http://www.aviplus.com/repairtipsforum/others/rest40stb71xxjtaginterfacing234.html
1 THECLONEHARDWARE1.1 FTDIModules
ThenewlowcostSTMicroConnectLiteinterface(STMCLiteisanSTMicroelectronicstradename)(stillaghostonthemarket)(seepdfinthelastSTMicroConnectionpackage1.6.0)usestheFTDIFT4232HminiUSBmodule.Thatmoduleisrathercheap(about50USD)andeasytobuy.ThisisthemodulefromFTDI:
TheFT4232HisaUSBto4portsmodulehandlingthebasicjtaglinesonportsAandBandvirtualCOMportonportsCandD.STusesthestandarddriverswiththatmodule.TheFT4232Hdatasheetandmoduledatasheetcanbefoundhere:http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT4232H.pdfhttp://www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_FT4232H_Mini_Module.pdfYoucanalsousethe2portsversion,theFT2232H/Lmodule,asthetwoFT4232Hextraportsarenotreallynecessary.http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT2232H.pdfhttp://www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_FT2232H_Mini_Module.pdf
3Revision210.04.2011
1.2 WiringthemoduleFirstthingtodoistosolderthatmoduleonabreadboardandconnectthepowerlinesasmentionedintheFTDIdocumentation.Thismoduleissoldfullyassembledasshownonthepictureabove.Takecareofusingthecorrectmoduleconnectorspinnumbering.
ThatmodulecanofcoursebeUSBpoweredandtheinternalvoltageregulatordelivers3.3VfortheexternalIC'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,itcanbeconnectedtoaPCandnormallyitwouldinstallthedriverswithoutanyproblem.Therearetwosideplugs(2X26pin)thatallowstheusertoconnectwhateverhewantdependingupontheapplication.IfyoudonotwanttoetchaPCB,youhavetouseabreadboard(copperaroundeachhole)easytofindinanelectronicshop.Asyoucanseeonthesecondpicture,theonlythingtodoistosolder2female26pinconnectorsinordertopluginthemoduleandoneconnectorforyourjtagconnection.(DependsuponyourSTBconfiguration,14pin,20pin...)(Ifyouwantyoumayevensolderthe2X26pinplugsifit'stoodifficulttofindthefemaleconnectors.)Therestofthejobistowiretheconnectionsbetweenthemoduleandthejtagconnector.Notverydifficult:thereare16wirestosolderonmy
4Revision210.04.2011
experimentalboard.(keepthemshort)Itcanbedoneevenwithaplumbersolderingiron!HereisthefinalJTAGwiringfortheST40/STB71xxandthepictureofthatverysimpleinterface.(Abreadboard,2sockets,aJTAGconnectorandthatsit.)1.3 TheCLONEschematicandportAtoJTAGwiring
TheJTAGsignalsshownhereabovehavetobewiredtoa20pinJTAGconnectorasshownbelow.(20pinconnectorontheleftsideofthepicture)
5Revision210.04.2011
Pleasenotethatthepulldownandpullupshownareusuallylocatedontheboxboard.Youshouldverifyiftheseresistorsareexistingonyourboard.Ifnot,addthemonthejtagboard.ItsalsoagoodideatoaddaLEDwitha470Rresistorinseriesbetween5VccandGNDtoshowthattheboardisactive.PleasenotethatPORTBcanalsobewiredasportAbutusinga14pinJTAGconnector(seeSTMClitepdfintheTargetpackpackageorSTLinux2.4package.)PortCandDcanbeusedasRS232virtualcomportsviaMAX3232logiclevelinterfaces.debuggingviars232terminal).Hereisapictureofthewiringside.(Iveusedalittle4pinsconnectors(greenandblackgraywires)nearthemoduletomakeexperimentswiththenRSTandnTRSTwiring,butthisoptionisnotnecessary.)Itsagoodideatoadda10uF10VtantaliumcapacitorbetweentheUSB5Vccpowerpinsontheinterfaceside.(noisereduction)
6Revision210.04.2011
2 ConvertingthemoduleintoanSTMCClone(usbdescriptors)
InordertoconvertthatmoduleintoanSTMicroConnectLiteinterface,youneedtochangetheSUBdescriptorsinthemoduleEEPROM.ThisallowsthemoduletoautomaticallyloadtheSTdriveranddescriptorswhentheUSBmoduleisconnectedtoaPC.ThiscanbeeasilydonebyusingtheMPROGutilityfromFTDI.YoucandownloadthatutilityfromtheFTDIwebsite:http://www.ftdichip.com/Support/Utilities/MProg3.5.zipTousethatutility,youhavefirsttoconnectthemoduletoyourPCandloadtheoriginalFTdrivers,especiallytheFTD2XXdriver.[BTWFTrecommendsnowtouseFT_PROGtoprogramtheEEPROM16/02/2013]http://www.ftdichip.com/Support/Utilities/FT_Prog%20v2.6.8.zipOncethedriversarefullyinstalled,youmaylaunchtheMPROGutilityandchangethedescriptorsandoptions(rightside)asshownbelow.
7Revision210.04.2011
YoucouldpersonalizeyourFixedSerialNumberbychangingthefourdigitsserialnumbertowhateveryouwant.TheSTMCLTxxxxnamewillbeusedtoaddresstheinterfacewhenusingtheSTLinuxpackageortheToolSet.IveaddedtheMPROGtemplateinANNEX1thatcanbeusedtochangetheoptions(clickonFile,load,andloadthetemplate..Pastethetemplateintoatextfileandsaveitwiththe.eptsuffix.Oncethetemplateloaded,clickonDeviceandProgramtoburnthattemplateintotheeeprom.Now,yourmoduleisanSTMicroConnectclone.DisconnectthemodulefromyourPCandinstalltheSTdriversincludedintheToolSetR5.1.0driversdirectory(WINversion).YoumayautomaticallyinstallthedriversifyouselectthedriverinstalloptionwheninstallingtheTargetpackR1.6.0.Thereisalsoamanualinstallinthedriversdirectory.(TheLinuxdriversareautomaticallyinstalledwithSTLINUX2.4ifyoufullyupdatethepackageafterinstallationwithstmyum.underFedora14withSTLinux2.4,yousimplyconnecttheClonemoduleanditwillberecognizedasanSTMicroConnectLiteinterface)Oncethedriversareinstalled,connectyourmoduleandthedriversshouldautomaticallybeinstalled.YoumayverifythisusingtheWindowsdevicemanagerunderWindows:
(DevicemanagerunderWin7x64FT4232Hmodule)
8Revision210.04.2011
3 SoftwaretousewiththeCloneinterface
Thesoftwareinstallationwillnotbedetailedhere.UnderWindows,youshouldinstallthelastST40ToolsettogetherwiththelastTargetpackmanager.TakecareofselectingthePATHupdateduringtheinstallation.UnderLinux(itsbettertouseFedora14+updatesforcompatibilityreasons),installSTLinux2.4(www.stlinux.com)andfullyupdatethepackagewithstmyumafterinstallation,otherwisethenewSTMCLitedriverswillnotbeinstalled.
4 TheSTburnerutilityIfyoudontuseUBOOT(seeSTLinux),youmayusetheSTBurnerutility(downloadfromtheforumorPUDN)DecompressthatutilityintheTSexamplesdirectoryandmakethefollowingmodificationstothefilesmentionedhereafter:build.mkfRemovethe+signbefore=inbuild.mkflines23and24(generatesamacroerrorduringcompilation)targets.mkfinthemkfdirectoryModifythedefaulttargetaccordingtoyourneedsinline83.flasher.cwarningline783stringtoolongOKneednotbemodifiedflashutil.cwarningline2162SpanionnotusedOKneednotbemodifiedAdded:poketable.hintothestburnerdirectory(neededwithmb442)memory_mb442xxxx.xfilesintothestburnerdirectory(neededwithmb442)Thesefilescanbefoundintheexamples/os21/romxxxxexamples.flasher.haddedMW39W320DTdeviceinthedevicelist(seeothersimilarflashdescriptionsinthesamefile)(flashintheHomecastHS5001CI)flashutil.caddeddeviceID0x22caandblockinfoforM29W320DTflashchip(seeothersimilarflashdescriptionsinthesamefile)Recompiletheutility:
makeclean
9Revision210.04.2011
makeThiswillgeneratetheflasher.outfilethatwillrunonyourtargetSoC.(Ignorethetestapp.exeerror)ConnectyourinterfacetoyourtargetandswitchthetargetboardON.Runthefollowingcommandtotestyourinstallationwithnoriskforyourflash:
sh4xruncsh4tptSTMCLT1000A:mb411:st40e./flasher.outarromdump.binThesh4xrunaoptionistobeusedwhenyouneedtoaddargumentstotheexecutable.Thecsh4tptellssh4xruntousethetargetpackmanager.Thiswilldumptheflashromcontenttoafilenamedromdump.binsavedinthestburnerdirectory.Ifyouwanttoseethestburneroptions,justtypethefollowingcommandwhichwillshowyoutheburnerusageoptions.
sh4xruncsh4tptSTMCLT1000A:mb411:st40eflasher.outScreenoutput:flasher:Usage:flasher[t][p[@]]|[r]|[[v[v...]][s[s...]][fs][i[@][i...]][d[d...]][b][bootsep]][f][e]mustbeintherange0..63v:installimageasaCPUbootvectors:installimageasaCPUbootstrapfs:installimageasthefailsafeimagei:installimageasanapplicationimaged:deletetheimageinslotb:maketheimageinslotabootimagebootsep:separateFLASHblockscontainingbootcodeandapplicationcodesotheycanbeprotectedp:programwithrawbinaryimage(orST20stylehexfileif.hexextension)r:dumpallFLASHtobinaryimagef:readoptionsfromfilee:erasetheFLASHt:overridedefaulttargetboard(mb411stb7100)mb411mb411stb7100mb442mb442stb7100stb7100ref
10Revision210.04.2011
Remark:ToverifyifyourinterfaceisOK,youcouldcompiletheHelloWorldsimpleexampleintheexamples/bare/getstartdirectory: makeclean makeTARGET=mb411stb7100Oncecompiled,runthetestprogramwith: sh4xrun -c sh4tp -t STMCLT1000A:mb411:st40 -e hello.outIfeverythingisOK,youshouldseeHelloWorldonyourscreen.ThatmeansthatthetestprogramhasbeensuccessfullyexecutedfromthetargetRAM.Thisisaharmlessforyourflashtest,asitusesonlythetargetRAM.Youarenowreadytogofurtherwithyourexperiments.
#######
11Revision210.04.2011
5FT2232HUSBJTAGinterfacebasedonthesameprinciples.(ThankstoGrantor)IhopetodosomethingpleasantfortheimplementationoftheinterfacesupportFT4232H.
12Revision210.04.2011
UM232HUSBJTAGinterfacebasedonthesameprinciples.(ThankstoGrantor)Andthisisthewiringforthenew,cheapsinglechannelUM232Hminimodule:
13Revision210.04.2011
6 Examples:Usingamodule(ThankstoDuxzero)Duxzerohasdecidedtodirectlywiretheconnectionstothemoduleusingminiconnectors.
Directwiring
AcoupleofMacbookPro's
WiringontheSTBside.
ThisismysuccessstoryunbrickinganIPBox910HD(CubeRevomini2board).ThishastheSTi7109cut30CPU.ThanksalottoYLG80formakingthispossibleinthefirstplace,withouthisgreatworkonallthisIwouldstillhaveanIPBoxbricklayingaround!Toolsused:FT4232HmicromoduleAcoupleofMacbookPro's UC232USB>serialinterfacefromATEN(guesstheserialportsontheFT4232coulebeusedtoo)RS232nullmodemcableSeveralwireswithsingleDILconnectorsBrickedIPBox910HDFedora14(fullyupdated)STLinux2.4(fullyupdated)
14Revision210.04.2011
TomaketheFT4232HmoduleintoaSTMicroConnectLitecloneandwireitallup,readthegreatguideherefromYLG80.(updatesareavailableintheforum)Now,wheneverythingiswiredupandloaded,firstoffyouneedaUBootELFfile.EithergrabsomeoftheprecompiledonesfromtheSTLinux2.3distro(the2.4distrodonothavethemyet),orcompileyourownUBootfiles.MyreceiverdidnotgiveoutanyoutputfromtheserialportwhenItriedtheprecompiledones,soIhadtocompilemyownfromtheUBootsourcesincludedwiththeSTLinux2.4distro.Followtheseprocedurestoavoidfilesnotfounderrorsetc,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
Wheremb442_27_confighavetomatchwhateverconfigsuitsyourboardbest.LookinsidetheMakefile(scrolldownalmostatthebottom)toseeallSH4supportedboards.Ihadtodosomemodificationstothemb442headerfiletoo.Theheaderisfoundin/opt/STM/STLinux2.4/devkit/sources/uboot/ubootsh4/include/configs/mb442.hThemodificationsIhadtomaketohaveitworkingwithmyboardwastomakeituseUART3insteadofUART2.Bydefaultitsendsconsoleoutputtothefirstserialport,onmyboardthatportisusedbythefrontprocessor(Ibelieve)andthesecondportUART3(/dev/ttyAS1)istheRS232serialportonthebacksideoftheSTB.TheotherchangesImadewaschangingCFG_SDRAM_SIZEto0x080000000(itwas0x040000000)andCFG_MAX_FLASH_SECTto256(was128Ithink).IknowthesechangescanactuallybeaddedtotheMakefiletooaddingthemasparameterstotheboardconfig,butIdiditthequickwayandeditedthemb442.h.Ifthecompilationcompletedsuccessfullyyoushouldnowhave4newfilesinyourdirectory.ubootuboot.binuboot.mapanduboot.srec.Thefilewewanthereisuboot,whichistheELFfile.Tokeepthingsniceandtidymovethesefilestothe...target/ubootfolder.
15Revision210.04.2011
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/STLinux-2.4/devkit/sh4/target/boot/u-boot/u-boot
Nowyoushouldseesomeinterestingthingshappening,UBootshouldbeloadedintoyourreceivermemory,nowjusttypectocontinueandwatchtheserialconsoleoutput(youhavehopefullyhookeduptheSTBtoaserialportrunningaterminalemulatoralready).Thegeneric(andstrippedImaysay)UBootthatIcompileddidnothavethenetworkdriverscompiledintoitthatmySTBhas(RTL8201)soIhadtouseymodemtouploadauboot.bintomemoryandwritethattoflash(Imadethatuboot.binoutfromtheuboot.imgfileformyreceiver,justremembertoremovetheheaderinformationfirst,thatishowIbrickedmineinthefirstplace!)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
16Revision210.04.2011
ThatisprettymuchhowIunbrickedmySTBanyway...tookalotoftrialanderrortogetitallrightbuthey..nobodyisbornwithJTAGinformationalreadypresentinthebrainright?
##########ANNEX1:The.epttemplateforMPROG.(Pasteitintoatextfilesavedwiththe.eptsuffix)(YoucanchangetheFixedSerialNumbertowhateveryouwant,providingthatyouuseyourcustomizedSerialnumberasatargetname)[STARTCOPYPASTEFROMTHELINEBELOW][BasicDetails]DeviceType=10VIDPIDType=2USBVID=0483USBPID=3747[USBPowerOptions]BusPowered=1SelfPowered=0MaxBusPower=200[USBSerialNumberControl]Prefix=FTUseFixedSerialNumber=1FixedSerialNumber=STMCLT1000[USBRemoteWakeUp]EnableRemoteWakeUp=1[WindowsPlugandPlay]EnablePlugandPlay=0
17Revision210.04.2011
[USBStringDescriptors]Manufacturer=STProduct=STMicroConnectLite[ProgrammingOptions]OnlyProgramBlankDevices=0[BMDeviceSpecificOptions]USBVersionNumber=0DisableSerialNumber=0IOPinPullDowninSuspend=0[DualDeviceSpecificOptionsA]RS232mode=1245FIFOmode=0245CPUFIFOmode=0OPTOIsolatemode=0HighCurrentDrive=0[DualDeviceSpecificOptionsB]RS232mode=1245FIFOmode=0245CPUFIFOmode=0OPTOIsolatemode=0HighCurrentDrive=0[DualDeviceDriverOptionsA]VirtualComPortDriver=1D2XXDriver=0[DualDeviceDriverOptionsB]VirtualComPortDriver=1D2XXDriver=0[RDeviceSpecificOptions]InvertTXD=0InvertRXD=0InvertRTS#=0InvertCTS#=0InvertDTR#=0InvertDSR#=0InvertDCD#=0InvertRI#=0C0Signal=1C1Signal=1C2Signal=1C3Signal=1C4Signal=1EnableExtOsc=0HighCurrentI/O=0LoadD2XXDriver=0InEndPointSize=0[DualHSDeviceSpecificOptions]IFAIsFifo7=0IFAIsFifoTar7=0IFAIsFastSer7=0AIsVCP7=1IFBIsFifo7=0IFBIsFifoTar7=0
18Revision210.04.2011
IFBIsFastSer7=0BIsVCP7=1IOPinDriveDual=0UTMIDrive=0UTMIVendor=0SuspendOnD7Low=0[QuadHSDeviceSpecificOptions]AIsVCP8=0BIsVCP8=0CIsVCP8=1DIsVCP8=1ARIisTXDEN=0BRIisTXDEN=0CRIisTXDEN=0DRIisTXDEN=0IOPinDriveQuad=13107[ENDOFCOPYPASTESECTION]