debugging using flowcode: ghost...

4
SPONSORED CONTENT If you purchase a product or service via Flowcode.co.uk/circuitcellar, Circuit Cellar will receive an affiliate commission. Circuit Cellar only promotes those products or services that it feels will deliver value to you. SIMULATION AND CODE PROFILING Flowcode features a powerful simulator complete with 2D and 3D environments allowing you to test your code works as expected before you go anywhere near a microcontroller. The simulator can be used to do pretty much anything from lighting a few LEDs through to automatically generating a 3D maze and navigating it with a robot. When simulating a simulation debugger window appears which allows you to do things like slow down the program execution so you can see the icons in the program as they are called. The window also allows you to monitor the values inside variables in real time. Another great simulation feature is Code Profiling which allows you to monitor the statistics of how often a flowchart icon is called. This allows you to visually see which parts of your code are doing the main work and which parts are doing very little to help optimize your programs. It is also a great check to see if the icons you think should be being called every so Debugging Using Flowcode: Ghost Technology By Ben Rowland, Embedded Engineer Flowcode also features several debugging tools designed to help you develop your programs, get them working reliably, and eliminate any bugs. This article focuses on these debugging features. Matrix TSL’s Flowcode software allows you to quickly and easily develop complex electronic and electromechanical systems. Engineers use Flowcode to develop systems for control and measurement based on microcontrollers, on rugged industrial interfaces or on Windows compatible personal computers. Flowcode 7 feaures a stylish and modern new UI that gives users an easy-to-use, advanced graphical programming IDE for their microcontroller project requirements. Download a Free Trial and/or Buy Flowcode 7 flowcode.co.uk/circuitcellar/

Upload: dangdan

Post on 11-May-2018

217 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Debugging Using Flowcode: Ghost Technologycircuitcellar.com/wp-content/uploads/2017/01/319-Matrix...Flowcode is an IDE for electronic and electromechanical system development. Pro

SPONSORED CONTENT If you purchase a product or service via Flowcode.co.uk/circuitcellar, Circuit Cellar will receive an affiliate commission. Circuit Cellar only promotes those products or services that it feels will deliver value to you.

SIMULATION AND CODE PROFILINGFlowcode features a powerful simulator

complete with 2D and 3D environments allowing you to test your code works as expected before you go anywhere near a microcontroller. The simulator can be used to do pretty much anything from lighting a few LEDs through to automatically generating a 3D maze and navigating it with a robot.

When simulating a simulation debugger window appears which allows you to do things like slow down the program

execution so you can see the icons in the program as they are called. The window also allows you to monitor the values inside variables in real time.

Another great simulation feature is Code Profiling which allows you to monitor the statistics of how often a flowchart icon is called. This allows you to visually see which parts of your code are doing the main work and which parts are doing very little to help optimize your programs. It is also a great check to see if the icons you think should be being called every so

Debugging Using Flowcode: Ghost Technology

By Ben Rowland, Embedded EngineerFlowcode also features several debugging tools designed to help you

develop your programs, get them working reliably, and eliminate any bugs. This article focuses on these debugging features.

Matrix TSL’s Flowcode software allows you to quickly and easily develop complex electronic and electromechanical systems. Engineers use Flowcode to develop systems for control and

measurement based on microcontrollers, on rugged industrial interfaces or on Windows compatible personal computers. Flowcode 7 feaures a stylish and modern new UI that gives users an easy-to-use, advanced graphical programming IDE for their microcontroller project requirements.

Download a Free Trial and/or Buy Flowcode 7

flowcode.co.uk/circuitcellar/

Page 2: Debugging Using Flowcode: Ghost Technologycircuitcellar.com/wp-content/uploads/2017/01/319-Matrix...Flowcode is an IDE for electronic and electromechanical system development. Pro

SPONSORED CONTENT

often are actually getting called as often as you think.

Flowcode 7 user David Johnson explained how impressed he was with this feature which is new to version 7:

“With code profiling, you are able to examine how your code is behaving

as it is running, allowing you to pinpoint sections of code that have become ‘redundant’ as your project develops over time. Users can then

optimise the code they use.

Code profiling provides the ability for the user to check code

‘dynamically’ (whilst it is running), a feature which has only been launched this year to coincide with the release of version 7. I am a Flowcode user

and so for the past couple of months I have been exploring more of the software features and I can assure

you, it’s much more than just showing “hits per icon”.

GHOSTSo, once you’re happy that the

program is working how it should be in the simulation you can move to the real thing and get your code running on the microcontroller hardware. There are a number of additional tools that will help you to diagnose problems on your hardware all based around something known as Ghost Technology. Ghost consists of two distinct modes which can be used individually or together: In-Circuit Debug (ICD) and In-Circuit Test (ICT).

Ghost hardware includes the E-blocks hardware system—EB006 8-bit PIC Multiprogrammer, the EB091 dsPIC Programmer, and the FlowKit II all of which are available from www.matrixtsl.com.

The EB006 and EB091 board feature ICT sampling at up to 100KHz. The FlowKit II features ICT sampling at up to 1MHz and can be hooked onto any microcontroller development system or third party circuit board including Arduino.

Figure 1 - Flowcode IDE in code profiling mode

Figure 2 - ICT sample rates and settings

Page 3: Debugging Using Flowcode: Ghost Technologycircuitcellar.com/wp-content/uploads/2017/01/319-Matrix...Flowcode is an IDE for electronic and electromechanical system development. Pro

SPONSORED CONTENT If you purchase a product or service via Flowcode.co.uk/circuitcellar, Circuit Cellar will receive an affiliate commission. Circuit Cellar only promotes those products or services that it feels will deliver value to you.

GHOST: IN-CIRCUIT DEBUGIn-circuit debug allows you to monitor

and control the execution of your program on the microcontroller the same as you can with the simulation. You can run, pause, step, manage breakpoints and monitor global variables in real time.

ICD mode works by using two pins on the microcontroller to talk to the Ghost enabled USB chip which then allows Flowcode to talk to your program in real time. The extra code to manage the ICD mode is automatically included in your project simply by switching the ICD mode on. Each and every flowchart icon gets a unique address and by interrogating this address Flowcode can work out exactly where you are in the program. Variables

are monitored by automatically collecting variable addresses from the compiler output files and using the microcontroller to send back the values from the address as requested.

The Flowcode simulator turns green to confirm you are now in ICD mode. The only thing you cannot do when using the In Circuit Debug mode is use the two pins responsible for the ICD communications with the Ghost chip in your program.

GHOST: IN-CIRCUIT TESTIn circuit test allows you to monitor

the signals around your microcontroller allowing you to monitor and track the microcontroller’s reaction to real world stimuli. You can monitor both analogue and digital types of signal as well as being able to decode several types of communications protocol.

ICT mode works by the Ghost enabled USB chip having high impedance taps to all your target microcontroller pins. The Ghost chip monitors and records the selected pins, compresses the information and transfers the data to Flowcode.

Flowcode monitors which pins are used in your program and only records the pins

Figure 4 - Flowcode in ICD mode. Note the green!

Figure 3 - How Flowcode and Ghost Technology work on the host and Ghost chips of the EB006 and EB091 hardware devices

Page 4: Debugging Using Flowcode: Ghost Technologycircuitcellar.com/wp-content/uploads/2017/01/319-Matrix...Flowcode is an IDE for electronic and electromechanical system development. Pro

SPONSORED CONTENT

that are being used for meaningful data to make the most of the available buffer space and to minimize any potential latency problems.

CONCLUSIONThe challenge of testing and debugging

programs when working with various microcontrollers is common and often tricky. Flowcode gives users unique features such as Ghost Technology and subsequently ICD and ICT to allow them to easily diagnose their systems.

By providing engineers with a real-

time log of the status of all the pins on microcontroller, we allow you to speed up your developments and also give those who’re newer to microcontroller programming the ability to learn key test and debugging principles in a unique and interesting way.

Ben Rowland is a graduate of the University of Huddersfield in the UK. He graduated with a Master’s degree in Embedded Systems & Cybernetics before going on to work in the Flow-code development team at Matrix TSL, where he has worked for more than 10 years.

Flowcode is an IDE for electronic and electromechanical system development. Pro engineers and academics can use Flowcode to develop systems for control and measurement based on microcontrollers or on rugged industrial interfaces using Windows-compatible personal computers.

Visit www.flowcode.co.uk/circuitcellar to learn about Flowcode 7. You can access a free version, or you can purchase advanced features and professional Flowcode licenses through the modular licensing system. If you make a purchase through that page, Circuit Cellar will receive a commission.

Download a Free Trial and/or Buy Flowcode 7

flowcode.co.uk/circuitcellar/

FREE

Figure 5 - The Flowcode data recorder detailing monitoring activity on the microcontroller