ds30 loader - main manual

Upload: hectorlopez

Post on 04-Apr-2018

271 views

Category:

Documents


1 download

TRANSCRIPT

  • 7/30/2019 Ds30 Loader - Main Manual

    1/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 1 / 27

    ds30 LoaderMain manual

  • 7/30/2019 Ds30 Loader - Main Manual

    2/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 2 / 27

    Table of contentsTableofcontents........................................................................................................................2

    Introduction................................................................................................................................5

    ds30Loader............................................................................................................................5

    PrerequisitesandRequirements............................................................................................5

    Trademarks.............................................................................................................................5

    Whyuseabootloader...........................................................................................................5

    Usage..........................................................................................................................................6

    Operatingsystemconsiderations...........................................................................................6

    Windows.............................................................................................................................6

    Linux...................................................................................................................................6

    MacOSX............................................................................................................................6

    Installthe

    required

    tool

    suite

    .................................................................................................

    6

    Modifyfirmwaresettings.......................................................................................................6

    Buildthefirmware..................................................................................................................6

    Writefirmware.......................................................................................................................6

    Preparetheapplication..........................................................................................................7

    Downloadtheapplicationtothedevice................................................................................7

    Firmwarematrix.........................................................................................................................8

    Clients.........................................................................................................................................9

    Console...................................................................................................................................9

    GUI..........................................................................................................................................9

    API...........................................................................................................................................9

    CAN...........................................................................................................................................10

    Lawicel..................................................................................................................................11

    IXXAT....................................................................................................................................11

    Vector...................................................................................................................................11

    Configuration............................................................................................................................12

    Basicsettings........................................................................................................................12

    Portname.........................................................................................................................12

    Baudrate..........................................................................................................................12

    Writeflash........................................................................................................................12

    Writeeeprom

    ...................................................................................................................

    12

    Readflash.........................................................................................................................12

    Readeeprom....................................................................................................................12

    CAN.......................................................................................................................................12

    PICID................................................................................................................................12

    GUIID...............................................................................................................................12

    Extendedframes..............................................................................................................12

    DLC....................................................................................................................................12

    Advanced..............................................................................................................................13

    Dontwritegotototheuserapplication..........................................................................13

    Allowoverwrite

    of

    the

    boot

    loader

    ..................................................................................

    13

    Writeconfigurationbits...................................................................................................13

  • 7/30/2019 Ds30 Loader - Main Manual

    3/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 3 / 27

    Custombootloader..........................................................................................................13

    Autobaudrate.................................................................................................................13

    Echoverification...............................................................................................................13

    PutCRC

    before

    goto

    .........................................................................................................

    13

    Dontwriteemptypages..................................................................................................13

    Dontsetgototoblat0x00..............................................................................................14

    Timing...................................................................................................................................14

    Hellotimeout....................................................................................................................14

    Polltime............................................................................................................................14

    Timeout............................................................................................................................14

    Delayafterportopen.......................................................................................................14

    Reset.....................................................................................................................................14

    RTS....................................................................................................................................14

    DTR...................................................................................................................................

    14

    Command.........................................................................................................................14

    ID......................................................................................................................................15

    DLC....................................................................................................................................15

    Baudrate..........................................................................................................................15

    Activation.............................................................................................................................15

    RTS....................................................................................................................................15

    DTR...................................................................................................................................15

    Security.................................................................................................................................15

    Password..........................................................................................................................15

    Operation.................................................................................................................................

    16

    Parsingofhexfile.................................................................................................................16

    Validation.........................................................................................................................16

    Datacollection..................................................................................................................16

    Checkofdatathatcouldoverwritethebootloader.......................................................16

    CheckandmoveofGOTO................................................................................................16

    Countingofdata...............................................................................................................16

    SetGOTOtobootloader..................................................................................................16

    Write.....................................................................................................................................16

    Raiseofprocesspriority...................................................................................................16

    Devicereset

    ......................................................................................................................

    16

    Autobaudrate.................................................................................................................16

    Findbootloader...............................................................................................................17

    Determinebootloadersize..............................................................................................17

    Parsehexfile....................................................................................................................17

    Write.................................................................................................................................17

    Bootloaderupgradeprocedure...............................................................................................18

    Troubleshooting.......................................................................................................................19

    Knownissues........................................................................................................................19

    Errormessages.....................................................................................................................19

    HW

    schematics

    .........................................................................................................................

    21

    UART/softwareUART.........................................................................................................21

  • 7/30/2019 Ds30 Loader - Main Manual

    4/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 4 / 27

    Components.....................................................................................................................21

    Schematic.........................................................................................................................21

    CAN.......................................................................................................................................22

    Components.....................................................................................................................

    22

    Schematic.........................................................................................................................22

    AppendixALinks...................................................................................................................23

    AppendixBmemorymap......................................................................................................24

    AppendixCWritetimesamples............................................................................................25

    AppendixD Files.....................................................................................................................26

    Packagecontent...................................................................................................................26

    Filescreatedbyds30Loader................................................................................................27

  • 7/30/2019 Ds30 Loader - Main Manual

    5/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 5 / 27

    Introduction

    ds30 Loaderds30LoaderisabootloadersupportingPIC12,PIC16,PIC18,PIC24,dsPIC,andPIC32families

    ofMCUsfromMicrochip.Itsupportsalldevicesineachfamilyoutofthebox(thosein

    production).Thefirmwareiswritteninassembler.ThePCclientsrunonWindows,Linux,

    andMacOSX.

    Prerequisites and Requirements

    Requirementsforthedifferentpartsofds30Loaderisfoundintheirrespectivemanual.

    Trademarks

    Allrightstocopyrights,registeredtrademarks,andtrademarksresidewiththeirrespectiveowners.

    Why use a boot loader

    Abootloaderusuallyallowssoftwareupgradewithcheaporgenerallyavailableequipment

    suchasanRS232port,asopposedtospecializedandexpensiveequipmentsuchasaPIC

    programmer.Writetimemightalsobelowerwithabootloader.

    Drawbacksofusingabootloaderincludeaddedbootuptimeandincreasedflashmemory

    usage.

  • 7/30/2019 Ds30 Loader - Main Manual

    6/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 6 / 27

    Usage

    Operating system considerations

    Windows

    N/A

    Linux

    Theuserrunningds30Loadershouldbeamemberofthedialoutgroup.Toaddauserinthe

    dialoutgrouprunthefollowingcommandasasuperuser:useradd G dialout username

    Mac OS XTheuserrunningds30Loadershouldhavesufficientrightstoreadfromandwritetothe

    desiredport.

    Install the required tool suite

    Therequiredcompiler/assemblertoolsuiteneedstobeinstalledbeforethebootloader

    firmwareisopenedinMPLABIDE.Ifthetoolsuiteisnotinstalledwhentheprojectis

    opened;importantsettingsmaybelost.Seethefirmwaremanualforinformationaboutthe

    requiredtoolsuite(s).

    Modify firmware settingsRefertothefirmwaremanualfordetailedinformation.

    StartMicrochipMPLABIDE.

    OpenthefirmwarebyclickingOpenontheprojectmenu,andthenbrowsetothe

    ds30loader.mcpfilewhichislocatedinthefirmwaredirectory.

    Opensettings.inc(assemblerfirmware)orboard_xxx.h(Cfirmware)bydoubleclicking

    itintheprojecttreetotheleft.Reviewallsettingsandmodifywhenneeded.

    Openuser_code.inc(assemblerfirmware)orboard_xxx.c(Cfirmware)bydouble

    clickingitintheprojecttreetotheleft.Reviewtheavailablemacros/functionsand

    addinit/exit

    code

    if

    needed.

    Useexactlythesameconfigurationbitsfromtheapplicationinthebootloader

    unlessyouhaveagoodreasonnotto.

    Build the firmware

    BuildthefirmwarebyclickingBuildallontheprojectmenu.Noticeanywarningsinthe

    outputwindow.Correctanyerrorsthatappearintheoutputwindow.Refertothefirmware

    manualfordetailedinformationaboutds30Loaderspecificwarningsanderrors.

    Write firmware

    Writethe

    firmware

    to

    your

    device

    using

    your

    favorite

    programmer.

    For

    detailed

    information,

    refertothefirmwaremanual.

  • 7/30/2019 Ds30 Loader - Main Manual

    7/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 7 / 27

    Prepare the application

    Youneedtomakesurethereisagotoplacedatlocation0x00inyourapplication.Inmost

    casesyourlinkeralreadydoesthisforyou.TocheckifitdoesyoucanpickProgamMemory

    fromtheViewmenuinMPLAB.Itwilllooksomethinglikethescreenshotbelow.TheGUIwillletyouknowifitdoesnotfindagoto.

    Download the application to the device StarttheGUI.

    Selectthedesiredcommunicationsettingsandpickyourhexfile.Fordetails,referto

    theGUImanual.

    Pressthewritebutton.

    Resetdevicemanuallyifneeded.

    Waitforthewriteoperationtocomplete.

  • 7/30/2019 Ds30 Loader - Main Manual

    8/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 8 / 27

    Firmware matrixThefollowingfirmwaresareavailable.Fordetailedinformationrefertothefirmware

    manual.

    UART Sw UART* CAN* I C* SD card*PIC12 X X n/a

    seeds30 HEX

    Loader

    seeds30 SD

    card loader

    PIC16 X X n/aPIC18F X X XPIC18FJ X X n/aPIC24FK X X n/aPIC24FJ X X n/aPIC24H X X XPIC24E X - XdsPIC30F X X XdsPIC33F X X X

    dsPIC33E X - XPIC32 X - X

    *Onlyavailableinthecommercialversion

  • 7/30/2019 Ds30 Loader - Main Manual

    9/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 9 / 27

    Clients

    ConsoleItisacommandlineinterfacethatrunsonWindows,Linux,andMACOSX.Refertothe

    consolemanualformoreinformation.

    GUI

    ItisagraphicaluserinterfacethatrunsonWindows,Linux,andMACOSX.RefertotheGUI

    manualformoreinformation.

    API

    TheAPIisusedtointegratebootloaderfunctionalityina.NETapplication.Itisordered

    separately;contactMGDigitalSolutionsformoreinformation.

  • 7/30/2019 Ds30 Loader - Main Manual

    10/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 10 / 27

    CANTheds30LoadersupportsbootloadingontheCANbus.Seetable1foravailablefirmwares

    andtable

    2

    for

    supported

    CAN

    adapters.

    CAN

    operation

    is

    not

    available

    in

    the

    free

    edition.

    DeviceFamily Firmwareavailable SupportedDLCPIC12 n/a

    PIC16 n/a

    PIC18 yes 18*

    PIC24F n/a

    PIC24FJ n/a

    PIC24H yes 18*

    PIC24E yes 18

    dsPIC30F

    yes

    18

    dsPIC33FJ yes 18*

    dsPIC33E yes 18

    PIC32 yes 18Table1.AvailableCANfirmwares,*dependsonfirmwaretypeandversion

    Adapter Supportedbitrates Windows Linux MacOSXx86 x64 x86 x64 x86 x64

    IXXAT

    10k,20k,50k,100k,

    125k,250k,

    500k,

    800k,

    and1MX

    X

    Kvaser

    50k,62k,83k,100k,

    125k,250k,500k,and

    1M

    X X

    Vector100k,125k,250k,500k,

    and1MX X

    Peak

    5k,10k,20k,50k,100k,

    125k,250k,500k,and

    1M

    X X

    Lawicel10k,

    20k,

    50k,

    100k,

    125k,250k,500k,800k,

    1M

    * * X X X X

    ISCAN

    10k,20k,50k,100k,

    125k,250k,500k,800k,

    1M

    X X

    ESD

    ContactIntrepidCS

    NICAN

    X=supportedandrecommended *=supported =notsupported

    Table2.

    Supported

    CAN

    adapters

  • 7/30/2019 Ds30 Loader - Main Manual

    11/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 11 / 27

    Lawicel

    TheremaybeissuesrelatedtoLawicelCANadapters,seetheTroubleshootingKnownissues

    sectioninthisdocument.

    TheLawicelCAN232adapterisshippedwiththebaudratesetto57600.Thebaudratecan

    beincreasedforaperformanceimprovement;itisdoneintheconfigurationwindow

    availableinds30LoaderGUI.Theserialinterfacebaudratecannotbechangedwiththeds30

    Loaderconsoleapplication.

    Iftheds30Loaderconsoleapplicationisused,theserialinterfacebaudratemustbeset

    manuallyintheLawicelportconfigurationfiletoreflectthebaudratetheLawiceladapteris

    configuredfor.

    IXXATTheremaybeissuesrelatedtoIXXATCANadapters,seetheTroubleshootingKnownissues

    sectioninthisdocument.

    ThebitratescanbefullycustomizedbyeditingtheixxatBitRates.xmlfile.Itislocatedinthe

    samedirectoryastheds30Loaderexecutables.

    Vector

    ThebitratescanbefullycustomizedbyeditingthevectorBitRates.xmlfile.Itislocatedinthe

    samedirectoryastheds30Loaderexecutables.

  • 7/30/2019 Ds30 Loader - Main Manual

    12/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 12 / 27

    ConfigurationThissectionisvalidfords30LoaderGUI,ds30Loaderconsoleandtheds30LoaderAPI.

    Basic settings

    Port name

    Thenameoftheportthatwillbeusedtocommunicatewiththefirmware.

    Baud rate

    Thebaud/bitratethattheportwillbesetupforpriortocommunicatingwiththefirmware.

    Write flash

    Whenchecked,

    the

    flash

    memory

    is

    written

    during

    a

    write

    operation.

    This

    is

    disabled

    if

    the

    chosenhexfiledoesnotcontainanyprogrammemorylocations.

    Write eeprom

    Whenchecked,theeeprommemoryiswrittenduringawriteoperation.Thisisdisabledif

    thechosenhexfiledoesnotcontainanyeeprommemorylocations.

    Read flash

    Whenchecked,theflashmemoryisreadduringareadoperation.

    Read eepromWhenchecked,theeeprommemoryisreadduringareadoperation.

    CAN

    PIC ID

    ThissettingisonlyavailableforCANports,itspecifiesthePICCANID,anditshouldbesetto

    thesamevalueasinthebootloaderfirmware.Thiscanbeenteredasdecimal(example10)

    orhex(example0xa).

    GUI IDThissettingisonlyavailableforCANports.ItspecifiesGUICANIDanditshouldbesettothe

    samevalueasinthebootloaderfirmware.Thiscanbeenteredasdecimal(example10)or

    hex(example0xa).

    Extended frames

    Whensetextendedframesaresentandonlyextendedframesarereceived.

    DLC

    ThissettingdetermineshowmanybytesofdatawillbesendineachCANframe.Notthat

    notall

    CAN

    firmwares

    support

    high

    DLC

    than

    1.

  • 7/30/2019 Ds30 Loader - Main Manual

    13/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 13 / 27

    Advanced

    Thispage

    contains

    advanced

    settings

    that

    are

    normally

    not

    used.

    Dont write goto to the user application

    Whenenabled,thefirstinstructionsinthehexfilewillnotbemovedtojustbeforetheboot

    loader.Thiscanbeusefulwhenwritingpartofanapplicationoronlydatatoflash.

    Allow overwrite of the boot loader

    Whenahexfileisparsedthereiscontroltomakesurethatthecontentswillnotoverwrite

    thebootloader,byenablingthissettingthatcontrolisdisabled.Thisdoesnotbypassthe

    firmwaresownoverwriteprotectionifany.

    Write configuration bits

    Whenchecked,theconfigurationbitsiswrittenduringawriteoperation.Thisisdisabledif

    thechosenhexfiledoesnotcontainanyconfigurationsbitsorifthehexfilecontainsmore

    configurationbitlocationsthantheselecteddevicehas.Writingconfigurationbitsareonly

    possibleonceperpoweroncycle.

    Custom boot loader

    Allowsproperoperationwithcustombootloaderfirmwareswheresizeandplacementhas

    changed.Greatcaremustbetakentosetcorrectcustomplacementandsize,theymust

    matchthe

    BLPLP

    and

    BLSIZEP

    defines

    in

    the

    firmware.

    If

    a

    write

    is

    made

    with

    the

    wrong

    customparameters,thebootloadermaygetbrokenifthefirmwaredoesntfeature

    overwriteprotection.

    Auto baud rate

    Whenenabled,anautobaudratesynchronizationcharacterissentpriortothewrite,read

    andcheckforbootloaderoperations.Thefirmwaremustbesetupforautobaudrate

    detection.Notallfirmwarescomewiththisfeature.

    Echo verification

    Ifthe

    device

    hardware

    or

    firmware

    is

    set

    up

    to

    echo

    all

    received

    data

    this

    option

    must

    be

    enabled.Whenenabledtheds30Loaderenginewillcompareallsentdatawiththeecho.

    Andgiveanerrorifthereisamismatch.

    Put CRC before goto

    Calculatesa16bit(14bitforPIC12andPIC16)checksumvalueoftheprogrammemoryand

    storesitjustbeforetheuserapplicationgotothatinturnisplacedjustbeforetheboot

    loader.

    Dont write empty pages

    Whenthis

    is

    enabled

    pages

    that

    only

    contain

    0xff

    will

    not

    be

    written.

    This

    may

    decrease

    writetimeandmayalsoresolvetheThehexfilecontainscodethatwilloverwritetheboot

  • 7/30/2019 Ds30 Loader - Main Manual

    14/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 14 / 27

    loadermessage.

    Dont set goto to bl at 0x00

    Usuallya

    goto

    to

    the

    boot

    loader

    is

    placed

    at

    0x00.

    When

    this

    option

    is

    checked,

    the

    first

    few

    wordsat0x00willnotbemodified.Ifahexfilethatcontainsdatainthefirstpageiswritten

    withthisoptionenabledandthebootloaderfirmwaredoesnotfeaturegotoprotection,the

    bootloaderwillnotworkanymorebecauseitwillnotbecalledonstartup.

    Timing

    Hello timeout

    Specifiesthetimetosendthehellocommandbeforegivingupwhennoresponseis

    received.

    Poll time

    Specifiestheintervalatwhichthehellocommandissenttothebootloader.

    Timeout

    Specifiesthecommunicationtimeout.

    Delay after port open

    Thisdelayisissuedrightaftertheportisopened.Itcanusuallybekeptat0.

    Reset

    RTS

    Whenenabled,theRTSpinisheldhighpriortocommunicationwiththefirmware.Thevalue

    ofresettimespecifiesthetimetheRTSpinisheldhigh.Thisisonlyavailableforserialports

    andhardwaresupportmustbepresent.

    DTR

    Whenenabled,theDTRpinisheldhighpriortocommunicationwiththefirmware.The

    valueofresettimespecifiesthetimetheDTRpinisheldhigh.Hardwaresupportmustbe

    present.This

    is

    only

    available

    for

    serial

    ports.

    Command

    Whenenabled,acommandissenttothedevicetorequestresetorloadingoftheboot

    loader.WhenaCANportisused,themacros$PICIDand$GUIIDcanbeused,theywillbe

    expandedtoatwoorfourbytebigendianvaluedependingonifextendedisusedornot.

    Thevalueofresettimespecifiesthetimetowaitafterthecommandissentbeforetryingto

    communicatewiththebootloader.

    Theformat

    of

    the

    data

    is

    hexval1;string;string.

    Examplehexonly:0;11;f;ab;3e

  • 7/30/2019 Ds30 Loader - Main Manual

    15/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 15 / 27

    Examplestringsonly:Hello;Reset

    Examplemixed:a5;Reset

    IDTheCANidtobeusedwhensendingtheresetcommand.

    DLC

    TheCANDLCtousewhensendingtheresetcommand.

    Baud rate

    Thebaudratetousewhensendingtheresetcommand.

    Activation

    RTS

    Whenchecked,theRTSpinisusedtoactivatethedevicebyholdingithighduringawrite

    operation. Hardwaresupportmustbepresent.

    DTR

    Whenchecked,theDTRpinisusedtoactivatethedevicebyholdingithighduringawrite

    operation.Hardwaresupportmustbepresent.

    Security

    Password

    Thepasswordwillbesentbeforeanybootloaderoperationisperformed.

  • 7/30/2019 Ds30 Loader - Main Manual

    16/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 16 / 27

    Operation

    Parsing of hex-fileThefollowingoperationstakeplaceduringtheparsingofahexfile:

    Validation

    Thehexfileisvalidated.Linechecksums,fileformatandfilecompletenessischecked.Ifany

    errorisdetected,theparsingisaborted.

    Data collection

    AlldatafoundinthehexfilethatfitsintheselecteddevicesmemoryareaarestoredinRAM

    buffers.

    Check of data that could overwrite the boot loader

    Ifdatafoundinthehexfilebelongtothesamememoryspaceasthebootloader,awarning

    isdisplayedandtheWriteprogramcheckboxgetsdisabled.

    Check and move of GOTO

    Thisstepisnotperformedifthehexfileisencrypted.IfnoGOTOisfoundataddress0x00

    thebootloaderdoesnotknowhowtoloadtheuserapplicationandtheWriteprogram

    checkboxgetsdisabled.IfaGOTOat0x00isfound,itismovedtothetwowordsjustbefore

    thebootloader.

    Counting of data

    Thedatainthebuffersarecountedforpresentation.

    Set GOTO to boot loader

    AGOTOtothebootloaderisinsertedinthefirstwordsbeginningat0x00.

    Write

    Thefollowingoperationstakeplaceduringawriteoperation:

    Raise of process priorityIfthepolltimeissetlowerthan100ms,theGUIprocesspriorityisraisedtoabovenormal.

    Device reset

    Ifactivatedintheresettab,thedeviceisreset.

    Auto baud rate

    Ifautobaudrateischecked,theautobaudratesynchronizationcharacter(0x55)issent

    usingpolltimeuntiltimeoutisreachedorthebootloaderresponds.

  • 7/30/2019 Ds30 Loader - Main Manual

    17/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 17 / 27

    Find boot loader

    Thehellocommandissentusingpolltimeuntiltimeoutisreachedorthebootloader

    responds.Thebootloaderrespondswithdeviceidandfirmwareversion.Thereceived

    deviceid

    is

    checked

    against

    the

    selected

    device

    in

    the

    GUI.

    Determine boot loader size

    Thebootloadersizeisdeterminedbasedonthefirmwareversion.

    Parse hex-file

    Thehexfileisparsedifneededdependingonifthedeterminedbootloadersizeisdifferent

    fromtheoneusedduringlastparse.

    Write

    Program,eeprom

    and

    configuration

    bits

    are

    sent

    for

    write

    by

    the

    firmware.

    If

    checksum

    errorisdetectedbythefirmware,theGUIretries3times.Ifall3triesfail,thewrite

    operationisaborted.

  • 7/30/2019 Ds30 Loader - Main Manual

    18/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 18 / 27

    Boot loader upgrade procedure

    Thisisnotrecommendedandsupportisnotguaranteed.

    Thisguideassumesyouhavetheds30Loaderinstalledinthedefaultlocation.Thedefault

    locationmaydifferbetweendifferentfirmwareversions.Followthesestepscarefully.The

    mostcriticalstepis16:ifitfailsthebootloaderislikelytostopworking.

    1. MakeacopyofbootloaderMPLABprojectdirectory.

    2. OpentheMPLABprojectofthetemporarybootloadercreatedinthepreviousstep

    3. Opensettings.inc

    4. Disablegotoprotectionifavailable

    5. Enableboot

    loader

    protection

    if

    available

    6. Changethebootloaderplacement,BLPLP(inolderversionsthisdefinemaybe

    locatedinds30loader.s/asm):

    Devicefamily Bootloaderplacementoftemporarybootloader,BLPLP/BLPLRPIC16F Upgradeisnotsupported

    PIC18F BLPLP2+1

    PIC18FJ BLPLP+2

    PIC24F BLPLR2+1

    PIC24FJ BLPLP+2

    PIC24H

    BLPLP+

    2

    dsPIC30F BLPLR2+1

    dsPIC33FJ BLPLP+2

    7. Buildtheproject,MenuProject>MakeorF10

    8. Opends30LoaderGUIandchoosethehexfilegeneratedinthepreviousstep

    9. Writethetemporarybootloaderasyouwouldwithanyhexfile

    10.Ifnotalreadyactivated,activateadvancedmodonthemenuView>Advancedmode.

    11.CheckDontwritegotoat0x00undertheadvancedtab

    12.CheckCustombootloaderundertheadvancedtab

    13. Putvalue

    of

    BLPLP/BLPLR

    from

    the

    temporary

    boot

    loader

    the

    placement

    textbox

    14.PutvalueofBLSIZEP/BLSIZEfromtemporarybootloaderinthesizetextbox

    15.Choosethehexfileofthenewbootloader

    16.Makesurethetemporarybootloaderisactive,eitherusingtimeorusealedto

    indicatethatthetemporarybootloaderisactive.

    17.Write

    18.Thebootloaderupgradeisfinished

  • 7/30/2019 Ds30 Loader - Main Manual

    19/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 19 / 27

    Troubleshooting

    Known issues WiththeLawicelCANadaptersreadoperationisnotpossibleformostcombinations

    ofbitrateandserialinterfacebaudrate.Typicallyanybitrateabove50kwillnot

    workforreadflashoperation.Writeoperationstillworks.

    TheIXXATISBtoCANcompactadaptertakesseveralhundredmillisecondstosetup.

    Thismeansthatthefirmwaretimeoutcannotbesetshorterthanthisifareset

    commandisusedandtheapplicationusesadifferentbitratethanthebootloader.

    Error messages

    Trouble Possiblecause Solution

    Verificationfailed"

    Brokenchip Replacethechip.

    Wornoutflash Replacethechip.

    Chipisused

    outsidespecifications

    Readdatasheetandmake

    sureallspecificationsare

    met

    Codeprotectionisused Ifcodeprotectionisusedthe

    deviceshouldbecompletely

    erasedbeforetheboot

    loaderiswritten.

    Uartrxbuffernotemptyas

    expected(isdevicesending

    data?)

    Thiscouldhappenifthe

    deviceisnotrestarted

    properlyandissendingdata

    Restartthedevicebefore

    pressingdownload.

    Hardwaredetecteda

    framingerror

    Thismighthappenwhenthe

    baudrateerrorisjustonthe

    limit.

    Tryadifferentbaudrate,

    higherorlower.Needstobe

    changedinboththeboot

    loaderfirmwareandthe

    hostapplication.

    Tryanothercomport.

    Thehexfilecontainscode

    thatwilloverwritetheboot

    loader

    Thisoccurswhentheloaded

    hexfilecontainsmemory

    locationsthatcould

    overwritethebootloader.It

    canalsooccurifthewrong

    deviceisselected.

    Becausetheapplicationdoes

    notknowtheactualboot

    Selectcorrectdevice.

    Setcustombootloader

    propertiesunderthe

    advancedtabtothevalues

    fromthefirmware,usually

    calledBLPLPandBLSIZEPin

    settings.inc.

    Freeupprogrammemoryif

    needed.

  • 7/30/2019 Ds30 Loader - Main Manual

    20/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 20 / 27

    loadersizepriorto

    communicationwiththe

    bootloaderitassumesa

    size.This

    value

    might

    be

    wrong;onecantellthe

    applicationthecorrectvalue

    undertheadvancedtab.

    Reservebootloadermemory

    spaceintheapplication

    linkerscript.

    Hexfilecontainsmore

    configlocationsthanthe

    devicehas

    Ifyouusetheexport

    functionfromMPLABthis

    mighthappen.

    Usethehexfileproducedby

    theassemblerorlinker.

    Lastrowcontainingconfigs

    wasfound

    in

    hex

    file,

    last

    pagehasbeendisabled.

    Consultmanualformore

    information.

    OnPIC18FJ,PIC24FJ,andon

    somePIC24E/dsPIC33E

    devicestheconfiguration

    wordsarestoredasthelast

    wordsintheordinaryflash

    addressspace.The

    configurationwordsarevital

    tothePICoperation.To

    avoidcorruptingthe

    configurationwordsor

    changingthemwhichcould

    leadto

    the

    boot

    loader

    not

    functioningproperlythelast

    pageinflashwillnotget

    written.

    Towritethelastpagein

    flash,check

    the

    write

    configs

    checkboxunderthe

    advancedtab.

    Itisunlikelythatthelast

    pagewillcontainanycode,

    thereforeitisusuallysafeto

    notwritethelastpageand

    thisisalsorecommended.

  • 7/30/2019 Ds30 Loader - Main Manual

    21/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 21 / 27

    HW schematics

    UART / software UARTThisisjustasampleimplementationofUARTcommunication.Theschematiccomeswithout

    warranty.

    ComponentsName Value CommentIC1 PIC Required PIC microcontroller

    IC2 MAX202 Required RS232 level converter

    X1 DB9 Optional Connector

    R1 10k Required Master clear pull-up

    C1 100n Recommended Decoupling capacitor

    C2 10F Recommended Filter capacitorC3 100nF Recommended Decoupling capacitor

    C4 100nF Required Charge pump capacitor

    C5 100nF Required Charge pump capacitor

    C6 100nF Required Charge pump capacitor

    C7 100nF Required Charge pump capacitor

    R2 10k Optional Reset by RTS, base current limiter

    R3 10k Optional Reset by RTS, base pull-down

    D1 1N4148 Optional Reset by RTS, RTS signal rectifier

    Q1 BC547 Optional Reset by RTS, RTS signal inverter

    Schematic

  • 7/30/2019 Ds30 Loader - Main Manual

    22/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 22 / 27

    CAN

    ThisisjustasampleimplementationofCANcommunication.Theschematiccomeswithout

    warranty.

    ComponentsName Value CommentIC1 PIC Required PIC microcontroller

    U1 MCP2551 Required CAN transceiver

    X1 DB9 Optional Connector

    R1 10k Required Master clear pull-up

    R2 120 Optional Bus termination

    R3 22k Required Slew rate control, see the datasheet

    C2 10F Recommended Filter capacitor

    C3 100nF Recommended Decoupling capacitor

    Schematic

  • 7/30/2019 Ds30 Loader - Main Manual

    23/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 23 / 27

    Appendix A Linksds30Loaderwebsite

    http://www.ds30loader.com

    ds30Loaderfreeeditionwebsite

    http://mrmackey.noip.org/elektronik/ds30loader/

    MicrosoftVisualC#expressedition

    http://www.microsoft.com/express/vcsharp/

    Mono/MonoDevelop

    http://www.monoproject.com

    Eagle

    http://www.cadsoft.de

  • 7/30/2019 Ds30 Loader - Main Manual

    24/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 24 / 27

    Appendix B memory map

    a. Thegotoapplicationwordat0x00isnormallycreatedautomaticallybythecompiler.TheGUImovesthegototojustbeforethebootloadercode.

    b. Theuserapplicationisnotaffectedbythebootloader

    c. Anewgotoat0x00pointingtothebootloadercodeiscreatedbytheGUI.

    d. Thebootloadercodeisnormallyplacedattheendofthememory.

    GOTOBOOTLOADER

    USER

    APPLICATION

    BOOTLOADER

    GOTO USER

    APPLICATION

    GOTO USERAPPLICATION

    USER

    APPLICATION

    Without bootloader With bootloader

    a

    b

    c

    b

    a

    d

    START OF

    EXECUTION GOTOBOOTLOADER

    USER

    APPLICATION

    BOOTLOADER

    With bootloader

    c

    b

    GOTO USER

    APPLICATION

    a

    d

    CONFIGS

    PIC16, PIC18F, PIC24F,

    PIC24H, dsPIC

    PIC18FJ, PIC24FJ

  • 7/30/2019 Ds30 Loader - Main Manual

    25/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 25 / 27

    Appendix C Write time samplesThesearesampletimesandshouldnotbeseenasawarranty,performancemaybedifferent

    inyourapplication.Dataisactualdatathatendsupintheflashmemory.

    UART data[kB] baudrate time[s] kB/s DevicePIC12F 3,1 115200 5,5 0,6 PIC12F1822

    PIC16F 14,0 115200 16,5 0,8 PIC16F1936

    PIC18F 31,5 115200 8,3 3,8 PIC18F2550

    PIC18FJ 14,0 115200 2,8 5,0 PIC18F24J11

    PIC24F 15,5 115200 2,3 6,7 PIC24F16KA102

    PIC24FJ 125,0 115200 15,5 8,1 PIC24FJ128GA010

    PIC24HJ 126,5 115200 15,8 8,0 PIC24HJ128GP504

    PIC24E

    dsPIC30F 47,3 115200 7,7 6,1 dsPIC30F4011

    dsPIC33FJ 254,5 115200 31,9 8,0 dsPIC33FJ256GP710

    dsPIC33E 509,0 115200 76,4 7,2 dsPIC33EP512MU810

    PIC32MX 508,0 115200 69,4 7,3 PIC32MX795F512L

    CAN data[kB] bitrate time[s] kB/s DevicePIC18F PIC18F66K80

    PIC24HJ

    126,5

    250000 40,0 3,0 PIC24HJ128GP504

    PIC24E

    dsPIC30F 47,0 250000 5,9 8,0 dsPIC30F4011

    dsPIC33FJ 253,0 250000 84,0 3,0 dsPIC33FJ256GP710

    dsPIC33E dsPIC33EP512MU810

    PIC32MX 508,0 250000 51,0 10,0 PIC32MX795F512L

  • 7/30/2019 Ds30 Loader - Main Manual

    26/27

    ds30 LoaderMain manual October 2012

    Copyright 2010-2012 MG Digital Solutions 26 / 27

    Appendix D - Files

    Package content

    File Description\copying.txt Thelicensefords30Loader

    \bin Containsbinaries\bin\canlibCLSNET.dll UsebytheKvaserCANportplugin

    \bin\PCANBasic.dll UsedbythePCANCANportplugin

    \bin\PCANBasic_x64.dll UsedbythePCANCANportplugin,thisneedstobe

    manuallyrenamedtoPCANBasic.dllonx64systems.

    \bin\PCANBasic_x86.dll UsedbythePCANCANportplugin,thisneedstobe

    manuallyrenamedtoPCANBasic.dllonx86systems.

    \bin\vcinet2.dll UsedbytheIXXATCANportplugin

    \bin\vxlapi.dll UsedbytheVectorCANportplugin

    \bin\vxlapi64.dll UsedbytheVectorCANportplugin

    \bin\vxlapi_NET20.dll UsedbytheVectorCANportplugin

    Requires:vxlapi.dll

    \bin\ds30LoaderGUI.exe Graphicaluserinterfacefords30Loader

    \bin\ds30LoaderConsole.exe Consoleapplicationfords30Loader.

    \bin\ixxatBitRates.xml ContainsCANtimingsusedbyIXXATCANportplugin

    fordifferentbitrates

    \bin\vectorBitRates.xml ContainsCANtimingsusedbyIXXATCANportplugin

    fordifferentbaudrates

    \documentation Containsalldocumentationfortheds30Loader\firmwarexxx ContainsaMPLABIDEprojectforasingleMicrochip

    devicefamily\firmwarexxx\ds30loader.mcp MPLABIDEprojectfile

    \firmwarexxx\src\devices.inc Containsdeviceconstants

    \firmwarexxx\src\settings.inc Containsbootloadersettingsthatshouldbe

    checked/changedbeforedownload

    \firmware

    xxx\src\user_init.inc

    User

    initialization

    and

    exit

    code

    \firmwarexxx\src\ds30loader.s/asm Containsthebootloadercode

    \links Containslinkstowebpagesthatarerelevanttotheds30Loader

    \source ContainsaVisualStudio2008solution\tools Containsafewtoolsthatmaybeusefulwhen

    determiningwhatsettingsoneshouldusesettings.inc

    \tools\dsPIC33PLLsettings.xls AnExcelsheettohelpsettingupthePLLondsPIC33

    devices.ProvidedbyLeoBodnar

    \tools\UART

    error

    calculator

    Helpful

    to

    calculate

    uart

    settings

    \tools\CANtimingcalculator HelpfultocalculateCANsettings

  • 7/30/2019 Ds30 Loader - Main Manual

    27/27

    ds30 LoaderMain manual October 2012

    \tools\bldelaycalculator.xls Calculatestimingconstants

    Files created by ds30 LoaderCreatedfilesareusuallyplacedinuserhomedirectory\.ds30Loader

    File DescriptionsettingsPortLawicel.xml SettingssavedbyLawicelCANportplugin

    settingsPortSerial.xml Settingssavedbyserialportplugin

    settingsPortVector.xml SettingssavedbyVectorCANportplugin

    settings.xml GUIsettings

    recentfile*.xml GUIsettingsforrecentfiles