Using the FlowKit ICD Tool
Posted: Fri Feb 26, 2010 11:06 am
The FlowKit In-Circuit Debugging (ICD) tool is a great new way of debugging your Flowcode v4 embedded programs. It also allows the monitoring / updating of variables in real time which means that communications from other systems such as RS232, CAN, Zigbee etc can be injected and tested without requiring the other communications node to be up and running. The FlowKit comes complete with an E-Blocks adapter and a USB out socket to allow you to connect up an E-Blocks set, or one of our USB reprogrammable devices. As well as these options there are also single pin connections available allowing you to connect just about any 3rd party or custom hardware. Basically if Flowcode v4 can target the hardware then the FlowKit ICD tool can debug it on a Flowchart icon level. As a side note the EB006 v7 can also perform ICD functionality as shown here but is limited to EB006 compatible PIC devices only.
Firstly we have to setup Flowcode to use the FlowKit device. This is done via the Project Options window, which is available from the View menu. The code to drive the FlowKit is enabled by ticking the ICD Mode option. On the right hand side of the window are some settings for the FlowKit that define some of the basic functionality.
Breakpoint count - defines the maximum number of breakpoints you wish to enable in your program. The more you have enabled the more memory the ICD driver code requires on your embedded target device.
Callstack depth - Defines the maximum number of jumps in your stack. This will be 8 by default but means that software stacks such as the one included with BoostC can still be used while debugging.
Communication speed - Defines the bus speed between your embedded device and the FlowKit. The number represents a delay so the smaller the number the faster the communications speed. This is automatically calculated based on your clock speed to provide an optimum communication speed.
Override ICD pins – Allows the ICD pins to be manually specified instead of taking the default values from the Flowcode definition file (FCD).
ICD Functionality
Once you have been into your program and changed the settings in the project options window it is time to program your device and get debugging. The debugger is started in the same way as you would start a normal Flowcode simulation (by clicking the simulation play button or one of the simulation step buttons inside Flowcode). You may note that the 'current icon' marker is now green instead of red when in simulation mode.
Variables can be added to the debugger in the same way as the simulation by right clicking the Variables window and selecting 'add variable'. Note that the variables window is only available when the ICD or the simulation is running or paused.
Breakpoints can be set or cleared by right clicking a flowchart icon and selecting toggle breakpoint. When a program has active breakpoints the debugger will pause on the specific icons that have their breakpoint enabled.
When the FlowKit is inactive the onboard LEDs remain at a constant brightness. When your target program is running the FlowKit pulses its LEDs rapidly and when the target program is paused the FlowKit pulses the LEDs slowly.
Note that if your Flowcode program changes at all then you will have to recompile the program to the device before you will be able to proceed with debugging.
FlowKit Hardware Configurations
Following are some examples of how the FlowKit would be used to interface with several different hardware setups.
HP488 development board
When using the E-Blocks adapter board as shown above the ICD pins are automatically routed to bits 6 and 7 of the port. The E-Blocks adapter board even allows for E-Blocks to be connected so you are not sacrificing an entire port for the ICD functionality. For the setup shown above I have to manually change the ICD pins to Port C pins 6 and 7. If pins 6 and 7 are not an option for you then you can instead wire single pin connections from the FlowKit to the E-Blocks adapter board remembering to connect the ground as well as the ICD clock and data pins.
Other hardware that can be used in this method:
EB019 AVR Board
EB006 v6 or earlier
ECIO Application Board
EB031 ARM Board (when Flowcode v4 ARM is available)
MIAC
When using the FlowKit with one of our USB Bootloader products it is possible to use the same USB cable for both re-programming and debugging. These USB products all have their default ICD pins set so that the USB connection is the default connection for ICD communications. Debugging the hardware is achieved by moving the switch on the FlowKit to the ICD position. Programming the hardware is achieved by moving the switch on the FlowKit to the Prog position.
Other hardware that can be used in this method:
ECIO PIC
ECIO ARM (when Flowcode v4 ARM is available)
Formula Flowcode
Locktronics PIC
Note: The ECIO devices will not work with the FlowKit unless they are using the EXT power method. This is because the USB connection is being used for ICD communications and therefore is unable to supply the power required to run the ECIO in USB power mode. Flowcode USB components will also fail to work when using the ICD through the USB OUT cable so single pin connections must be used instead.
3rd Party / Custom Hardware
Microchip development boards generally come with an ICSP header that is used with a PICkit programming tool to provide re-programming functionality. The ICSP header on these boards can also plug directly into the single pin connections on the FlowKit so that the board can be both powered and debugged at the same time via the one connection. For other third party hardware, wires can be connected from the socket on the FlowKit directly to the I/O pins of your choice. The ICD pins are labelled as ICDC and ICDD, which stand for clock and data respectively. You will also need to connect a third wire for ground if you are using the individual wire connections.
Troubleshooting
The most common causes of the FlowKit communications failure is due to one of the two following problems.
1) You are using the ICD pins in your program.
If you are sending data to the port that the ICD is connected to (as shown in picture ss3) then you must use the masking feature so that the ICD pins remain untouched (as shown in picture ss4). The same goes for inputs, component connections and C code etc.
2) The program on the target device is out of date.
If the star appears on the Flowcode title bar for any reason indicating that there are unsaved changes then you will have to save the file and recompile to the target device. Here is a list of common things that will cause Flowcode to require a re-save and therefore a re-compilation.
Changing Project Options,
Changing the contents of an icon properties page,
Clicking OK on a property page,
Moving / Modifying items on the panel,
Modifying the Flowchart.
More information on using the FlowKit can be found in the device datasheet available from here: http://www.matrixmultimedia.com/datashe ... 9-30-1.pdf
Firstly we have to setup Flowcode to use the FlowKit device. This is done via the Project Options window, which is available from the View menu. The code to drive the FlowKit is enabled by ticking the ICD Mode option. On the right hand side of the window are some settings for the FlowKit that define some of the basic functionality.
Breakpoint count - defines the maximum number of breakpoints you wish to enable in your program. The more you have enabled the more memory the ICD driver code requires on your embedded target device.
Callstack depth - Defines the maximum number of jumps in your stack. This will be 8 by default but means that software stacks such as the one included with BoostC can still be used while debugging.
Communication speed - Defines the bus speed between your embedded device and the FlowKit. The number represents a delay so the smaller the number the faster the communications speed. This is automatically calculated based on your clock speed to provide an optimum communication speed.
Override ICD pins – Allows the ICD pins to be manually specified instead of taking the default values from the Flowcode definition file (FCD).
ICD Functionality
Once you have been into your program and changed the settings in the project options window it is time to program your device and get debugging. The debugger is started in the same way as you would start a normal Flowcode simulation (by clicking the simulation play button or one of the simulation step buttons inside Flowcode). You may note that the 'current icon' marker is now green instead of red when in simulation mode.
Variables can be added to the debugger in the same way as the simulation by right clicking the Variables window and selecting 'add variable'. Note that the variables window is only available when the ICD or the simulation is running or paused.
Breakpoints can be set or cleared by right clicking a flowchart icon and selecting toggle breakpoint. When a program has active breakpoints the debugger will pause on the specific icons that have their breakpoint enabled.
When the FlowKit is inactive the onboard LEDs remain at a constant brightness. When your target program is running the FlowKit pulses its LEDs rapidly and when the target program is paused the FlowKit pulses the LEDs slowly.
Note that if your Flowcode program changes at all then you will have to recompile the program to the device before you will be able to proceed with debugging.
FlowKit Hardware Configurations
Following are some examples of how the FlowKit would be used to interface with several different hardware setups.
HP488 development board
When using the E-Blocks adapter board as shown above the ICD pins are automatically routed to bits 6 and 7 of the port. The E-Blocks adapter board even allows for E-Blocks to be connected so you are not sacrificing an entire port for the ICD functionality. For the setup shown above I have to manually change the ICD pins to Port C pins 6 and 7. If pins 6 and 7 are not an option for you then you can instead wire single pin connections from the FlowKit to the E-Blocks adapter board remembering to connect the ground as well as the ICD clock and data pins.
Other hardware that can be used in this method:
EB019 AVR Board
EB006 v6 or earlier
ECIO Application Board
EB031 ARM Board (when Flowcode v4 ARM is available)
MIAC
When using the FlowKit with one of our USB Bootloader products it is possible to use the same USB cable for both re-programming and debugging. These USB products all have their default ICD pins set so that the USB connection is the default connection for ICD communications. Debugging the hardware is achieved by moving the switch on the FlowKit to the ICD position. Programming the hardware is achieved by moving the switch on the FlowKit to the Prog position.
Other hardware that can be used in this method:
ECIO PIC
ECIO ARM (when Flowcode v4 ARM is available)
Formula Flowcode
Locktronics PIC
Note: The ECIO devices will not work with the FlowKit unless they are using the EXT power method. This is because the USB connection is being used for ICD communications and therefore is unable to supply the power required to run the ECIO in USB power mode. Flowcode USB components will also fail to work when using the ICD through the USB OUT cable so single pin connections must be used instead.
3rd Party / Custom Hardware
Microchip development boards generally come with an ICSP header that is used with a PICkit programming tool to provide re-programming functionality. The ICSP header on these boards can also plug directly into the single pin connections on the FlowKit so that the board can be both powered and debugged at the same time via the one connection. For other third party hardware, wires can be connected from the socket on the FlowKit directly to the I/O pins of your choice. The ICD pins are labelled as ICDC and ICDD, which stand for clock and data respectively. You will also need to connect a third wire for ground if you are using the individual wire connections.
Troubleshooting
The most common causes of the FlowKit communications failure is due to one of the two following problems.
1) You are using the ICD pins in your program.
If you are sending data to the port that the ICD is connected to (as shown in picture ss3) then you must use the masking feature so that the ICD pins remain untouched (as shown in picture ss4). The same goes for inputs, component connections and C code etc.
2) The program on the target device is out of date.
If the star appears on the Flowcode title bar for any reason indicating that there are unsaved changes then you will have to save the file and recompile to the target device. Here is a list of common things that will cause Flowcode to require a re-save and therefore a re-compilation.
Changing Project Options,
Changing the contents of an icon properties page,
Clicking OK on a property page,
Moving / Modifying items on the panel,
Modifying the Flowchart.
More information on using the FlowKit can be found in the device datasheet available from here: http://www.matrixmultimedia.com/datashe ... 9-30-1.pdf