Home

Flash Magic Manual

image

Contents

1. Flash Magic GUI and Command Line Manual 8 32 TIMEOUTS Description More than one allowed Type Syntax Output Default Example Sets the timeouts used for ISP operations Two timeouts are used regular and long The regular timeout is used for most operations The long timeout is used for erasing and blank check operations If the values used are less than the minimum allowed then the minimums are used which are 4 seconds for the regular and 15 seconds for the long No Configuration TIMEOUTS regular long where regular The regular timeout in seconds long The long timeout in seconds None The default timeouts of 4 seconds for the regular and 60 seconds for the long are used TIMEOUTS 5 35 Page 90 Flash Magic GUI and Command Line Manual 8 33 ERASEUSED Description More than one allowed Type Syntax Output Default Examples Erases the blocks used by a specific hex file Yes Operation ERASEUSED path protectisp Where type Path of the hex file to analyze for which blocks to erase protectisp Set to PROTECTISP to stop the ISP code from being erased in devices that contain the ISP code in the main Flash memory Set to NOPROTECTISP to allows ISP code to be erased Ignored for other devices It is strongly recommended to set this option to PROTECTISP Erase complete type Or Erase failed reason type Where type The type of erase USED reaso
2. Start Bootloader Demonstration Project Included in the Flash Magic installation is a folder called StartBootROMDemo that contains an example project that accepts the command boot at 9600 baud The 8051 folder contains examples for the Keil and Raisonance 8051 C Compilers Currently there is no XA example but this one can be adapted For an LPC2xxx example see NXP Application Note AN10356 Entering ISP mode from user code The files for the 8051 projects are Description Main c Application source file containing the main function Rx2iaplib a51 In Application Programming library from www esacademy com Rx2iaplib h Header file for In Application Programming library Reg51irx2 h Header file for the Rx2 device Kstartbootrom uv2 Keil uVision example project file Rstartbootrom prj Raisonance RIDE example project file Kstartbootrom hex Keil generated Hex File Rstartbootrom hex Raisonance generated Hex File Advanced Features Special characters may be inserted into the command to provide additional functionality They consist of a special character followed by two hexadecimal characters and have the following meanings HH transmit the character HH where HH is the hexadecimal value of the character HH delay for HH x 100ms where HH is a hexadecimal value amp AA command The function of the command depends upon the hexadecimal value AA and currently can be one of the following 00 flush RX buffer 01 echo on 02
3. V Verify after programming V Set Security Bit 1 Fill unused Flash Set Security Bit 2 V Generate checksums Set Security Bit3 IV Execute M 6clksfcycle This section is optional however Verify After Programming Fill Unused Flash and Gen Block Checksums may only be used if a Hex File is selected and therefore being programmed as they all need to know either the Hex File contents or memory locations used by the Hex File Checking the Verify After Programming option will result in the data contained in the Hex File being read back from Flash and compared with the Hex File after programming This helps to ensure that the Hex File was correctly programmed If the device does not support verifying then this item will be disabled Checking the Fill Unused Flash option will result in every memory location not used by the Hex File being programmed with the value that sets all the bits to a programmed state Once a location has been programmed with this feature it cannot be reprogrammed with any other value preventing someone from programming the device with a small program to read out the contents of Flash or altering the application s operation Checking the Gen Block Checksums option will instruct Flash Magic to program the highest location in every Flash block used by the Hex File with a special checksum adjuster value This value ensures that when a checksum is calculated for the whole Flash Block it will equal 55H providing the conte
4. Check PSEN Status Byte 0x00 Cancel Reprogram The current Boot Vector and Status Byte settings will be shown Modify the settings as desired and click on the Reprogram button Setting the Boot Vector to a value other than the default may result in the inability to run the Bootloader on the device This will mean that the ISP features of the device cannot be accessed until the device has been erased in a Parallel Programmer Page 24 Flash Magic GUI and Command Line Manual Because of this danger you will be presented with a confirmation window if you try to reprogram the Boot Vector to a non default value Confirm Changing Boot ector x A WARNING Changing the Boot Vector to a value other than the default of OxFC may result in the inability to communicate with the device using ISP You have selected to reprogram the Boot Vector to a value that is not the default of OxFC To confirm this operation answer the question below Any answer other than yes or YES will cancel this operation Are you sure you wish to reprogram the Boot Vector m Cancel OK Following the instructions in the window carefully to reprogram the Boot Vector Once the Boot Vector and Status Byte have been reprogrammed a confirmation message will be displayed Some devices do not support a Boot Vector However the Status Byte may still be changed by selecting Status Byte from the ISP menu The following dialog window will be
5. More than one allowed No Type Configuration Syntax INTERFACE interfacetype Where interfacetype The interface to use One of NXPICPBRIDGE FDIUSBICP80C51ISP FDIUSBICPLPC9XX FDIUSBICPLPC2K FDIUSBDONGLE Output None Default No interface is used Examples INTERFACE NXPICPBRIDGE Page 100 Flash Magic GUI and Command Line Manual Chapter 9 89LPC9xx Recommended Settings 9 1 Baud Rate When using the internal RC oscillator it has been found that 9600 baud works reliably most of the time Some devices in the 89LPC9xx family which feed the watchdog during ISP operation work reliably at 7200 baud Recommendation Try 9600 baud first If it does not work or does not work reliably then try 7200 baud 9 2 ISP Entry By default the pulse entry method is turned on as it is the most commonly used entry If your circuit does not use DTR or RTS then you can turn this option off or ignore it The option is located in the Advanced Options under the Hardware Config tab If you are using an 89LPC932 revision C then you need to turn this option off Recommendation Leave pulse entry turned on unless you are entering ISP mode using break detect or a custom method 9 3 Oscillator Frequency The oscillator frequency is entered into the box in section 1 of the main window It is used for the high speed communications feature present in some members of the 89LPC9xx family Enter the oscillator frequency as accurately as pos
6. echo off 03 send break condition 04 don t wait for a response By default at the start of a command the echo is on Regardless of whether the echo is on or off when the end of a command is reached the device must return a to indicate the command was successfully received If amp 04 is included anywhere in the command then the device does not need to return a response Examples 0D 02 Transmits a carriage return followed by an STX 80 Transmits 80H 14 Delays for 20 x 100ms 2 seconds Page 32 Flash Magic GUI and Command Line Manual 0A Delays for 10 x 100ms 1 second amp 00 Flushes the RX buffer A amp 02B amp 01C_ Transmits A waits for A to be echoed transmits B then transmits C and waits for C to be echoed 0D 14 amp 00A Transmits a carriage return waits for 2 seconds flushes the RX buffer and transmits A Page 33 Flash Magic GUI and Command Line Manual 6 11 Erase Pages Some devices allow the flash to be erased in pages If this feature is supported by the device then the Erase Flash Pages item on the ISP menu will be enabled The dialog window is similar to the Erase dialog window Erase aoe 00080 0008 F Erase page 3 0x00C0 000FF Erase page 4 0 0100 001 3F Erase page 5 0 0140 0 01 F Erase page 6 0x0180 001BF FF ISE Di F spem a 00240 0x027F Erase page 10 00280 0x02BF z Close Erase mo Select the pages to
7. end Where start The address to perform the blank check from inclusive end The address to stop the blank check at inclusive Memory blank start end Or Memory not blank at address start end Or Memory not blank start end Or Blank check failed reason start end Where start The start address passed to the BLANKCHECK directive end The end address passed to the BLANKCHECK directive address The first non blank address reason The reason for the failure No blank check is performed BLANKCHECK Page 55 Flash Magic GUI and Command Line Manual 8 4 BOOTVECTOR Description More than one allowed Type Syntax Output Default Examples Programs the Boot Vector with a new value Yes Operation BOOTVECTOR value Where value new value for the Boot Vector Boot Vector programmed to value Or Boot Vector program failed reason value Where value The value the Boot Vector was programmed to in hexadecimal prefixed with Ox reason The reason for the failure The Boot Vector is not programmed with a new value BOOTVECTOR 128 BOOTVECTOR 0x80 BOOTVECTOR 80H Page 56 Flash Magic GUI and Command Line Manual 8 5 COM Description More than one allowed Type Syntax Output Default Examples Specifies the PC Serial COM port and baud rate to use for communicating with the device If High Speed communications are being used then this di
8. 8 48 30 AM more info You can either enter a path name in the text box or click on the Browse button to select a Hex File by browsing to it Also you can choose Open from the File menu Note that the Hex file is not loaded or cached in any way This means that if the Hex File is modified you do not have to reselect it in Flash Magic Every time the Hex File is programmed it is first re read from the location specified in the main window The date the Hex file was last modified is shown in this section This information is updated whenever the hex file is modified The hex file does not need to be reselected Clicking on more info or choosing Information from the File menu will display additional information about the Hex file The information includes the range of Flash memory used by the Hex file the number of bytes of Flash memory used and the percentage of the currently selected device that will be filled by programming the Hex file If the device supports programming and execution from RAM for example the ARM devices then the hex file may contain records for the RAM First the flash will be programmed followed by the RAM Programs loaded into RAM via a hex file may be executed using such features as the Go option See chapter 6 for more details Page 14 Flash Magic GUI and Command Line Manual 4 4 Step 4 Options Flash Magic provides various options that may be used after the Hex File has been programmed 4
9. NA 61 6 0 FIEXMRILE cirar enn Ee nna EE EE AE T ARRE 62 8 9 HIGHSPEED onien REAREN RA EA EANA AAEREN 64 8 10 PEA Deer an aae E AA EA 65 8 1 LREADSECUR ITY sestve cance dviss niare aT ENA ENEAN E EEr EA Sip na Arara e aeia 66 8 12 READSIGNATURE vvsscseticvvicnes ota feactueVae dunk ANENA RARER EANN EEAS Pana waa cae TANNA 67 8213 SECURITY eerie Ea EAE 68 p14 STATUSBYTE irre sten nienn E EA EAE EAA EL EREET EA AEE EEEE 70 8 15 VERIFY sccveivees sie enairar EENAA TNA RERA EKAA EANES 71 8 26 QUIE Tsustrncinaxeoiethovaeinausrinetexd R awe mieageueia E iam ae senern er ceraan 72 6217 READBOOTVECTOR sai stuisknalscsidatiaensewsdbisa adsncxadd anvaetish estes veaacwadnindeacaiasndeatatlednaeacas 73 S 1S READSTALUSBYT Bicsisostcsntstacesstsceisiaenigieerenietieriad inde igi EAO E A 74 8 19 HALFDURLEX cxtevecetacuittae mevets S A A Eaa 75 OORE ET raa E A T a E eaneieaenaetineds 76 8 21 START BOOTLOADER motcsisriiorns orni kanaan ninri N EETAS ERa EAE TARAS 77 8 22 READCLOCK Grimeren inina EEA A eicweiaasoriederveiad es 79 Sekako a c T A AE E E E E E T a TE TI 80 8 24 HARDWARE wsccsniecsscsedrsiexnisasdvietecidanetetiagiegieaitaracietianisierisbienicianiatndvtgieniesaennens 81 8 25 READCRC rra sis uawcavia venues den EAN ena vay ei oan eee ua vena bed ova eee teen Tana RG aa meee 83 8 26 ERASEPAGE cicccer seis s sees tedaeesererisreieeiiern nasser a 84 8 27 READCONFIG 0cc0cccciisecseseeseeseeserseretssssessetietievieiniinieiiienei aa 85 8 28 CON
10. Page 64 Flash Magic GUI and Command Line Manual 8 10 READ Description Reads the range of Flash memory specified and saves the contents in an Intel Hex File More than one allowed Yes Type Operation Syntax READ start end path Where start The start address inclusive end The end address inclusive path Path to the Intel Hex file to create Output Flash read complete path Or Flash read failed reason path Where path Path of the Intel Hex File to create as passed to the READ directive reason The reason Flash read failed Default Flash is not read Examples READ 0x2000 0x343C test hex READ 2000H 0x343C C work test hex READ 2000H 13372 test hex Page 65 Flash Magic GUI and Command Line Manual 8 11 READSECURITY Description Reads the security bits More than one allowed Yes Type Operation Syntax READSECURITY Output The results are listed with each security bit on a separate line with the format Bit n result Or Block b bit n result Or Code Read Protection result Or Security bit read failed reason Where n 1 3 b 0 7 result set or not set or enabled or disabled reason The reason security bit read failed Default The security bits are not read Example READSECURITY Page 66 Flash Magic GUI and Command Line Manual 8 12 READSIGNATURE Description Reads the signature bytes More than one allowed Yes Type Operation Syntax READS
11. Serial Number M Unlock Device Enter Serial Number eee asc Unlock Device Close To set a serial number enter it into box boxes indicated The contents of the boxes must match Then click on Set Serial Number To reset a serial number click on the Reset Serial Number button To unlock a device using a serial number enter the correct serial number into the box and click on Unlock Device Serial numbers may be entered in ASCII or Hexadecimal by selecting from the drop down list Examples of ASCII serial numbers 2A45bc2 foobar MyOldMan Examples of Hexadecimal serial numbers 23BD4C2101ED3451 Page 39 Flash Magic GUI and Command Line Manual 112233AABBCC Serial numbers may be any length up to the maximum allowed Hexadecimal serial numbers must not include the Ox prefix or the H h suffix Page 40 Flash Magic GUI and Command Line Manual 6 17 Update Bootloader Some devices allow the bootloader to be updated via ISP This can only be performed using a special bootloader update hex file supplied by NXP Semiconductors Flash Magic supports these hex files If the currently selected device supports this feature then Update Bootloader on the ISP menu will be enabled Choosing the menu item displays the dialog window Update Bootloader Only use bootloader update hex files from Philips Semiconductors that are marked as compatible with this feature Failure to do so could ren
12. TEST2 HEX CHECKSUMS NOFILL Erases block 0 then programs a hex file then erases block 1 and programs the second hex file Checksums are generated for both Hex files Configuration directives may appear anywhere on the command line however all configuration directives are processed before any operation directives are processed Directive names are case insensitive Whitespace is ignored except when it is between directives where it is required All directives are optional When a directive is omitted the default setting for that directive is used All numeric values passed to directives may be passed in decimal or hexadecimal unless otherwise specified in the directive description Hexadecimal values are either preceded by Ox or have the suffix H or h Paths may contain spaces Paths may also contain newlines carriage returns and tabs however these characters are converted to spaces before the path is used allowing word wrapping at the spaces in paths Page 54 Flash Magic GUI and Command Line Manual 8 3 BLANKCHECK Description More than one allowed Type Syntax Output Default Example Performs a blank check For the 89LPCxx2 the blank check is performed on the entire block containing the start address the end address is ignored For ARM devices the start and end addresses must match with the start and end addresses of a flash block Yes Operation BLANKCHECK start
13. are TTL it is assumed DTR and RTS have already been passed through an RS232 transceiver Start of ISP operation starting the Bootloader T1 T2 o DTR RTS End of ISP operation executing firmware T1 T2 re po The final option when checked instructs Flash Magic to assert DTR and RTS whenever Flash Magic has the COM Port open This allows the possibility of the target hardware stealing power from the handshaking lines during ISP operations Note however that once Flash Magic closes the COM Port at the end of an ISP operation Windows deasserts the DTR and RTS signals Note that when selecting to keep RTS asserted while the COM Port is open or selecting to assert DTR and RTS while the COM Port is open and high speed communications is selected there will be pulses on the RTS and DTR signals just before the ISP operation This is because the high speed communications feature needs to reconfigure the COM port several times before the ISP operation is performed For each reconfigure Windows deasserts the DTR and RTS signals Flash Magic then immediately reasserts the DTR and RTS signals resulting in a pulse 89LPC9xXxx DTR and RTS need to be connected to VDD and RST of the device Currently Flash Magic only supports this feature with the Keil MCB 900 board however custom hardware will be supported at a later date To use check the option to Use DTR and RTS to enter ISP mode and select the correct
14. control STARTBOOTLOADER BREAK Where baudrate The baud rate to use One of 2400 4800 9600 19200 Page 77 Flash Magic GUI and Command Line Manual Output Default Examples 38400 57600 command The command to send to the device control Control characters to append to the command or NOCONTROL if no control characters are required One LFCR NOCONTROL Bootloader started Or Start Bootloader failed reason Where reason The reason the command failed No command is sent to the device STARTBOOTLOADER 9600 boot NOCONTROL STARTBOOTLOADER 0x2580 go to bootrom CR STARTBOOTLOADER BREAK STARTBOOTLOADER 9600 0D 02 NOCONTROL Transmits a carriage return followed by an STX STARTBOOTLOADER 9600 80 NOCONTROL Transmits 80H STARTBOOTLOADER 9600 14 NOCONTROL Delays for 20 x 100ms 2 seconds STARTBOOTLOADER 9600 0A NOCONTROL Delays for 10 x 100ms 1 second STARTBOOTLOADER 9600 amp 00 NOCONTROL Flushes the RX buffer STARTBOOTLOADER 9600 A amp 02B amp 01C NOCONTROL Transmits A waits for A to be echoed transmits B then transmits C and waits for C to be echoed STARTBOOTLOADER 9600 0D 14 amp 00A NOCONTROL Transmits a carriage return waits for 2 seconds flushes the RX buffer and transmits A Page 78 Flash Magic GUI and Command Line Manual 8 22 READCLOCKS Description More than one allowed Type Syntax Output Default Examp
15. devices biti code read protection Security bit programming complete Or Security bit programming failed reason Where reason The reason security bit programming failed No security bits are set Page 68 Flash Magic GUI and Command Line Manual Examples SECURITY 1 0x00 0x01 SECURITY OH 1 0x01 SECURITY 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 0 Page 69 Flash Magic GUI and Command Line Manual 8 14 STATUSBYTE Description More than one allowed Type Syntax Output Default Examples Programs the Status Byte with a new value Yes Operation STATUSBYTE value Where value new value for the Status Byte Status Byte programmed to value Or Status Byte programming failed reason value Where value The value the Status Byte was programmed to in hexadecimal prefixed with Ox reason The reason Status Byte programming failed The Status Byte is not programmed with a new value STATUSBYTE 128 STATUSBYTE 0x80 STATUSBYTE 80H Page 70 Flash Magic GUI and Command Line Manual 8 15 VERIFY Description More than one allowed Type Syntax Output Default Examples Verifies that an Intel Hex file has been programmed correctly into Flash Yes Operation VERIFY path checksums Where path Path of the Intel Hex File to verify checksums Set to CHECKSUMS if checksums were generated for the Hex File Set to NOCHECKSUMS if n
16. erase and click on the Erase button to erase them Page 34 Flash Magic GUI and Command Line Manual 6 12 Device Configuration Some devices allow configuration via ISP If the selected device supports this feature then the Device Configuration item on the ISP menu will be enabled When selected the current configuration will be read from the device and displayed in the configuration dialog window The configuration may then be changed and by clicking on Reprogram the new configuration will be programmed into the device The contents of the Configuration window will vary depending on the device selected The following image is the appearance of the 89LPC932 configuration window 89LPC9xx UCFG1 Enable Reset Pin V Enable Watchdog Safety V Enable Brownout Detection Clock Medium Frequency Crystal Resonator 100kHz 4MHz x Cancel Reprogram Some devices support protecting the device configuration along with the boot vector and status bit byte On these devices a Clear Config Protect button will be shown which when clicked will send the command to clear the protection for the configuration of the device Page 35 Flash Magic GUI and Command Line Manual 6 13 Cyclic Redundancy Check Some devices instead of a verify option provide a Cyclic Redundancy Check CRC option where the device can calculate a 32 bit CRC value for a single Flash Block or the entire device CRCs are a form of checksum therefo
17. in CAN CANopen and Embedded Internetworking For more information visit EMBEDDED SYSTEMS ACADEMY WWwW esacademy com Page 2 Flash Magic GUI and Command Line Manual Contents Coit htt ete ss eee eee ee eee ree er eeree eter 3 About This MaMe E cc cccccccccceecseeseesees eee eee eens reese esses eee eee tense ee ees eee eeeeeeeaneanesennens 6 Chapter 1 o E 7 Chapter 2 Minimum REqQUIFEMENTS cceccee ese ece eee ANNA eeeseeseeeeeeeeseeeeseeseesenetnsensenteneess 8 Chapter 3 User Interface TOur cccceccsccee cece eee eee eee ee eee eee eee eee eee eee eeeeeeenestaetaneaneaneanens 9 See o COW vc cscs cece T 9 RINE oo cs ccin vs avedendanchediar raviaw haves yetnmiia tea whata thea ees ees cae hetedoa denne T 10 MMMM A id s anc sla a E T E ctneele Sa E T T T 10 E ay o eoio eE E T 10 Chapter 4 Five Step ProgrAMmMing cccccecceceecseceeeeeeeeeeeeeeteeeseeeeeaeeeteetnetasenseaeeaneneess 11 4 1 Step 1 Connection SettingS ccccceentene erence ere e een e ene enn ERE EERO E 11 SMe ELOSING scccccccecceisersvectssaadeencerenenscnesewa edad cacueranieacestndsdeaceeestveneranneds ceed ee 13 4 3 Step 3 Selecting the Hex File ccccececseeceeeeeeeeeeeeeeeeseeeaeeaeeeteetastaseasetenneneegs 14 SEE OOLIONS sides caisridashacnnins dentiatsnninnessiaaduadents aaseaetnnontedeneaanadapaa nasa enaeancnigiak 15 4 5 Step 5 Performing the Operations ccccceeceseeceeeeeeeeseeeeeaeeseeseeeease
18. on the functionality of the device It is strongly recommended to consult the data sheet or user manual and understand the functionality of these bits before setting them Page 42 Flash Magic GUI and Command Line Manual Chapter 7 Advanced Options Advanced Options are accessed by selecting Advanced Options from the Options menu 7 1 High Speed Communications Some devices feature the ability to switch from the initial baudrate to a high speed communications mode allowing speeds higher than the autobaud method in the Bootloader would be able to accurately measure To enable the High Speed communications mode select the option in the Advanced Options window and select whether the device is operating in 6 clock mode or 12 clock mode if applicable Flash Magic will calculate the highest possible baud rate that may be used by both the device and the PC COM Port and automatically switch to it after connecting at the initial baud rate specified in the main window If you experience problems with this feature then try limiting how fast the high speed communications mode can go Select the maximum speed from the drop down list If in doubt select 9600 and start increasing until the problems appear 7 2 Half duplex Communications When communicating with the device Flash Magic can send and receive data at the same time to achieve the fastest data rate This type of transmission is called full duplex Turning the half duplex option
19. on will cause Flash Magic to only transmit one byte at a time waiting for the byte to be echoed from the Bootloader before transmitting the next byte While this will slow the data rate down it allows ISP to be performed via half duplex serial buses such as RS 485 and RS 485 derivatives such as J1708 Note however that you must design your hardware such that the PC and the Bootloader do not receive the bytes they transmit otherwise each will be confused 7 3 Hardware Configuration For some devices Flash Magic can control DTR and RTS to enter ISP mode or execute newly downloaded code To implement this requires a hardware design that supports controlling of the device using DTR and RTS The options for controlling this feature are accessed by clicking on the Hardware Config tab The options are different depending on the device selected in the main window The following subsections describe the options for different devices The advantages of this feature include Page 43 Flash Magic GUI and Command Line Manual e Faster development e ISP is now possible on hardware that is hard to reach or enclosed in a box e Removes the need for switches or jumpers on the hardware 89C51Rx2xx 89C6xX2 89C51Rx2Hxx 89C66x 89C51Rx XA Gx9 DTR and RTS need to be connected to RST and PSEN to allow Flash Magic to control the reset and ISP entry of the device The following simplified circuit diagram for an 89C51RD2 is one possible way of
20. record type address and a list of data The checksum in the record is checked to make sure it is correct Example import HexFile Page 110 Flash Magic GUI and Command Line Manual recordparts HexFile HexRecordToData record type recordparts 0 address recordparts 1 data recordparts 2 14 7 Examples Example scripts are provided on the Start menu for users of the Flash Magic Production System Page 111
21. reset the count Alternatively right clicking over the count provides a menu with the option to immediately reset the count Page 16 Flash Magic GUI and Command Line Manual Chapter 5 Block Checksum Generation 5 1 Introduction Often it is desirable for an application to be able to verify that the code about to be executed has not been altered or corrupted Attempting to execute altered or corrupted code will result in undefined or undesirable behavior This could translate to erratic signals appearing on the I O pins resulting in damage to hardware Flash Magic allows the easy generation of checksums for each Flash block that a programmed Hex file is stored in Flash Magic will write a value to the highest location in each block to ensure that when a checksum is calculated over the whole block using a specific method the checksum will be 55H The checksum calculation is OxFF Sum_of_all_bytes_in_block_truncated_to_8_bits 1 This is a method that is easy for an 8 bit microcontroller to perform Note that on devices such as the 89LPC9xx which do not support the reading of Flash memory for security reasons the checksum algorithm assumes the portions of memory not used by the hex file will be blank Therefore if other hex files have been programmed into the device the checksum will be incorrect As an alternative the 89LPC9xx offers a 32 bit CRC algorithm that may be read from the device then compared at run time The
22. some flexibility in the device names that are recognized Device names may optionally be prefixed with a P for NXP and 8x may appear in place of 89 See the examples DEVICE 89C51RC 10 000 DEVICE 89C664 16 124 DEVICE XA G49 12 662 DEVICE 89C668 20 118 DEVICE P8xC51RC 10 000 DEVICE 8xC664 16 124 DEVICE P89C668 20 118 Page 60 Flash Magic GUI and Command Line Manual 8 7 ERASE Description Erases individual flash blocks or the whole device More than one allowed Yes Type Operation Syntax ERASE type protectisp Where type The type of erase either a Flash block or the whole device If type is a value in the range 0 to 15 then that number Flash block will be erased If type is DEVICE then the whole device will be erased including security bits with the boot vector and status bytes set to default values protectisp Set to PROTECTISP to stop the ISP code from being erased in devices that contain the ISP code in the main Flash memory Set to NOPROTECTISP to allow the ISP code to be erased Ignored for other devices It is strongly recommended to set this option to PROTECTISP Output Erase complete type Or Erase failed reason type Where type The type of erase Either a number in the range 0 to 15 or a hexadecimal number in the range 0x00 to OxOF prefixed with Ox or DEVICE reason The reason erase failed Default No flash blocks are erased No security bits are erased N
23. the DLL Manual which is available on the Start menu for users of the Flash Magic Production System 14 5 Windows API The scripts environment contains support for a module called Windows Currently this is a very simple module that allows a script to prompt the user for a file to open or for a location to save a file to GetOpenFileName Example to prompt the user for a file to open Page 109 Flash Magic GUI and Command Line Manual import Windows filename Windows GetOpenFileName if len filename print You must select a file to open return print File name filename GetSaveFileName Example to prompt the user for a location to save to import Windows filename Windows GetSaveFileName if len filename 0 print You must select a file to save to return print File name filename Note that these functions do not actually open or save files 14 6 HexFile API The scripts enviroment contains support for a module called HexFile This module contains functions for manipulating Intel hex records DataToHexRecord This function converts record type address and a list of data into a hex record The checksum is automatically calculated Example import HexFile type 0x01 address 0x1000 data 0x11 0x22 0x33 record HexFile DataToHexRecord type address data HexRecordToData This function converta a hex record in the form of a string into
24. 1 STARTBOOTLOADER Description More than one allowed Type Syntax Specifies that a command or break condition should be sent to the device to start the Bootloader This requires support in the currently executing application For commands the baud rate to use for communicating with the device note that a baud rate different to the one specified with the COM directive may be used must be specified The COM port used is specified with the COM directive Whether to use half duplex communications or not is specified with the HALFDUPLEX directive To send a break condition pass the word BREAK to the directive Special characters may be inserted into the command to provide additional functionality They consist of a special character followed by two hexadecimal characters and have the following meanings HH _ transmit the character HH where HH is the hexadecimal value of the character HH delay for HH x 100ms where HH is a hexadecimal value amp AA command The function of the command depends upon the hexadecimal value AA and currently can be one of the following 00 flush RX buffer 01 echo on 02 echo off 03 send break condition By default at the start of a command the echo is on Regardless of whether the echo is on or off when the end of a command is reached the device must return a to indicate the command was successfully received No Configuration STARTBOOTLOADER baudrate command
25. 2 if Flash block 0 has the correct checksum Checksum c and checksum h are not specific to any particular hardware and may be used in your own applications Page 18 Flash Magic GUI and Command Line Manual 5 3 Using the Example Checksum Code The function calc_checksum has the following prototype unsigned char calc_checksum unsigned char block Passed O to check Flash block 0 0000H 1FFFH 1 to check Flash block 1 2000H 3FFFH 2 to check Flash block 2 4000H 7FFFH 3 to check Flash block 3 8000H BFFFH 4 to check Flash block 4 COOOH FFFFH Returns 1 if the block is valid has the correct checksum O if the block is invalid it has been altered or corrupted It is essential that the highest location in each block is reserved for the checksum adjuster value and is not used by the application It is easy to reserve individual locations in both the Keil Raisonance and Tasking Compilers however for convenience the following macros have been defined Simply use one of the macros somewhere in the project for each of the Flash blocks used by the application It will be replaced with the necessary line of code to reserve that location RESERVE_BLOCKO_CHECKSUM RESERVE_BLOCK1_CHECKSUM RESERVE_BLOCK2_CHECKSUM RESERVE_BLOCK3_CHECKSUM RESERVE_BLOCK4_CHECKSUM The macros are defined in checksum h If using In Application Programming be sure not to modify any location in a Flash block where
26. 44 SOLPC OK amanar nta wie awnvaais oe a des tira weer eteaea tenes Ceaeue sansa ee ees E marin anes 45 Flash Magic GUI and Command Line Manual LPC2XXX ee bins cody eas ceed cise eaedy cen cane elek E EREET ANRE E EEEN E EEEN 46 SOVSIRK2 BSOLVSURK 2 ws csscssesnevesersaansaal sistas amivinnina esse sntriaiinsaraainadssbeimindsewssnnanaeeanen 48 774 PHOLOCt SP ccicivics saceeaseasiencavitesemaceassence deserved cidenessvataneseneas sienseneiaereneaes ERE RUNERNE NNA 49 7 5 JUSU TN Time Code seiecievictsxss avis ethawie sand NANANA besa Wiadalev vee RARE 50 7 6 TIMEOUTS ccsactiascrsiinevancnetnrmnrides aver eimai amie reeves d uatea eaten NA EEA AE Yano ER 51 TD MISC fea cieersiesianssecscaesac aantwenveterehadeansertud AR p Nena paii beads Hert seneaderaemeaaaaennTen 52 Chapter 8 Command Line Interface ccc cece eee nner e ene 53 8 L ANCrO GI CON era a age ex EAEE E 53 8 2 Running Flash Magic on the Command Lin ceceeeeeee eee e eee eee eee teeta seat eeaenaes 53 8 3 BLANKCHECK sis sii cwcsesstsntens eviews ANENE sive ENARE ARANI NA bisa ves baer aan eines ees 55 8 4 BOOTVEGTIORS mietecs ernen iaaiaeiees tenets uretceiiarsoueinevaawhs weageneiacrsetatuinnous series ov aeian va 56 875 COM wciiscitesaitdaceiecistsawns nai aigateistac sid cieasaiagienieninbiaaaaihd Pabiagaehaeritentaeuidiegiedsesiariees 57 8 6 DEVICE seiss tenviuns anann NENEA NTRA ENNA NNA KANRA oti cone vea reeves eek exe NEESON REASTA 58 8 7 ERASE caasar aE a a
27. ARERESET directive use HARDWARE BOOTEXEC 100 100 No Configuration HARDWARE config t1 t2 where config The configuration of the signals One of BOOTEXEC DTR and RTS are used to control PSEN and RST or P0 14 and RST t1 and t2 are required BOOTEXECRTS DTR and RTS are used to control PSEN and RST or P0 14 and RST RTS remains asserted while the COM Port is in use by Flash Magic t1 and t2 are required ASSERT DTR and RTS are asserted while the COM Port is in use by Flash Magic ti and t2 are not required KEILMCB900 DTR and RTS are used to generate the necessary signals to place a device on the Keil MCB 900 board into ISP mode t1 Period for time t1 in milliseconds t2 Period for time t2 in milliseconds None DTR and RTS are not used HARDWARE BOOTEXEC 50 100 HARDWARE BOOTEXECRTS 200 250 HARDWARE ASSERT Page 81 Flash Magic GUI and Command Line Manual HARDWARE KEILMCB900 250 120 Page 82 Flash Magic GUI and Command Line Manual 8 25 READCRC Description Reads the CRC of a block or the entire device More than one allowed Yes Type Operation Syntax READCRC type Where type The Flash to read the CRC of either a Flash block or the whole device If type is a value in the range 0 to 15 then the CRC of that number Flash block will be read If type is DEVICE then the CRC of the whole device will be read Output CRC result type Or CRC read failed reas
28. FFFFFFFFFFFFFFFFFFF D agi Ox0000 Ox3FFF 024000 Ox7FFF 0 xB FFF OxCOO0 OxFFFF Each line shows 16 bytes of data starting at the address given at the start of the line If a line contains question marks then data has not yet been read in for those locations The memory is read in in the background allowing viewing of the memory that has been loaded in without having to wait for all of it to be read At any time a new range may be selected or the window closed Each line shows the 16 bytes of data first in hexadecimal format then in ASCII format For characters that are not printable a period is displayed instead Page 26 Flash Magic GUI and Command Line Manual 6 7 Erasing Flash There are two ways Flash can be erased Either as part of the five step process described earlier in this manual or without performing any other ISP operations by choosing Erase Flash from the ISP menu The Erase Flash window will be opened Its operation is identical to the erase section in the main window Once settings have been chosen click on the Erase button to erase Erase Flash E xj Erase block 0 00000 0 0FFF Erase block 4 0x4000 0x4FFF Erase block 5 05000 0x5FFF zi I Erase all Flash Security Bits Clk Close Erase Progress information is displayed at the bottom of the window Page 27 Flash Magic GUI and Command Line Manual 6 8 Verifying a Hex File A Hex File can be ver
29. FIG iicieiiciiei criti eid tet tei AKANE tiie sits ll 86 8 29 STATUSBIT ic ccicccccectsctentasieeresseistsevistanieeiesieessrnanerraseiiores as a a 87 8 30 READSTATUSBIT 0 cccccccistsesietseseeserssissiseessetsevseninisieerieiseneni a 88 8 31 EXECUTE viii sci cect teeteiieti evict ANNA NAKANE ASEAS anana a a a 89 8 32 TIMEOUT wacieieesccicscerietissiesestersessenis AN AAPEEE NRE aie annaa a Vl 90 8 33 ERASEUS ED ccc isesussisscsecstisesevscosuser ERNEA AAA ENE a a aaa nn 91 8 34 READADDLSECURITY cc ecieeseeeeeet eer eeeee terse se IIE serene snes ro plmeeine neem 92 8 35 ADDLSECURITY ernn a a a a ae RE onic EE 93 8 36 READMISR i ccccciceseeseesesseseesetseesesereeeiesee cesses M oi aaao a o EEE 94 8 37 READEEPROMSECURITY c cc eceesseeseeesteetertessessersererrnr rst EEEE s e e e a e ea 95 8 38 EEPROMSECURITY c cccseccescescsecesceesecesessesscsecesstertes a a a REREN a 96 8 39 ERASEEEPROMPAGE ssssrrsrrrrrrnranrnannnnannnnannnnnnananan anann aaa a REREEEREEREEREEIN 97 8 40 READEEPROMCRC ccciseteeteesesseeeeteeeestestessossetectectesss a OREREEEREEEEEREEIN gt 98 8 41 EEPROMHEXFILE cccccsecceseeeesecesceeseeneeseessesecnecter ees sss OOO a n o 99 8 42 INTERFACE ccccsccecssceeeseeseeeeeeeseeteesseseetsetssssessssssees cess seo 100 Page 4 Flash Magic GUI and Command Line Manual Chapter 9 89LPC9Oxx Recommended SettingS cceececee eee e teen
30. Flash Magic GUI and Command Line Manual Manual Revision 1 63 EMBEDDED SYSTEMS ACADEMY Flash Magic GUI and Command Line Manual Information in this document is subject to change without notice and does not represent a commitment on the part of the manufacturer The software described in this document is furnished under license agreement or nondisclosure agreement and may be used or copied in accordance with the terms of the agreement It is against the law to copy the software on any medium except as specifically allowed in the license or nondisclosure agreement No part of this manual may be reproduced or transmitted in any form or by any means electronic or mechanical including photocopying recording or information storage and retrieval systems for any purpose other than the purchaser s personal use without prior written permission Every effort was made to ensure the accuracy in this manual and to give appropriate credit to persons companies and trademarks referenced herein Embedded Systems Academy Inc 2000 2009 All Rights Reserved Microsoft and Windows are trademarks or registered trademarks of Microsoft Corporation PC is a registered trademark of International Business Machines Corporation For support contact support esacademy com For the latest news on Flash Magic visit us at www esacademy com software flashmagic Embedded Systems Academy provides training and consulting services specializing
31. IGNATURE Output The results are listed with each signature byte on a separate line with the format byte value Or Signature read failed reason Where byte Manufacturer ID or Device ID 1 or Device ID 2 or Device ID value The value of the signature byte in hexadecimal prefixed with Ox reason The reason signature read failed Default The signature bytes are not read Example READSIGNATURE Page 67 Flash Magic GUI and Command Line Manual 8 13 SECURITY Description More than one allowed Type Syntax Output Default Sets the security bits Note you cannot unset the security bits with this directive Instead the ERASE directive must be used performing a full device erase or block erase depending on the device Yes Operation For devices with one two or three security bits SECURITY bit1 bit2 bit3 Where bit1 Set to 1 to set security bit 1 set to 0 to keep it unset bit2 Set to 1 to set security bit 2 set to 0 to keep it unset bit3 Set to 1 to set security bit 3 set to 0 to keep it unset For devices with three security bits per block SECURITY blockObit1 blockObit2 blockObit3 block1bitO block1bit1 sea Where blockObitO Set to 1 to set security bit 0 of block 0 set to 0 to keep it unset blockObit1 Set to 1 to set security bit 1 of block 0 set to 0 to keep it unset blocknbit2 Set to 1 to set security bit 2 of block n set to 0 to keep it unset For the ARM
32. LPC2xxx devices do not support this feature Page 17 Flash Magic GUI and Command Line Manual 5 2 Checksum Demonstration Project Included in the Flash Magic installation is a folder called ChecksumDemo that contains an example project using a pre written checksum calculation routine that may be used in your own applications The 8051 folder contains examples for the Keil and Raisonance 8051 C Compilers The XA folder contains examples for the Tasking and Raisonance XA C Compilers The files in the 8051 projects are Description Main c Application source file containing the main function Checksum c Source file containing the checksum calculation function Checksum h Header file for the checksum source file Kchecksumdemo uv2_ Keil uVision example project file Rchecksumdemo prj Raisonance RIDE example project file Kchecksumdemo hex Keil generated Hex File Rchecksumdemo hex Raisonance generated Hex File The files in the XA projects are Description Main c Application source file containing the main function Checksum c Source file containing the checksum calculation function Checksum h Header file for the checksum source file Rchecksumdemo prj Raisonance RIDE example project file Tchecksumdemo pjt Tasking example project file Rchecksumdemo hex Raisonance generated Hex File Tchecksumdemo hex Tasking generated Hex File The example is written for the Phytec phyCORE development boards and turns on both LEDs Di and D
33. Line Manual Chapter 11 Settings Files Although the settings made in Flash Magic are automatically saved when Flash Magic is closed it is possible to save the settings in separate Flash Magic Settings files extension fms allowing easy use of Flash Magic when using many different targets at the same time To save the current settings in a file choose Save Settings from the File menu To open a settings file either choose Open Settings from the File menu or double click open the settings file Page 103 Flash Magic GUI and Command Line Manual Chapter 12 Miscellaneous Features and Options 12 1 Enabling and Disabling Embedded Hints Update The Embedded Hints are the constantly changing internet links displayed at the bottom of the Flash Magic main window The Embedded Hints update feature allows Flash Magic to periodically check for and download new hints that contain useful information such as e Alerts telling you a new version of Flash Magic is available e Upcoming events where you can meet NXP and Embedded Systems Academy e Alerts telling you about new Flash programming related items available on the ESA web site The update feature does NOT transmit any personally identifiable information The Embedded Hints update feature can be turned off by choosing Disable Hints Update from the Options menu It can be re enabled at any time by choosing Enable Hints Update from the Options menu Note that with
34. RAM and using specific options or modes for example the ARM devices To perform a Go operation and start execution choose Go from the ISP menu Enter the address to start execution from and choose the mode to execute in Click on Go to start execution Optionally enter a delay in milliseconds to cause Flash Magic to pause between sending the Go command and closing the COM port This is useful when executing from RAM with an LPC2xxx device and closing the COM port may reset the device due to DTR and RTS being used Page 38 Flash Magic GUI and Command Line Manual 6 16 Serial Number Some devices provide a serial number feature which protects access to the device via ISP If a serial number is supplied to the device then on the next reset the device will block most ISP operations until it is unlocked by supplying the correct serial number The serial number may be reset however this will usually result in the device being erased stopping unauthorized access to the code Check the device datasheet for the exact details of the implementation If the selected device supports serial numbers then the Serial Number item on the ISP menu will be enabled Selecting it displays the serial number window Serial Number Sg x Set Serial Number Enter Serial Number paeen fasci Re enter Serial Number iene Set Serial Number m Reset Serial Number WARNING Resetting the serial numbe will erase the device Reset
35. a checksum is being used otherwise calc_checksum will return indicating the block is invalid Page 19 Flash Magic GUI and Command Line Manual Chapter 6 Additional ISP Features 6 1 Saving a Hex File Once connected choosing Save As from the File menu opens the Hex File save window File Save Ea From Ox 0000 To Oxj1FFF Hex File CAESA Utilties FlashMagic Windows temp hex i z Cancel Save SS It is possible to save a section of Flash memory to a Hex File Enter the start address and the end address inclusive that you wish to save Note that the start and end addresses do not have to correspond to a Flash block If desired you can save a single memory location by entering it as both the start and end address Next select the location and name of the Hex file to save by either entering a path in the text box or clicking on the Browse button and browsing to a folder Finally click on the Save button to begin the save Progress information on the save will be shown at the bottom of the window Page 20 Flash Magic GUI and Command Line Manual 6 2 Blank Check Choose Bank Check from the ISP menu to perform a blank check on all the Flash blocks present on the device Once complete the Blank Check window will look something like the following 0 0x0000 0x0FFF 1 0 1000 0 1 FFF 2 0 2000 0 2F FF 3 03000 0 3FFF 4 0x4000 0 4FFF I Mark non blank blocks to be erased The
36. agic GUI and Command Line Manual 3 2 Menus There are five menus File ISP Options Tools and Help The File menu provides access to loading and saving Hex Files loading and saving settings files and exiting the application The ISP menu provides access to the less commonly used ISP features The Options menu allows access to the advanced options and includes an item to reset all options The Tools menu provides features that support the operation and use of Flash Magic The Help menu contains items that link directly to useful web pages and also open the Help About window showing the version number The Loading and Saving of Hex Files and the other ISP features are described in the following sections 3 3 Tooltips Throughout the Flash Magic user interface extensive use has been made of tooltips These are small text boxes that appear when you place the pointer over something and keep it still for a second or two 1M Set Security Bit 1 F S Security bit 1 When set writing to Flash is disabled Note that tooltips do not appear for items that are disabled grayed out 3 4 Saving Options The options in the main window and the Advanced Options window are automatically saved to the registry whenever Flash Magic is closed This removes the need for an explicit save operation When Flash Magic is restarted the main window and the Advanced Options window will appear as you left it so you do not have to repeatedly make
37. anual 6 14 MISR Some devices instead of a verify option provide a MISR option where the device can calculate a 128 bit MISR value for a single Flash Block or the entire device MISR values are a form of checksum therefore if the contents of the memory change there is a very high probability the MISR value will also change If the selected device supports MISR values then the Read MISR item on the ISP menu will be enabled Selecting it displays the MISR window which is functionally identical to the CRC window described in the previous section When the window is first opened the MISR value is read from the device for each Flash Block and the entire device These values are shown in the Device MISR column Click on the Add button and select each of the Hex files programmed into the device Each Hex file will appear in the list at the bottom of the window To remove a Hex file from the list select it in the list and click on the Remove button Click on the Calculate MISR button to calculate the MISR values for each block and the whole device as if the chosen Hex files were programmed into the device These values will appear in the Hex Files MISR column If the contents of the device exactly match the contents of the chosen Hex files then the MISR values on each row of the table will match Page 37 Flash Magic GUI and Command Line Manual 6 15 Go Some devices support executing from specific addresses in flash or
38. aracter datafilepath userfilepath option datafilepath The path to the data file that the JIT Module should generate containing the data to program into the device userfilepath The path to the user file where an ASCII string that will be displayed to the user can be stored Leave empty or don t create if no message is required The message is shown after the JIT Module has finished executing option One or more optional parameters entered by the user that may be used by the program The format of the data file is the same as an Intel Hex File Only record types 00H and 01H are allowed however The terminating record is optional The JIT Module must return a zero for failure or a one for success In C this is achieved by returning the value from the main function Free PC Compilers are available from http www idiom com free compilers and http www borland com To configure the Just In Time feature click on the Just In Time Code tab in the advanced options Enter the path and filename of the JIT Module into the box or click on the Browse button to browse to the file Enter any options desired separated by spaces If no options are required then leave the box empty Enter the maximum run time of the JIT Module in seconds into the final box If the JIT Module does not finish executing within this time then Flash Magic will give up waiting and return an error 7 6 Timeouts In the Timeouts section the timeouts Flas
39. c All output from the script is displayed in a window and the user can be prompted for any input needed for example entering test parameters or choosing from a menu of options Scripts can also have user defined parameters passed to them allowing a script to be fully automated but with customizable options 14 2 Getting Started The scripts interface is available by choosing Scripts from the Tools menu Page 107 Flash Magic GUI and Command Line Manual Script File C Documents and Settings 4ndy Desktop ErasePageParam py Browse l Parameters 3 Clear Output Close Choose the script file to run by clicking on the Browse button Enter any necessary parameters into the Parameters box and click on Run The script can be stopped at any time by clicking on the Stop button The output from the script appears in the Output box and user input goes into the Input box To send input to the script either press Enter Return or click on the Enter button 14 3 Script Execution A minimal script defines two functions Cancel and Main The Main function is executed when the user clicks on the Run button The Cancel function is executed when the user clicks on the Stop button Here is a minimal script that prints Hello World import FlashMagic specify driver to use FlashMagic Driver flashmagic dll global cancel flag cancel 0 def Cancel global cancel cancel 1 Page 108 Fla
40. ceve denied va ttvarstedite E siuieeee nem 109 GetO pen FileNaMe ys isiviicscvsdvsaeiesty voesevadsse tear sevieabeadessssessGsiasbeveds esses stussssaebiaxseasce 109 GetSaveFileNaMe ois cccciscsccveeeies case vee AN ENNEA ERN KE due RARER edie eae eee eed NNE 110 14 6 HexFile A Plesitevestcateisiandiet ieteciueateattaviatduenterstaieaviciensiucresaiea boateunnastueeina entered 110 DataTOHexReCOMr aoee nner Ea ave ceacbs ans EA EEEE EANA E A ARA AE TERERAA 110 HexXRecoOrdTOData sssrinin eeen aid SNARERE EENAA NRERIN RRA 110 14 7 Example aE A A RAET 111 Page 5 Flash Magic GUI and Command Line Manual About This Manual This manual follows some set conventions with the aim of making it easier to read The following conventions are used Ox Hexadecimal base 16 values are prefixed with Ox italictext Replace the text with the item it represents Items inside and are optional a b a OR b may be used ses One or more items may go here Page 6 Flash Magic GUI and Command Line Manual Chapter 1 Introduction NXP Semiconductors produce a range of Microcontrollers that feature both on chip Flash memory and the ability to be reprogrammed using In System Programming technology Flash Magic is Windows software from the Embedded Systems Academy that allows easy access to all the ISP features provided by the devices These features include Erasing the Flash memory individual blocks or the whole device Programming t
41. connecting the DTR and RTS signals to RST and PSEN of the device Note that minor changes would have to be made to use this circuit with the XA devices VCC PSEN 5 _ RTS i RST 3 w S DTR 3 v TxD S r lt n n ce RXD RXD VSS Notes When the COM Port is not in use or the serial cable is not connected the RS232 signals are pulled low by the transceiver This results in the TTL signals being high Therefore when the TTL DTR and RTS signals are high PSEN must be weakly pulled high and RST must be left to float so it can be asserted by the device and or reset circuit PSEN must be weakly pulled high to ensure the device can assert it The 10uF capacitor and 10k resistor form the reset circuit in this example circuit By checking the option to assert RTS while the COM Port is open the RTS signal will remain asserted while the ISP operation is performed This allows hardware to be designed that can reset or reconfigure hardware for an ISP operation Ti and T2 are timing values for the waveforms Flash Magic generates with the DTR and RTS signals Entering values in milliseconds into the boxes may configure these timings Note however that the timings are approximate as they depend on what other applications are running in Windows and how fast the PC is Page 44 Flash Magic GUI and Command Line Manual The following timing diagrams show how T1 and T2 are used Note that the signal levels
42. der your device unusable Bootloader Update Hex File C hexfiles 89L 51 RD 2B ootloaderU pdate hex Browse Simply select the bootloader update hex file by entering the path to the file or clicking on the Browse button to select it Click on Update to start the update process Status information will be shown at the bottom of the dialog window Once complete Flash Magic will indicate that the bootloader was updated or the reason why the update failed Only use special bootloader update hex files supplied by NXP Semiconductors that are created for this feature Do not interrupt the power supply or reset the device during the update Failure to follow these warnings may result in a device that no longer has a functional bootloader Page 41 Flash Magic GUI and Command Line Manual 6 18 Additional Security Bits Some devices support additional security bits that are not related to specific section of Flash memory If the selected device has this feature then the Additional Security Bits option on the ISP menu will be available Choosing the option will display a dialog window showing the additional security bits for that device When the window is opened the current settings for the security bits will be read from the device and displayed in the window Checking a security bit will set that bit Unchecking a security bit will attempt to unset it Note that setting these security bits may have significant repercussions
43. device This will force any downloaded code to be executed Page 29 Flash Magic GUI and Command Line Manual 6 10 Start Bootloader Start Bootloader Description The Start Bootloader feature allows a textual command or break condition to be sent to the device to place it into Bootloader mode In order for this to work however it must be supported by the user s application or the device For textual commands the user s application must watch the UART for the command to be received Once received the application must echo back the command and a single full stop then use In Application Programming to program the Boot Vector to the default and the Status Bit Byte to non zero and then reset the device Once the device completes the reset the Bootloader will be executed allowing the device to be reprogrammed If a break condition is sent then Flash Magic does not expect the break condition to be echoed back and assumes the device has been placed in Bootloader mode Choosing Start Bootloader from the ISP menu accesses the Start Bootloader feature The following dialog window will be displayed Send Command Start BootROM Command boot Baud Rate 3600 M Append to Command Nothing Carriage Return ASCII 13 C Line Feed ASCII 10 Carriage Return followed by Line Feed Line Feed followed by Carriage Return C Send Break Condition not the BootROM before using the Start BootROM feat
44. displayed Status Byte x Below are shown the current settings If you wish to change them then make the changes and click on Reprogram Note that FlashMagic ALWAYS sets the Status Byte to 0x00 after programming a Hex file Also note that after performing a full Flash erase the Status Byte is set to OxFF Status Byte Cancel Reprogram Modify the settings as desired and click on the Reprogram button Page 25 Flash Magic GUI and Command Line Manual 6 6 Displaying Memory A useful feature is the ability to view the contents of memory Choosing Display Memory from the ISP menu accesses this feature Memory is shown one block at a time The block being displayed may be selected from the drop down list at the bottom of the Display Memory window Display Flash Memory x 02000375810AE4787FF6D8FD900074E4 937002804EC31392D5C31392D1FFA3E4 p 93F8B0D5402130D505E44393F5A0E420 D102A39320DS07F608DFF3A380D1F208 B8O0F60SA080F2E8030303541F2420F9 E8S407F8E4D333B80002800333D8FD47 T F780D87SA0FFO2006985088385098274 FFFOS80FE0808FFAQO0FFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFF
45. ds the UCFG1 byte For devices that support UCFG1 and UCFG2 both bytes are read Yes Operation READCONFIG Configuration value Or Configuration UCFG1 value UCFG2 value Or Configuration read failed reason Where value The configuration in hexadecimal prefixed with Ox reason The reason the erase failed The configuration is not read READCONFIG Page 85 Flash Magic GUI and Command Line Manual 8 28 CONFIG Description More than one allowed Type Syntax Output Default Examples Configures a device if supported by the device For the 89LPC9xx bits 0 7 configure UCFG1 For devices that support UCFG1 and UCFG2 bits 0 7 configure UCFG1 bits 8 15 configure UCFG2 Yes Operation CONFIG value Where value The value for the configuration Device configured value Or Device configuration failed reason value Where value The configuration value as passed to the directive reason The reason the erase failed The device is not configured CONFIG 0x11223344 CONFIG 5 Page 86 Flash Magic GUI and Command Line Manual 8 29 STATUSBIT Description More than one allowed Type Syntax Output Default Examples Programs the Status Bit with a new value Although an 8 bit value can be passed only bit O is used Use for those devices that implement a Status Bit as opposed to a Status Byte such as the 89LPC932 Yes Operation STATUSBIT
46. e Boot Vector is not read Example READBOOTVECTOR Page 73 Flash Magic GUI and Command Line Manual 8 18 READSTATUSBYTE Description More than one allowed Type Syntax Output Default Example Reads the value of the Status Byte Yes Operation READSTATUSBYTE Status Byte value Or Status Byte read failed reason Where value The value of the Status Byte in hexadecimal prefixed with Ox reason The reason the read failed The Status Byte is not read READSTATUSBYTE Page 74 Flash Magic GUI and Command Line Manual 8 19 HALFDUPLEX Description When used Flash Magic waits for each byte to be echoed back before sending the next byte allowing half duplex buses such as J1708 to be used with ISP More than one allowed No Type Configuration Syntax HALFDUPLEX Output None Default Full duplex communications are used Example HALFDUPLEX Page 75 Flash Magic GUI and Command Line Manual 8 20 RESET Description More than one allowed Type Syntax Output Default Example Resets the device If the device has been successfully programmed then the new code will be executed Only supported on Rx2 and 66x families revision G or higher Yes Operation RESET Reset complete Or Reset failed reason Where reason The reason the reset failed The device is not reset RESET Page 76 Flash Magic GUI and Command Line Manual 8 2
47. ecurity Bits Select each Flash block that you wish to erase by clicking on its name If you wish to erase all the Flash then check that option If you check to erase a Flash block and all the Flash then the Flash block will not be individually erased If you wish to erase only the Flash blocks used by the hex file you are going to select then check that option For most devices erasing all the Flash also results in the Boot Vector and Status Byte being set to default values which ensure that the Bootloader will be executed on reset regardless of the state of the PSEN pin or other hardware requirements Only when programming a Hex File has been completed will the Status Byte be set to OOH to allow the code to execute This is a safeguard against accidentally attempting to execute when the Flash is erased On some devices erasing all the Flash will also erase the security bits This will be indicated by the text next to the Erase all Flash option On some devices erasing all the Flash will also erase the speed setting of the device the number of clocks per cycle setting it back to the default This will be indicated by the text next to the Erase all Flash option Page 13 Flash Magic GUI and Command Line Manual 4 3 Step 3 Selecting the Hex File This step is optional If you do not wish to program a Hex File then do not select one Hex File E ESASE val Boards LPC932 Blinky breakdetect hex l Modified Tuesday February 4 2003
48. eee e eens eae ea eee e nee 101 9 1 Baud RAM E ccccccecceccesseeceeseee eee ee nesses seen sense eens ees eeeeeeeseneneanesenseneneanes 101 9 2 ISP Ent igyMeeemts eee ce cece cee ee cence eee ree nen esas eeeeeaeeagenaeeeaeeseeanaeeaeenaesasengaraneegneas 101 9 3 OScilla t MBRCGWEMGVA cccceccceteeeseeseeeneeteeteeeeeeseeebeeteebeeteebeessseetsebeetenbeetsnnseeenes 101 Chapter 10 FlaShMagic ANd IDES eect nnn 102 10 1 Tn trOCGtHOINMPMM cee cc cece eee sceeceseescesceeeeseessuseesensseeeseesseeseseesensenaneananes 102 POPZ KeiUVISION BRBROPROREE s esccsccscesteceectsceecescustestectestsctscusdestesbesbestentecnssesnes 102 Chapter 11 Settings Files BRM rereee c cccsecseccescescesceseessesseceecesessoesoessnsneceeceneeseeseesans 103 Chapter 12 Miscellaneous Features and OPtions cccceccecee cece eee ee estes eee ea eee eeaeeaenees 104 12 1 Enabling and Disabling Embedded Hints Update cccceeeceeee ee eee eee eeaeeaeees 104 Chapter 13 Terminal Interface ccccceccsceseeeceeceeeseeeeeseeeeeeesesserseeseteeteetessesseneenanes 105 MMMM ES OClIDUS 2 scivcivcisiitscccisevecsbansaatagsateadevaeteastangasiaalatines states teatsabiadavedveaseaadas 107 LAL EnV oa vais cscs e csiecie tnetcenian ea neha eine deine nh ad enh 0K aie ew T 107 merece SLAC E ioe diateaviatieciacs Os Wekatsadiaiatieet Meade eeareas 107 14 3 SCr ot ets ee ee ee 108 14 4 BIS Ele ea a ie ne nen eee eee 109 Meme S APL E arite
49. ential to erase or corrupt the ISP code Any attempt to perform one of these operations will result in Flash Magic asking for confirmation first Erasing or corrupting the ISP code will immediately render the ISP functionality of the device non functional IT IS STRONGLY RECOMMENDED TO LEAVE THE PROTECT ISP OPTION TURNED ON 7 5 Just In Time Code Just In Time Code is a powerful feature which allows Flash Magic to call a custom 3rd party program called a JIT Module that generates last minute code or constant data to be programmed into the device Uses for this system include Serial Number generation Copy Protection generate authorization codes via the Internet Programmer information Date and Time Lookup Table generation Language tables The JIT Module can be written using any language or development tools available for PCs and may access files on the local machine or Internet to generate the data The JIT Module must run from the Command Prompt or DOS Command Line The command line syntax is as follows executablename commandfilepath where executablename The path and name of the JIT Module commandfilepath The path to a command file that describes where to place the data where to place output for the user to see and any optional parameters supplied by the user Page 50 Flash Magic GUI and Command Line Manual The command file is an ASCII file with the following format each line terminated with a linefeed ch
50. equire osc freq 89LPC914 does not require osc freq 89LPC918 does not require osc freq 89LPC920 does not require osc freq 89LPC921 does not require osc freq 89LPC922 does not require osc freq 89LPC9221 does not require osc freq 89LPC930 does not require osc freq 89LPC931 does not require osc freq 89LPC932 does not require osc freq 89LPC932A1 does not require osc freq 89LPC933 does not require osc freq 89LPC934 does not require osc freq 89LPC935 89LPC938 89LPC9102 does not require osc freq 89LPC9103 does not require osc freq 89LPC9107 does not require osc freq 89LPC964 does not require osc freq 89LPC966 does not require osc freq 89LPC9321 does not require osc freq 89LPC9351 does not require osc freq LPC2129 LPC2194 LPC2292 LPC2294 LPC2119 LPC2101 LPC2102 LPC2103 LPC2104 LPC2105 LPC2106 LPC2109 LPC2114 LPC2124 LPC2212 LPC2214 LPC2131 LPC2132 LPC2134 LPC2136 LPC2138 LPC2141 LPC2142 LPC2144 LPC2146 LPC2148 Page 59 Flash Magic GUI and Command Line Manual Output Default Notes Examples LPC2210 LPC2220 LPC2290 LPC2364 LPC2366 LPC2368 LPC2378 LPC2468 frequency oscillator frequency in MHz in decimal only Device selected Or Device selection failed reason Where reason The reason device selection failed 89C51RD2Hxx device with OMHz oscillator frequency DEVICE 89C51RD2Hxx 0 There is
51. for the replaying of inputs simply by copying it saving it in a file for pasting later and perhaps adding delay characters if needed To change the settings choose Settings from the Options menu To one or both of the input and output areas choose the relevent entry from the Options menu The COM port is open whenever the terminal window is open so there is no need to click on connect or disconnect buttons Window content and settings are retained when the window is closed allowing quick and easy switching between the terminal window and the ISP operations of Flash Magic Page 106 Flash Magic GUI and Command Line Manual Chapter 14 Scripts The Flash Magic Production System contains support for scripts written in the Python programming language The scripts can be executed by Flash Magic and have full access to the low level API allowing any ISP operation to be performed This allows automated testing and programming to be performed for example on a production line Simple scripts may be combined into more complex test scripts culminating in compelete test suites Scripts are simple ASCII files that can be easily shared between users 14 1 Environment The scripts environment uses Python 2 4 with the complete standard libraries available This allows scripts to not only perform ISP operations but generate test report files construct custom hex files access the internet for test data commands or download hex files et
52. h Magic should use when performing ISP operations are specified Normally default settings are used however if you wish to change the timeouts then check the option to use my timeouts and fill in the values in the boxes Flash Magic uses two timeouts regular and long Each timeout is specified in seconds The regular timeout is used for most ISP operations The long timeout is used for erasing and performing blank checks Page 51 Flash Magic GUI and Command Line Manual The default settings are four seconds for the regular timeout and 60 seconds for the long timeout It is strongly recommended to use the default settings If you are using a USB to COM port converter then you may find that increasing the timeouts will resolve communication problems that are sometimes present with those converters 7 7 Misc In the Misc section miscellaneous settings relating to Flash Magic can be found Flash Magic includes the ability to play a Wave file when programming is completed To do this check the option to play a Wave file then either enter the path to the Wave file into the box or click on the Browse button and select the Wave file To hear the Wave file click on the purple arrow If a device is encountered with an incorrect set of signature bytes it is possible to turn of the signature checking by checking the Disable device signature checking option Please report any incorrect signature bytes to support esacademy com Please include
53. hardware from the drop down list Ti and T2 are timing values for the waveforms Flash Magic generates with the DTR and RTS signals Entering values in milliseconds into the boxes may configure these timings Note however that the timings are approximate as they depend on what other applications are running in Windows and how fast the PC is Page 45 Flash Magic GUI and Command Line Manual The following timing diagram shows how T1 and T2 are used Note that the signal levels are TTL it is assumed DTR and RTS have already been passed through an RS232 transceiver T1 T2 1 1 VDD Adjusting T1 and T2 may be necessary if there is increased capacitance on VDD causing the device to take longer to power down and back up again LPC2xxx DTR and RTS need to be connected to RST and P0 14 to allow Flash Magic to control the reset and ISP entry of the device The following simplified circuit diagram for an LPC2xxx is one possible way of connecting the DTR and RTS signals to RST and P0 14 of the device SERIAL CONNECTOR WwW gt Ww O 7a T Ke n N w MICROCONTROLLER RESET CIRCUIT Notes Page 46 Flash Magic GUI and Command Line Manual When the COM Port is not in use or the serial cable is not connected the RS232 signals are pulled low by the transceiver This results in the TTL signals being high Therefore when the TTL DTR and RTS signals are high P0 14 and RST must be in a sta
54. he Flash memory Modifying the Boot Vector and Status Byte Reading Flash memory Performing a blank check on a section of Flash memory Reading the signature bytes Reading and writing the security bits Direct load of a new baud rate high speed communications Sending commands to place device in Bootloader mode Flash Magic provides a clear and simple user interface to these features and more as described in the following sections Under Windows only one application may have access the COM Port at any one time preventing other applications from using the COM Port Flash Magic only obtains access to the selected COM Port when ISP operations are being performed This means that other applications that need to use the COM Port such as debugging tools may be used while Flash Magic is loaded Note that in this manual third party Compilers are listed alphabetically No preferences are indicated or implied Page 7 Flash Magic GUI and Command Line Manual Chapter 2 Minimum Requirements Windows 95 98 ME NT 2000 XP Mouse COM Port 16Mb RAM 3Mb Disk Space Page 8 Flash Magic GUI and Command Line Manual Chapter 3 User Interface Tour 3 1 Main Window The following is a screenshot of the main Flash Magic window The apperance may differ slightly depending on the device selected I Flash Magic a lol x Ww Options Help Menus lt 1 r2 Erase block 0 Erase Era E E COM Port com 1 x Ba
55. ified without programming it into the device first To access the verify feature choose Verify from the ISP menu You will be presented with the following dialog window x Hex File c SESAME val Boards Rx2 Keil Flasher flasher hex i J Ignore checksum locations Cancel Verify Select a Hex File to verify either by entering the path to the file of clicking on the Browse button and choosing it If checksums were used when the device was programmed then check the option to ignore checksum locations as they will be different in memory to any reserved checksum locations stored in the Hex file Click on the Verify button to start verification Progress information is shown at the bottom of the window Page 28 Flash Magic GUI and Command Line Manual 6 9 Reset and Execute Selecting the Reset item on the ISP menu will cause a reset command to be sent to the device Depending on the hardware and the status byte the device with either reset and execute code or reset to the Bootloader If the Reset command is sent after successfully programming the device then the reset will execute the downloaded code If the Reset command is sent after erasing the device then the device will reset to the Bootloader Selecting the Execute item on the ISP menu will cause Flash Magic to program the Boot Vector to the default and the Status Byte to zero for devices that have this feature followed by sending a reset command to the
56. le Reads the clocks bit Yes Operation READCLOCKS Device is using 6 clocks cycle Or Device is using SFR to select clocks default 12 clocks cycle Or Clocks bit read failed reason Where reason The reason security bit read failed The clocks bit is not read READCLOCKS Page 79 Flash Magic GUI and Command Line Manual 8 23 CLOCKS Description More than one allowed Type Syntax Output Default Examples Sets the clocks bit which will result in the device using 6 clocks cycle Note you cannot unset the clocks bit with this directive Instead the ERASE directive must be used performing a full device erase Yes Operation CLOCKS Clocks bit programming complete Or Clocks bit programming failed reason Where reason The reason clocks bit programming failed The clocks bit is not set CLOCKS Page 80 Flash Magic GUI and Command Line Manual 8 24 HARDWARE Description More than one allowed Type Syntax Output Default Example Configures how Flash Magic uses the handshaking signals of the PC s COM Port The handshaking signals DTR and RTS may be used to control the PSEN and RST pins on the microcontroller to place the device in Bootloader mode or execute firmware automatically before and after ISP operations Alternatively the signals may be asserted allowing power to be drawn from the COM Port To obtain the equivalent functionality of the old HARDW
57. mmunicate with the device in the main Flash memory This means that it is possible to erase or corrupt the ISP code Once erased or corrupted ISP operations can no longer be performed and the device would have to be physically removed from the hardware and placed in a parallel programmer to be reprogrammed In order to stop the ISP code from being accidentally erased the Protect ISP option is provided When checked Flash Magic will modify erase and programming operations such that the ISP code is not erased or corrupted For example e A full device erase will be achieved by erasing Flash blocks and pages to erase the Flash without erasing the section of Flash containing the ISP code A side effect is Page 49 Flash Magic GUI and Command Line Manual that any security bits that can only be erased with a full device erase will not be erased This must be considered before setting those security bits e A block erase for a block that contains the ISP code will be achieved by erasing pages in the block if they exist on the device to avoid erasing the ISP code e The programming of any Hex file containing data that would corrupt the ISP code will be aborted e The section of Flash containing the ISP code will not be filled e Any checksums that are in the same locations as ISP code will not be programmed If the Protect ISP option is unchecked then erasing or programming a device include fills and checksum generation has the pot
58. n and high speed communications is selected there will be pulses on the RTS and DTR signals just before the ISP operation This is because the high speed communications feature needs to reconfigure the COM port several times before the ISP operation is performed For each reconfigure Windows deasserts the DTR and RTS signals Flash Magic then immediately reasserts the DTR and RTS signals resulting in a pulse Page 47 Flash Magic GUI and Command Line Manual 89V51Rx2 89LV51Rx2 DTR needs to be connected to RST to allow Flash Magic to control the reset of the device The following simplified circuit diagram for an 89V51RD2 is one possible way of connecting the DTR signal to RST of the device WCC Reset Circuit R5232 Transceiver Serial Connector Notes When the COM Port is not in use or the serial cable is not connected the RS232 signals are pulled low by the transceiver This results in the TTL signals being high Therefore when the TTL DTR signal is high RST must be left to float so it can be asserted by the device and or reset circuit By checking the option to assert RTS while the COM Port is open the RTS signal will remain asserted while the ISP operation is performed This allows hardware to be designed that can reset or reconfigure hardware for an ISP operation T1 and T2 are timing values for the waveforms Flash Magic generates with the DTR and RTS signals Entering values in milliseconds into the boxes ma
59. n The reason erase failed No flash blocks are erased No security bits are erased No changes are made to the Boot Vector or Status Byte ERASEUSED C Development test hex NOPROTECTISP Page 91 Flash Magic GUI and Command Line Manual 8 34 READADDLSECURITY Description Reads the additional security bits More than one allowed Yes Type Operation Syntax READADDLSECURITY Output results are listed with each security bit on a separate line with the ormat name result Or Additional security bit read failed reason Where name The name of the bit e g AWP result set or not set reason The reason security bit read failed Default The additional security bits are not read Example READADDLSECURITY Page 92 Flash Magic GUI and Command Line Manual 8 35 ADDLSECURITY Description More than one allowed Type Syntax Output Default Examples Sets or unsets the additional security bits Some devices support additional security bits that are not related to specific sections of flash memory This directive allows those bits to be set or unset Yes Operation ADDLSECURITY awp cwp dccp Where awp Set to 1 to set AWP set to 0 to unset it cwp Set to 1 to set CWP set to 0 to keep it unchanged dccp Set to 1 to set DCCP set to O to unset it Additional security bit programming complete Or Additional security bit programming failed reason Where reason The reaso
60. n list Ensure you select the correct one as different devices have different feature sets and different methods of setting up the serial communications Select the interface being used if any An interface is a device that connects between your PC and the target hardware If you simply have a serial cable or USB to serial cable connecting your COM port to the target hardware then choose None ISP Choosing the correct interface will automatically configure Flash Magic for that interface along with enabling and disabling the relevent features Page 11 Flash Magic GUI and Command Line Manual Enter the oscillator frequency used on the hardware Do not round the frequency instead enter it as precisely as possible Some devices do not require the oscillator frequency to be entered so this field will not be displayed Once the options are set ensure the device is running the on chip Bootloader if you are using a manual ISP entry method Note that the connection settings affect all ISP features provided by Flash Magic Page 12 Flash Magic GUI and Command Line Manual 4 2 Step 2 Erasing This step is optional however if you attempt to program the device without first erasing at least one Flash block then Flash Magic will warn you and ask you if you are sure you want to program the device Erase block 0 0x0000 0 1F FF Erase block 1 0x2000 0x3FFF Erase block 4 OxCO00 OxF FFF Erase all Flash S
61. n security bit programming failed No additional security bits are set ADDLSECURITY 1 0x00 0x01 SECURITY 0H 1 0x01 Page 93 Flash Magic GUI and Command Line Manual 8 36 READMISR Description Reads the MISR of a block or the entire device More than one allowed Yes Type Operation Syntax READMISR type Where type The Flash to read the MISR of either a Flash block or the whole device If type is a value in the range 0 to 15 then the MISR of that number Flash block will be read If type is DEVICE then the MISR of the whole device will be read Output MISR result type Or MISR read failed reason type Where result The MISR value in hexadecimal prefixed with Ox type The Flash to read the MISR of Either a decimal number in the range 0 to 15 or a hexadecimal number in the range 0x0 to OxOF prefixed with Ox or DEVICE reason The reason the read failed Default The MISR is not read Examples READMISR 0x4 READMISR 4 READMISR DEVICE Page 94 Flash Magic GUI and Command Line Manual 8 37 READEEPROMSECURITY Description Reads the EEPROM security bits More than one allowed Yes Type Operation Syntax READEEPROMSECURITY Output o results are listed with each security bit on a separate line with the ormat EEPROM page b bit n result Or EEPROM security bit read failed reason Where n L 3 b 0 7 result set or not set or enabled or disabled reason The rea
62. nts of the Flash block have not be altered or corrupted Please refer to the Block Checksums section for more information Checking the Execute option will cause the downloaded firmware to be executed automatically after the programming is complete Note that this will not work if using the Hardware Reset option or a device that does not support this feature Page 15 Flash Magic GUI and Command Line Manual 4 5 Step 5 Performing the Operations Step 5 contains a Start button 5 Start Clicking the Start button will result in all the selected operations in the main window taking place They will be in order Erasing Flash Programming the Hex File Verifying the Hex File Filling Unused Flash Generating Checksums Programming the clocks bit Programming the Security Bits Executing the firmware Once started progress information and a progress bar will be displayed at the bottom of the main window In addition the Start button will change to a cancel button Click on the cancel button to cancel the operation Note that if you cancel during erasing all the Flash it may take a few seconds before the operation is cancelled Once the operations have finished the progress information will briefly show the message Finished The Programmed Count shown next to the progress bar will increment This shows the total number of times the hex file has been programmed Modifying the hex file or selecting another hex file will
63. o changes are made to the Boot Vector or Status Byte Examples ERASE 1 PROTECTISP ERASE 0x02 PROTECTISP ERASE 02H PROTECTISP ERASE DEVICE PROTECTISP Page 61 Flash Magic GUI and Command Line Manual 8 8 HEXFILE Description More than one allowed Type Syntax Output Default Examples Programs an Intel Hex file into the Flash memory Note that more than one instance of this directive is allowed on the command line however if a HEXFILE directive fills unused Flash then any subsequent HEXFILE directives will fail as it will not be possible to program the Flash and any previously programmed Hex File will be corrupted Yes Operation HEXFILE path checksums fill protectisp CODEREADPROTECTION Where path The path to the Intel Hex File checksums Set to CHECKSUMS to generate checksums in the Flash blocks used by the Hex File Set to NOCHECKSUMS for no checksums fill Set to FILL to fill the unused Flash with the value OOH Set to NOFILL for no filling of the Flash protectisp Set to PROTECTISP to stop the ISP code from being corrupted in devices that contain the ISP code in the main Flash memory Set to NOPROTECTISP to allow the ISP code to be corrupted Ignored for other devices It is strongly recommended to set this option to PROTECTISP CODEREADPROTECTION Sets the code read protection on devices that support it LPC2xxx only Hex File programming complete path Or Hex File pr
64. o checksums were generated for the Hex File The result is displayed on the standard output with a line of the format Verify result path Or Verify failed reason path Where result passed or failed path The path to the Intel hex file as passed to the VERIFY directive reason The reason verify failed No verification is performed VERIFY test hex VERIFY test hex VERIFY C work test hex Page 71 Flash Magic GUI and Command Line Manual 8 16 QUIET Description More than one allowed Type Syntax Output Default Examples Outputs information about the processing of each directive to an ASCII output file rather than the standard output where a program can process it No Configuration QUIET path Where path Path of the output file to generate None Or Output file creation failed path Where path The path of the output file to generate as passed to the QUIET directive Output is sent to the standard output QUIET test txt QUIET test txt QUIET C work test txt Page 72 Flash Magic GUI and Command Line Manual 8 17 READBOOTVECTOR Description Reads the value of the Boot Vector More than one allowed Yes Type Operation Syntax READBOOTVECTOR Output Boot Vector value Or Boot Vector read failed reason Where value The value of the Boot Vector in hexadecimal prefixed with Ox reason The reason the read failed Default Th
65. ogramming failed reason path Where path The path of the Intel Hex file as passed to the HEXFILE directive reason The reason Hex File programming failed No Hex file is programmed Checksums are not generated Unused Flash memory is not filled HEXFILE test hex CHECKSUMS NOFILL PROTECTISP HEXFILE test hex NOCHECKSUMS FILL PROTECTISP Page 62 Flash Magic GUI and Command Line Manual HEXFILE C work test hex CHECKSUMS FILL PROTECTISP HEXFILE foo hex NOCHECKSUMS FILL PROTECTISP CODEREADPROTECTION Page 63 Flash Magic GUI and Command Line Manual 8 9 HIGHSPEED Description More than one allowed Type Syntax Output Default Examples Uses high speed communications if the device supports it No Configuration HIGHSPEED clocks highspeedmax Where clocks The number of clocks per cycle the device is configured to use May be 6 or 12 The LPC9xx devices that support this command should have zero passed for the number of clocks per cycle highspeedmax The fastest baudrate that can be used in high speed mode in bps Must be a standard baud rate such as 115200 57600 38400 etc High Speed mode selected Or High Speed mode selection failed reason Where reason The reason high speed mode selection failed High speed communications are not used HIGHSPEED 6 115200 HIGHSPEED 12 57600 HIGHSPEED 0x0C 38400 HIGHSPEED 0CH 19200 HIGHSPEED 0 57600
66. on type Where result The CRC value in hexadecimal prefixed with Ox type The Flash to read the CRC of Either a decimal number in the range 0 to 15 or a hexadecimal number in the range 0x0 to OxOF prefixed with Ox or DEVICE reason The reason the read failed Default The CRC is not read Examples READCRC 0x4 READCRC 4 READCRC DEVICE Page 83 Flash Magic GUI and Command Line Manual 8 26 ERASEPAGE Description More than one allowed Type Syntax Output Default Examples Erases a single page in the device Yes Operation ERASEPAGE type protectisp Where type The number of the page to erase protectisp Set to PROTECTISP to stop the ISP code from being erased in devices that contain the ISP code in the main Flash memory Set to NOPROTECTISP to allow the ISP code to be erased Ignored for other devices It is strongly recommended to set this option to PROTECTISP Page erase complete type Or Page erase failed reason type Where type The number of the page to erase as passed to the directive reason The reason the erase failed The page is not erased ERASEPAGE 0 PROTECTISP ERASEPAGE 0x5 PROTECTISP Page 84 Flash Magic GUI and Command Line Manual 8 27 READCONFIG Description More than one allowed Type Syntax Output Default Example Reads the configuration of the device if supported by the device For the 89LPC9xx rea
67. r is entered into the terminal window Flash Magic will pause sending the rest of the data for the specified time period For example suppose that the delay character was enabled and set to with a delay of 1000ms Pasting the following into the terminal window 1 S400 3 Page 105 Flash Magic GUI and Command Line Manual would result in 1 being sent out of the COM Port followed by a delay of 1000ms followed by S400 being transmitted followed by a delay of 2000ms followed by 3 being transmitted Note that the delay character itself is not transmitted so any delay character selected must be a character that is not used in the serial command set implemented in the firmware Connections are always made with eight bits no parity one stop bit and no flow control Once the settings have been accepted the terminal window will open Sa Flash Magic Terminal COM 1 9600 ex Options Output gt gt UUUUU The top part of the window shows the output from the device The bottom part is where characters are entered for transmission The sizes of the areas may be adjusted by resizing the window and dragging the splitter located between the output and input areas To transmit data simply type or cut and paste into the input box Output will appear in the output window By keeping the input and output separate it is possible to copy the input and output into documentation such as test reports It also allows
68. r machine before the change to the PATH variable is recognized when using Windows 95 98 ME You must restart your machine or log out then back in again before the change to the PATH variable is recognized when using Windows NT 2000 XP Commands are passed to FM EXE in the form or either directives or a Command File containing directives The command line will have the following syntax FM directives Where Page 53 Flash Magic GUI and Command Line Manual directives space separated list of directives or commandfile commandfile An ASCII file containing a space separated or newline separated list of directives There are two types of directives Configuration configure how the device is accessed and how Flash Magic operates Operation an operation to be performed on the device Directives may appear in any order in the list however the operation directives are processed in the order listed For example the following command line FM ERASE 3 PROTECTISP HEXFILE TEST HEX CHECKSUMS FILL Performs an erase before programming the hex file However the following command line FM HEXFILE TEST HEX CHECKSUMS FILL ERASE 3 PROTECTISP Programs the hex file then performs the erase Operation directives may appear more than once on a command line allowing complex operations to be performed For example FM ERASE 0 PROTECTISP HEXFILE TEST1 HEX CHECKSUMS NOFILL ERASE 1 HEXFILE
69. re if the contents of the memory change there is a very high probability the CRC will also change If the selected device supports CRCs then the Cyclic Redundancy Check item on the ISP menu will be enabled Selecting it displays the CRC window Cyclic Redundancy Check EREET xj Block Device CAC Hex Files CRC O Ox0000 0x03FF OwABS8C476 0x52018556 1 0x0400 0x07FF Ox00000000 0x00000000 2 0x0800 0x0BFF Ox00000000 0x00000000 3 Ox0C00 0x0F FF ox00000000 0x00000000 4 0x1000 0x1 3FF Qx00000000 ox00000000 w Hex Files C temp ptrtest PTRTEST HEX C temp rx2test rx2test hex Add Remove Calculate CRC Close cll When the window is first opened the CRC value is read from the device for each Flash Block and the entire device These values are shown in the Device CRC column Click on the Add button and select each of the Hex files programmed into the device Each Hex file will appear in the list at the bottom of the window To remove a Hex file from the list select it in the list and click on the Remove button Click on the Calculate CRC button to calculate the CRCs for each block and the whole device as if the chosen Hex files were programmed into the device These values will appear in the Hex Files CRC column If the contents of the device exactly match the contents of the chosen Hex files then the CRCs on each row of the table will match Page 36 Flash Magic GUI and Command Line M
70. reason the erase failed The page is not erased ERASEEEPROMPAGE 0 ERASEEEPROMPAGE 0x5 Page 97 Flash Magic GUI and Command Line Manual 8 40 READEEPROMCRC Description More than one allowed Type Syntax Output Default Examples Reads the CRC of the EEPROM Yes Operation READEEPROMCRC page Where page The number of the page to erase EEPROM CRC result Or EEPROM CRC read failed reason Where result The CRC value in hexadecimal prefixed with Ox reason The reason the read failed The CRC is not read READEEPROMCRC Page 98 Flash Magic GUI and Command Line Manual 8 41 EEPROMHEXFILE Description More than one allowed Type Syntax Output Default Examples Programs an Intel Hex file into the EEPROM Note that more than one instance of this directive is allowed on the command line Yes Operation EEPROMHEXFILE path Where path The path to the Intel Hex File EEPROM hex File programming complete path Or EEPROM hex File programming failed reason path Where path The path of the Intel Hex file as passed to the EEPROMHEXFILE directive reason The reason Hex File programming failed No Hex file is programmed EEPROMHEXFILE test hex EEPROMHEXFILE test hex EEPROMHEXFILE C work test hex Page 99 Flash Magic GUI and Command Line Manual 8 42 INTERFACE Description Specifies the interface to use if needed
71. rective specifies the initial baud rate No Configuration COM port baudrate Where port The COM Port to use baudrate The baud rate to use One of 2400 4800 9600 19200 38400 57600 Connected Or Connection failed reason Where reason The reason the connection failed COM 1 baudrate of 19200 COM 1 19200 COM 1H 9600 COM 1 0x2580 COM 0x01 2580H Page 57 Flash Magic GUI and Command Line Manual 8 6 DEVICE Description Selects the device being used and the oscillator frequency being used If the device does not require an oscillator frequency then specify zero for the frequency More than one allowed No Type Configuration Syntax DEVICE device frequency Where device One of 89C51RB 89C51RB2Hxx 89C51RC 89C51RC2Hxx 89C51RD 89C51RD2Hxx 89C660 89C662 89C664 89C668 89C669 89V660 does not reequire osc freq 89V662 does not reequire osc freq 89V664 does not reequire osc freq XA G39 XA G49 89C51RA2xx 89C51RB2xx 89C51RC2xx 89C51RD2xx 89C60X2 89C61X2 89CV51RB2 89CV51RC2 89CV51RD2 89LPC901 does not require osc freq 89LPC902 does not require osc freq 89LPC903 does not require osc freq 89LPC904 does not require osc freq 89LPC906 does not require osc freq 89LPC907 does not require osc freq 89LPC908 does not require osc freq Page 58 Flash Magic GUI and Command Line Manual 89LPC912 does not require osc freq 89LPC913 does not r
72. sententeneags 16 Chapter 5 Block CHECKSUM Generation cece eee cece eee nen eee ene ERS eee tas 17 SLIPO duction Serrara nO E eevee slag Sate edged tee NEA E AEAEE 17 5 2 Checksum Demonstration Projet ssississrssirisr vanaisa raO ANNARA 18 5 3 Using the Example Checksum COde cccececce cee e eee eee nen NEA SEASNEEENSIRKAS 19 Chapter 6 Additional ISP Features ccc cece eee e nen e nen e nee ne RARA 20 6 1 Savingia HEX Fil iecccisessticisemedssstaieienraiddieniemiaisiadinniaiendaaiaettiaieskiemawe eet 20 6 2 Blank CHECK esses cuss cccvssiacviwae ed ced ENRERE ARA SNARARE EASKE SANS yee ET Re Kae ENSKE TRSN 21 6 3 Reading the Security Settings s srrrrrsrsrinrirerrtr Eee eee tae 22 6 4 Reading the Device SIQna ture ccecceccesese tsetse teense eee ee teense esses eee NEARER REENE PARANE RERS 23 6 5 Modifying the Boot Vector and Status Byte ccceceecece cece eee eee eee nena ene ee eee eee aa eae 24 6 6 Displaying Memory esar aa oes aia tar ianideieva EEEE 26 6 7 Erasing FAS sesesieeisaessiscaisiuenieetenseieeiiwiiaenitcaiienseinanieieritmeniannetiaiaiianeiene ines 27 6 8 Verifying a Hex Files cicvcev cies case vee tre innau viii ey desea aie Meee ee ede Gere eeu TU Rae eee alee 28 6 9 Reset and EXECUTE acsi ins esses AEE aeanaaveeindi tr demak enema einer 29 6 10 Start Bootloader ssimic ETA adenine amides Ride ee 30 Start Bootloader DESCriPtiON ws vieus seen vente eve vie vss vie ver deste ste vaedi eds REN vesdes
73. sh Magic GUI and Command Line Manual def Main global cancel print Hello World Indentation in Python is important and takes the place of curly braces in C The import FlashMagic line tells Python that we want to use the Flash Magic module This is a custom module that provides Python with access to all the ISP functionality available in Flash Magic known as the Application Programmer Interface API The driver line tells the Flash Magic module which DLL should be used This must be set one time and before any functions are called in the Flash Magic module It is not currently possible to change the driver during the execution of a script A global cancel flag is defined and set to zero The Cancel function simply sets the cancel flag when called The Main function prints the hello world message and exits In a real script the Main function should perodically check the cancel flag to see if it is set If it is then the function should exit This is important in order to allow the user to stop a running script The more frequently the cancel flag is checked the more responsive the script will be An example check would be if cancel return 14 4 Flash Magic API The FlashMagic module implements the low level Flash Magic API This is a collection of constants and functions which allow ISP to be used The Python object is a simple wrapper around the C functions For details of the API please refer to
74. sible If you are using the internal RC oscillator enter 7 3728 into the box When using the watchdog timer enter 0 4 into the box Recommendation When using the internal RC oscillator enter 7 3728 into the box Page 101 Flash Magic GUI and Command Line Manual Chapter 10 FlashMagic and IDEs 10 1 Introduction Flash Magic may be integrated into development tool IDEs by using the command line functionality of Flash Magic This section gives examples on how various IDEs may be used with Flash Magic Please let us know if you have integrated Flash Magic with IDEs not listed here 10 2 Keil uVision Flash Magic may be added to the Tools menu by completing the following steps 1 2 3 aus 7 8 Select Customize Tools Menu from the Tools Menu Click on the New Insert button An empty title box will be created Enter into the title box Program device with H Select the title Click on the button next to the Command box and browse to and select FM EXE In the arguments box enter all the directives you wish to use For the HEXFILE directive use H in place of the Hex File path For example you may enter DEVICE 89C51RD2 20 000 HEXFILE H NOCHECKSUMS NOFILL COM 1 19200 Check the Run Minimized option Click on OK You will now have an entry on the Tools menu that when selected will program the Hex file for the current project Page 102 Flash Magic GUI and Command
75. son security bit read failed Default The security bits are not read Example READEEPROMSECURITY Page 95 Flash Magic GUI and Command Line Manual 8 38 EEPROMSECURITY Description More than one allowed Type Syntax Output Default Examples Sets the EEPROM security bits Note you cannot unset the security bits with this directive Instead the ERASEEEPROMPAGE directive must be used Yes Operation EEPROMSECURITY pageObit1 pageObit2 pageObit3 page1bitO pageibit1 Where pageOdbitO Set to 1 to set security bit 0 of page 0 set to 0 to keep it unset pageOdbit1 Set to 1 to set security bit 1 of page 0 set to 0 to keep it unset pagenbit2 Set to 1 to set security bit 2 of page n set to 0 to keep it unset EEPROM security bit programming complete Or EEPROM security bit programming failed reason Where reason The reason security bit programming failed No security bits are set EEPROMSECURITY 1 0 1 1 0 1 0 1 0 Page 96 Flash Magic GUI and Command Line Manual 8 39 ERASEEEPROMPAGE Description More than one allowed Type Syntax Output Default Examples Erases a single EEPROM page in the device Yes Operation ERASEEEPROMPAGE type Where type The number of the page to erase EEPROM page erase complete type Or EEPROM page erase failed reason type Where type The number of the page to erase as passed to the directive reason The
76. status column indicates if a block is blank or not Checking the option to Mark non blank blocks to be erased will have the effect of checking the relevant items in the Erase section of the main window For example if Block 0 is not blank then checking the Mark option will result in Block 0 in the Erase section of the main window being checked Page 21 Flash Magic GUI and Command Line Manual 6 3 Reading the Security Settings When Flash Magic is first started it will attempt to read the security bits of any device that is connected to the specified COM Port If no device is connected then you may connect a device and choose Read Security from the ISP menu The security settings will be read and the following window opened Security Bits Ed Security bit 1 is set Security bit 2 is unset Security bit 3 is unset If a security bit is set then it will be highlighted Page 22 Flash Magic GUI and Command Line Manual 6 4 Reading the Device Signature The device signature is comprised of two or three bytes that identify the device or a single 32 bit value To read the device signature choose Read Device Signature from the ISP menu The signature will be read and the following window will open showing the three bytes Device Signature E3 Manufacturer ID Ox Device ID 1 0x Device ID 2 Ox 15 C2 80 A manufacturer ID of 15H corresponds to NXP Semiconductors Some devices will also display the boo
77. te that allows the device to reset normally and execute code By checking the option to assert RTS while the COM Port is open the RTS signal will remain asserted while the ISP operation is performed This allows hardware to be designed that can reset or reconfigure hardware for an ISP operation Ti and T2 are timing values for the waveforms Flash Magic generates with the DTR and RTS signals Entering values in milliseconds into the boxes may configure these timings Note however that the timings are approximate as they depend on what other applications are running in Windows and how fast the PC is The following timing diagrams show how T1 and T2 are used Note that the signal levels are TTL it is assumed DTR and RTS have already been passed through an RS232 transceiver Start of ISP operation starting the Bootloader T1 T2 lt gt q gt DTR RTS End of ISP operation executing firmware T1 T2 lt gt lt gt i po The final option when checked instructs Flash Magic to assert DTR and RTS whenever Flash Magic has the COM Port open This allows the possibility of the target hardware stealing power from the handshaking lines during ISP operations Note however that once Flash Magic closes the COM Port at the end of an ISP operation Windows deasserts the DTR and RTS signals Note that when selecting to keep RTS asserted while the COM Port is open or selecting to assert DTR and RTS while the COM Port is ope
78. teuiedyedievesdest sets 30 Start Bootloader Demonstration Project cccccec cece eee eee eee ee ne ea EA tenet nes 32 Advanced Features iccssssvisiintsiceistictitiverseandscsttietieesaibiritierietadeseisesieuitieaiecieiiariees 32 6 11 Erase Pages visi cick niue e ne tans bw wane EEEN eae n wane dt ENE ate ate A 34 6 12 Device Configuration erraria teva seeeicavdiacdier de vexadeiaraaiewiadh dvs dene venidivee eae viata evar 35 6 13 Cyclic Redundancy CHECK 00 EERE EEE Ente 36 6 14 MISR wie ischsectbes sav axdathave averese ans behaved evs ries akvaweawiaviaduns daeas aati ve ones eveas a Ove wane ee 37 EE o A T ee ee ee i eee ee ee ere 38 6 116 Serial NUMBER cessed din sa dachuteshcvedeaveGscuiisckvdesteaddecasatnaisaseevedsaniannasihasaweciesaenn mass 39 6 17 Update Bootloader ecreis eievcasvees ata ei cence oie kee eee eee eve REANA aed 41 6 18 Additional Security Bits sicsccvevstedsiaicvisiacievew dee wiasvecssdvee eee a etea ea einer naan 42 Chapter 7 Advanced Options cccececeeceeceeeeeeeeee eee ee KANAREN ENARA AAA RASK ERARE NANN RE ARENA NANE 43 7 1 High Speed COMMUNICAIONG iicistiswciesiiistiitueve ric A RENAE EEI SAE YEKA ENES 43 7 2 Half duplex COMMUNICATIONS eosierrerrirnrririan in anA EREE EERTE RAER EEN EE EIEREN 43 7 3 Hardware Configuration cccccccceeceese eee Erran ee eee eee eee ne ene EEE EEE ERA NERE ESSE SAADA EEE EE EEE EEE 43 89C51Rx2xx 89C6xX2 89C51Rx2Hxx 89C66x 89C51RxX XA GX9O oo eeee eee eee e eee
79. the signature bytes read from the device along with all markings on the top of the device itself Page 52 Flash Magic GUI and Command Line Manual Chapter 8 Command Line Interface 8 1 Introduction The Command Line interface to Flash Magic allows the features of Flash Magic to be accessed from the command line DOS This provides a powerful and flexible way of integrating Flash Magic into your project s build process the Integrated Development Environment you use for developing applications If you use a Batch file to build your project then a call to Flash Magic can be added onto the end of the batch file allowing one step build and program of your application Most modern IDEs allow users to add custom menu entries that run any command you desire Therefore it is simple to add menu entries to run Flash Magic and program the latest Hex file It is possible to configure Flash Magic to output the result of all operations to an ASCII text file The output is described in this manual enabling programs to be written to parse the text file and provide automated testing of devices or gang programming of devices 8 2 Running Flash Magic on the Command Line The Command Line version of Flash Magic is called FM EXE Before you can run FM EXE on the command line you must set up your PATH environment variable to point to the folder FM EXE is stored in This is done automatically during installation however you must restart you
80. the same selections every time you start the application If you wish to reset the options to the original defaults then choose Reset from the Options menu Page 10 Flash Magic GUI and Command Line Manual Chapter 4 Five Step Programming For each step there is a corresponding section in the main window as described in the User Interface Tour 4 1 Step 1 Connection Settings Before the device can be used the settings required to make a connection must be specified 1 COM Port Baud Rate Device Interface Oscillator Freq MHz COM 1 19200 v 89C668 v None ISP v 11 0592 ba Select the desired COM port from the drop down list or type the desired COM port directly into the box If you enter the COM port yourself then you must enter it in one of the following formats e COMn e n Any other format will generate an error So if you want to use COM 5 which is not present on the drop down list you can directly type in either COM 5 or 5 Select the baud rate to connect at Try a low speed first The maximum speed that can be used depends on the crystal frequency on your hardware You can try connecting at higher and higher speeds until connections fail Then you have found the highest baud rate to connect at Alternatively some devices support high speed communications Please refer to the High Speed Communications section for information Select the device being used from the drop dow
81. the update feature turned off the hints you currently have will still be displayed Page 104 Flash Magic GUI and Command Line Manual Chapter 13 Terminal Interface Flash Magic features a simple terminal interface designed to communicate with a microcontroller during the testing of firmware Note that it is not a comprehensive implementation and if VT100 character swapping colors and other features are required we recommend using TeraTerm To start the terminal interface choose Terminal from the Tools menu Initially the configuration window will be displayed Terminal Settings Port and Speed COM Port COM 1 Baud Rate 9600 Options Modify default COM Port behavior While connected Assert DTA Deassert RTS v MV Use a delay character Character e generates a delay of f 000 ms Cancel The default setting when the COM port is opened for the terminal interface is that DTR and RTS are both asserted This is standard COM port behavior Because sometimes target hardware requires certain states for DTR and RTS it is possible to configure the state they will be in while the COM port is opened To do this check Modify default COM Port behavior and choose the appropriate option from the drop down list The terminal interface allows cut and pasting of blocks of text into it In order to allow commands to be pasted a delay character is supported When the option is enabled and the delay characte
82. tloader version in this window Page 23 Flash Magic GUI and Command Line Manual 6 5 Modifying the Boot Vector and Status Byte The Status Byte indicates how the device will operate after a reset A value of OOH will result in the device checking the PSEN pin to determine whether it should run the Bootloader or the user application Any other value will result in the device running the Bootloader The Boot Vector contains the page that the Bootloader or user bootloader starts at The default varies depending on the device but as an example FCH corresponds to the address FCOOH for 8051 non LPC devices and F8H corresponds to the address F800H for the XA devices Once programming is completed it is possible to change both the Boot Vector and Status Byte by selecting Boot Vector and Status Byte from the ISP menu You will be presented with the following window WARNING Changing the Boot Vector to a A value other than the default of OxFC may result A in the inability to communicate with the device using ISP Below are shown the current settings If you wish to change them then make the changes and click on Reprogram Note that FlashMagic ALWAYS sets the Boot Vector to OxFC and the Status Byte to 0 00 after programming a Hex file Also note that after performing a full Flash erase the Boot Vector is set to OxFC and the Status Byte is set to OxFF Boot Vector Status Byte Ox Fe C Run Boot Loader Status Byte OxFF
83. ud Rate 19200 E a Dei B9C51RD2H x gt il I 20 000000 Oscillator Freq MHz JV Erase all Flash Security Hex File C temp temp2 test hex Browse Last Modified 8 2 2002 3 56 50 PM Size 658 bytes J Verify after programming J Set Security Bit 1 Fill unused Flash Set Security Bit 2 I Generate checksums Set Security Bit 3 Execute F amp clks eycle EmbeddedHints _ rn Flash Magic 1 44 is now available for download www esacademy com software flashmagic Section 1 ck 3 0x800 BFF ek 4 0xCO00 0xF FFF Section 2 Progress information Programmed Count Progress bar The window is divided up into five sections Work your way from section 1 to section 5 to program a device using the most common functions Each section is described in detail in the following sections At the very bottom left of the window is an area where progress messages will be displayed and at the very bottom right is where the progress bar is displayed In between the messages and the progress bar is a count of the number of times the currently selected hex file has been programmed since it was last modified or selected Just above the progress information EmbeddedHints are displayed These are rotating Internet links that you can click on to go to a web page using your default browser If you wish to quickly flick through all the hints then you can click on the fast forward button gt Page 9 Flash M
84. ure otherwise the BootROM will become confused f WARNING Ensure device is executing firmware and Cancel Start BootROM Select to either send a textual command or a break condition The baud rate used is completely independent from the baud rate in the main window This allows the user s application to use the UART at say 9600 baud but allow Flash Magic to use say 19200 baud either with or without high speed communications turned on However the COM Port used is the same as the one selected in the main window Page 30 Flash Magic GUI and Command Line Manual Select the baud rate enter the textual command which may be anything you desire select the append option you want and click on Start Bootloader to send If successful the ISP features of Flash Magic can now be used The append options allow a carriage return and line feed to be added to the command This is useful if your application implements a command line via the serial port and expects all commands to end in these control characters Select the setting that matches your implementation Combined with the automatic Reset after programming option devices may be programmed and tested repeatedly without ever having to touch the hardware An example project that accepts the command boot at 9600 baud is supplied with Flash Magic For command line access to this feature see the STARTBOOTLOADER directive Page 31 Flash Magic GUI and Command Line Manual
85. value Where value new value for the Status Byte Status Bit programmed to value Or Status Bit programming failed reason value Where value The value the Status Bit was programmed to 0 or 1 reason The reason Status Bit programming failed The Status Bit is not programmed with a new value STATUSBIT 1 STATUSBIT 0 STATUSBIT 0x01 Page 87 Flash Magic GUI and Command Line Manual 8 30 READSTATUSBIT Description Reads the value of the Status Bit Use for those devices that implement a Status Bit as opposed to a Status Byte such as the 89LPC932 More than one allowed Yes Type Operation Syntax READSTATUSBIT Output Status Bit value Or Status Bit read failed reason Where value The value of the Status Bit 0 or 1 reason The reason the read failed Default The Status Bit is not read Example READSTATUSBIT Page 88 Flash Magic GUI and Command Line Manual 8 31 EXECUTE Description More than one allowed Type Syntax Output Default Example Causes the firmware to be executed Yes Operation EXECUTE address options Where address the address to execute from ARM devices only options the execution options ARM devices only Can be one of ARM THUMB For non ARM devices set address and options to zero Execute complete Or Execute failed reason Where reason The reason the execute failed The device is not reset EXECUTE Page 89
86. y configure these timings Note however that the timings are approximate as they depend on what other applications are running in Windows and how fast the PC is The following timing diagrams show how T1 and T2 are used Note that the signal levels are TTL it is assumed DTR and RTS have already been passed through an RS232 transceiver Page 48 Flash Magic GUI and Command Line Manual Start of ISP operation starting the Bootloader T1 T2 o DTR The final option when checked instructs Flash Magic to assert DTR and RTS whenever Flash Magic has the COM Port open This allows the possibility of the target hardware stealing power from the handshaking lines during ISP operations Note however that once Flash Magic closes the COM Port at the end of an ISP operation Windows deasserts the DTR and RTS signals Note that when selecting to keep RTS asserted while the COM Port is open or selecting to assert DTR and RTS while the COM Port is open and high speed communications is selected there will be pulses on the RTS and DTR signals just before the ISP operation This is because the high speed communications feature needs to reconfigure the COM port several times before the ISP operation is performed For each reconfigure Windows deasserts the DTR and RTS signals Flash Magic then immediately reasserts the DTR and RTS signals resulting in a pulse 7 4 Protect ISP Some devices contain the ISP code which allows Flash Magic to co

Download Pdf Manuals

image

Related Search

Related Contents

DTC P2563 DTC DESCRIPTOR DTC P2563 Turbocharger Boost  CORE Par 40 USB Quick Reference Guide Revision 3    Web Caster FT-STC-Ba/g 取扱説明書  Istruzioni per l`uso di base - Migros    Minka Lavery 4207-290 Installation Guide  mémento de sécurité - Ambassade de France  Créer un tissu.  2005-2007 toyota tacoma/tundra rf cruise control switch installation  

Copyright © All rights reserved.
Failed to retrieve file