3. Software installation and setup
6. Selecting a communication medium
8. Editing the buffer and setting options
8.2. The Buffer options window
9. Executing operations on the target device
11. The history and command window
12. Recording and replaying commands
12.1. Building the configuration file from FLIP
12.2. Loading and running the configuration file
12.3. Building a configuration file using a text editor
This ATMEL Wireless and Microcontrollers ISP software allows to program all our FLASH C51/C251 parts. It runs under Windows 9x, Windows 2000 and Windows NT as well. Linux and Solaris compliant versions will be released later on.
Communicating with the target device may be done through a RS232 link, a CAN or even an USB or an I2C link, depending on the communication media supported by the target device.
This software is named FLIP, which stands for: FLexible In-system Programmer.
data byte modification, address range fill-in, goto a specified address, data byte sequence search
Blank check, Program, Read, Verify, Erase, Special bytes edition capability
Starting from the release 1.3.0, FLIP supports two CAN hardware interfaces : the IXXAT CANdy interface and the VECTOR CANpari one. These interfaces must be connected to the PC parallel port. The installation procedures of these interfaces are described in the IXXAT and the VECTOR manuals.
Install the parallel / CAN interface software, connect the interface to the parallel port, reboot the PC, then run FLIP.
This chapter guides you through a short tour of FLIP to help you getting started with this ISP software.
Once the FLIP main window appears, you can see three areas from the left to the right: the Operations Flow area, the Buffer Information area and the Device parameters one.
Just below these three frames stands a command and history window which use will be discussed in The history and command window.
A message log window, a progress bar area and a communication information report are available at the bottom of the main window.
At the time this document is written, some of these features are unavailable, but FLIP will be extended to support these communication media. Connect your target hardware to a power supply and reset it. We assume that the device to be programmed contains a FLIP compliant bootloader program.
From the top menu bar, select the Device item. In the Device pull-down menu, click the Select item.The Device Selection dialog box pops up. Select a device from the devices list box and click OK.
As soon as the device is selected, the Device parameters area is updated to let you see the selected device special bytes. The Buffer information area is updated as well with device dependent information.
From the top menu bar, select the Settings item. In the Settings pull-down menu, click the Communication item. In the Communication cascading menu, select a communication medium.
The medium setup dialog box pops up. Adjust the communication parameters, and click Connect.
FLIP starts a synchronization sequence with the target device bootloader software. After the synchronization sequence completion, FLIP reads the target device special bytes and updates the main window frame on the right.
From the top menu bar, select the File item. In the File pull-down menu, click the Load item.
Select a HEX file from the file browser. FLIP parses the HEX file and fills in the edition buffer.
From the top menu bar, select the Buffer item. In the Buffer pull-down menu, click the Edit item.
The Edit Buffer window pops up. You may now perform many operations onto the buffer contents.
For details about the possible buffer editing capabilities, see the Editing the buffer and setting options.
You may open the buffer options window from the FLIP main window, or from the Edit Buffer dialog box.
From the main window menu bar, select the Buffer item. In the Buffer pull-down menu, click the Options item.
The Buffer Options dialog box pops up. The main buffer options are: the buffer size, the initial contents, the address programming range and the loading offset. For details about these options, see the Editing the buffer and setting options.
From the top menu bar, select the Device item. In the Device pull-down menu, click the Program item.
This concludes our short tour of the FLIP demo. For detailed descriptions of the possible operations, please read the following chapters.
From the top menu bar, select the Device item. In the Device pull-down menu, click the Select item.The Device Selection dialog box pops up. Select a device from the devices list box and click OK.
As soon as the device is selected, the Device parameters area is updated to let you see the selected device special bytes. The Buffer information area is updated as well with device dependent information.
The device selection may be done by pressing the F2 function key.
Each device supports a particular set of communication media.
You may use FLIP as an HEX file editor only; in that case, you do not have to select a device from the device list.
From the top menu bar, select the Settings item. In the Settings pull-down menu, click the Communication item. In the Communication cascading menu, select a communication medium. The medium setup dialog box pops up.
The communication medium selection may be done by pressing the F3 function key.
Adjust the communication parameters, and click Connect.
FLIP starts a synchronization sequence with the target device bootloader software. After the synchronization sequence completion, FLIP reads the target device special bytes and updates the Device parameters area.
The RS232 synchronization sequence will probably pass, even at high baudrates. Nevertheless, you must take care to the baudrate selection: if the target hardware oscillator frequency is too low, the bootloader cannot achieve characters reception/transmission and FLASH programming properly. In such cases, you have to decrease the baudrate.
FLIP will warn you through a message box if such a situation occurs. The following table shows the valid Osc. freq./Baudrate pairs which allow a successful RS232 transmission.
The Controller Area Network Setup dialog box shows up.
Click the Node Connect button. FLIP reads the target device special bytes and updates the Device parameters area.
The device special bytes are displayed in the main window Device parameters area. Some of them are read-only.
You may read the special bytes at any time, if allowed by the security level, by clicking the Read button.
Changing the special bytes values is straight forward: set a new value in the proper entry field and click the Set button.
FLIP will write the special bytes new values and will read back the special bytes values from the device. This guaranties that the displayed values are the device ones, not only values to be programmed.
FLIP takes care about the current security level and disables the Read and the Set buttons when necessary.
For devices supporting the CAN protocol, FLIP provides a CAN button at the bottom of the Device parameters area.
Clicking the CAN button makes the CAN Node Configuration dialog visible. It lets you read and modify a CAN node parameters.
The parameters that may be changed are :
To change a value, simply type the new value in the proper entry and click the Set button.
After any CAN node configuration modification, you must reset the target device in order to force the new configuration to be taken into account.
FLIP allows many operations on the buffer. This chapter describes each of them.
From the top menu bar, select the Buffer item. In the Buffer pull-down menu, click the Edit item.
The entries are not case sensitive. Nor X, neither 0X prefix is necessary when you type addresses or data values.
Loads a HEX file into the buffer. Use the file browser to select a file.
Allows saving the buffer contents to a file.
The range of addresses which will be saved is recalled in the main window Buffer Information area, with the Range label. You may modify the range values through the Buffer Options dialog box. In the Address Programming Range field, select the User Defined Address Range option and set the Min and Max addresses, then click OK or Apply. The main window Buffer Information area should reflect your changes.
Opens a dialog box which lets you modify the buffer contents. Type an address and a data value in hexadecimal format.
After modification, the buffer window is scrolled and a yellow tag highlights the modified address. You may perform buffer modifications by merely double-clicking a data byte within the buffer window.
Click the Apply button to perform changes without closing the Modify Buffer dialog box. Click the OK button or hit the Return key to perform changes and close the dialog box.
Opens a dialog box which lets you specify an address you want to scroll to.
Lets you enter a start address, an end address, and a value you want to be used to fill the defined address range.
Click the Fill button to fill the address range. Use the Check button when you want to check an address range contents.
Use this command to reset the buffer to the default blank value. The default blank value is displayed in the main window Buffer Information area. You can change it by using the Buffer Options window.
Use this command to read the target device FLASH memory. The Edit Buffer window is updated afterwards.
Use this command to program the target device FLASH memory.
The device programming address range is displayed in the main window Buffer Information area and is labeled Range. You can change it by using the Buffer Options window.
This command lets you compare the target device memory contents with the buffer one. The comparison is done between (and including) boundary addresses. The address range is displayed in the main window Buffer Information. You can change it by using the Buffer Options window.
FLIP displays the first fail address, if any.
From the top menu bar, select the Buffer item. In the Buffer pull-down menu, click the Options item.
The entries are not case sensitive. Nor X, neither 0X prefix is necessary when you type addresses or data values.
After a device selection, this option is set to device dependent state by default; this means that the buffer size is set to the target device memory one (in Kbytes).
You may override this option setup and define a different buffer size value.
After a device selection, this option is set to device dependent state by default; this means that the buffer default reset value is set to the target device memory blank value.
You may override this option setup and define a different buffer reset value.
Set this option to yes only if you want the buffer to be reset to the blank value before reading the HEX file.
The default No value is useful when you intend to load several HEX files into the buffer.
This option lets you define the address range which will be used to program the target device. It can be set to the following values:
This is the default setup. The address programming range is set to the address range of the last HEX file loaded into the buffer.
The whole buffer address range will be used to program the target device.
Select this option if you want to define a particular range of address to program the target device.
This field lets you enter an offset value to be added to the HEX file addresses before loading the buffer.
The buffer checksum value is displayed in the main window Buffer Information area.
The checksum is calculated on the address range displayed in the Buffer Information area; the address boundaries are included in the address range. As described in the above paragraph, the user has control over the address programming range.
The checksum value is updated each time the buffer is modified within the address programming range by operations like: reset, modify, fill, HEX file loading and device reading.
From the top menu bar, select the Device item. In the Device pull-down menu, select an operation.
Use this command to select a device from a list.
This command pops up a dialog box for you to enter the erasing options. Some devices do not allow erasing per block; FLIP takes care about this by making the corresponding selections impossible.
This command lets you compare the target device contents to the blank value. The current blank value is displayed in the Buffer Information area of the main window. The verification is done between (and including) two boundary addresses which you can adjust through the Blank Check dialog box Start Address and End Address fields. Click the Check button to perform the operation. The pass/fail status is displayed in the Blank Check dialog box. If an error occurs the fail address is reported in the Blank Check dialog box.
Use the dialog box Reset button to clear any previous check status message.
This command lets you read the target device contents between two boundary addresses. You can specify these boundaries through the dialog box Start address and End address fields.
This command launches the target device programmation. The device programming address range is displayed in the main window Buffer Information area and is labeled Range. You can change it by using the Buffer Options window.
This command lets you compare the target device contents to the buffer one. The verification is done on the address range displayed in the main window Buffer Information area and is labeled Range. You can change it by using the Buffer Options window.
The operations flow is displayed on the left part of the FLIP main window. It lets you select a number of operations to be performed sequentially. You launch the flow sequence by clicking the Run button.
When an operation completes, the corresponding check box color changes from white to green (for pass status) or red (for fail status).
If one of the operations fails, the operations flow stops.
Some operations in the flow require that you perform a setup, first :
Starting with the FLIP version 1.2.0, the history and command window can be displayed through the Settings > Command Window pulldown menu.
This window keeps the history of all actions performed on the target device or on HEX files, but it can do much more than this! Type pwd at the prompt and you will get the current FLIP working directory. Type expr 2 + 5 and you will get the result of this addition.
FLIP has been written in Tcl and C; everything you type in the command window is interpreted by a Tcl interpreter. Type anything stupid in the command window (no example is provided here, you should be able to find your own) and you will get an invalid command name "stupid" message.
The command window gives you access to the Tcl commands and you can rely on the Tcl power to write flexible scripts which you can then execute in the command window. Since some of the FLIP functions are made available to the Tcl command window, you can call these functions in you Tcl script. An example of use of this capability follows.
Imagine that the Erase function which performs the target device erase operation is called erase_f. This function returns 1 if erase passes and 0 if it fails. You want to perform the erase operation once, check if it passes or fails and execute it again if it has failed. Your Tcl script would be something like :
Do not type this example in the command window because it cannot work. At the time this document is written, this scripting capability is not fully implemented and cannot be used to write production scripts, but it is used by the FLIP developpers for tests and software validation purposes. Future versions of FLIP will make this capability available to the end user and all the usable functions will be documented.
FLIP lets you build, load and play a configuration file so that you can quickly configure a large number of devices or repeat a given sequence onto the same device.
You may build a configuration file by launching FLIP, executing commands and saving these commands into a configuration file. You may also write this configuration file by hand.
Launch FLIP and perform the following operations :
Even if you do not explicitely save a configuration file, it is built and saved anyway when you exit FLIP. In that case, it will be named flip.cfg by default and will be written in the directory in which the flip.exe file is located if you have write privileges to this directory.
Open the configuration file with a text editor to look at what FLIP has produced; you should see something like :
Use the File > Load Configuration... pulldown menu command to load and execute a configuration file.
You can then rerun the configuration file without loading it by simply pressing the F5 function key.
The configuration file is mainly made of calls to Tcl procedures defined in FLIP. Tcl being case sensitive, you must take care to the syntax.
Syntax : selectDevice <device_name>
Example : selectDevice T89C51RC2
The connection is made of two steps: you first specify a protocol and then connect to the device.
initProtocol <medium-protocol_name>
Syntax : parseHexFile "<hex_file_pathname>"
Example 1 : parseHexFile "D:/Labo/dev/app/Flip Dev/bin/2kisp.hex"
The double quotes may be omitted if the file pathname does not contain any space.
Example 2 : parseHexFile D:/Labo/dev/app/FlipDev/bin/2kisp.hex
Some devices only support a full chip erase operation; some others support full chip and per block erasing operations.
If you intend to erase several blocks, simply write several block erase lines with different block numbers.
Checking that a device is blank requires that you enter three lines :
set blankCheckAddr(start) <start_addr>
set blankCheckAddr(end) <end_addr>
set blankCheckAddr(start) 0000
Syntax : setupSecurityLevel <security_level>
Example : setupSecurityLevel 1
Syntax : setupBljbFuse <value>
The above commands do not actually perform the described operations, they only setup them. In order to execute the described operations, you must add a runOperations command to the configuration file.
You may comment out a line of the configuration file by inserting a "#" character at the beginning of the line.
Putting all this together, we can build a full configuration file :
# --------------- Configuration file example -------------------
# Device selection and communication setup
parseHexFile "D:/Labo/dev/app/Flip_dev/bin/2kisp.hex"
# Blank checking requires 3 lines
set blankCheckAddr(start) 0010
# Program the device with the above loaded HEX file
# Verify proper device programming
# Without the following line, nothing would be done!
(*) Please read the device data sheet to determine if the "on" value is 1 or 0.
It may happen that FLIP prompts you with warning or error messages; this chapter lists these messages and explains where they come from.
Check the communication medium connections and the target hardware power supply.
If everything is allright, reset the target hardware and select a smaller baud rate from the FLIP communication medium dialog box. For maximum performance purpose, FLIP and its software companion (the bootloader) do not perform any data flow control (no XON/XOFF). Therefore, at high baud rates, it may happen that the bootloader has no time enough to perform data management and does not answer properly to the FLIP commands or the answer comes too late.
The major part of the target device is protected against writing operations when the device is set to the security level 1 and protected against reading operations when the device is set to the security level 2. The above message means that the operation performed by FLIP is not legal.
The PC parallel port to CAN hardware interface did not execute the FLIP command properly.
The length of the CAN message sent by the bootloader is unexpected.
The CAN protocol stack specification mentions that while sending programming frames to the device, the bootloader may answer with a data byte of 0x00 if it got all data from FLIP, 0x02 if it expects more data from FLIP and 0x01 if the bootloader failed to execute the write command.
The bootloader has detected an error condition and signals it by an error message which is itself corrupted.
The bootloader has detected an error condition and signals it by an error message which length is not correct.
The bootloader answer contains an incorrect identifier.
During the device blank check operation, the bootloader has sent an incorrect answer to FLIP.
Probably a framing error detected by the microcontroller UART.
The selected serial port does not exist or has not been closed properly. Quit FLIP and start it again.
The bootloader has received from FLIP a frame which checksum is not correct.