Saturday, April 15, 2017

Graphically Visualize Embedded System Internals Using uC/Probe

Most of the organizations in today's world prefers to work on ARM cores, and with the introductions of Cortex-M0 and Cortex-M0+, the 8-bit market shares of companies like Microchip, Atmel and others are dropping. The reason behind this is definitely the number of features and tools we are getting with ARM cores. 
In this post i will discuss about a tool uC/Probe from Micrium Embedded Software, when i saw this i thought to try this as it looks very cool, just like LabVIEW, but it's way too simpler than LabVIEW, although it's senseless to compare both these tools, but the front end GUI of uC/Probe reminds me of LabVIEW that's why i mentioned it. So let's get started with uC/Probe.

Introduction:
uc/Probe visualizes and controls the internals of embedded system with just few clicks on the widgets present on the design area, which we can also called as GUI. I will take a simple example to show you guys what we can do with uc/Probe.
I have one LPC1343 development board with me, in this board i have written a demo program which will increment a counter every milli-second, plus toggle the state of on a led from ON State to OFF State, every second, and internal analog to digital converter is used to measure the voltage(adc count) controlled by a potentiometer.
Note: The Internal ADC is of 10-bit, which means we can get maximum of 1023 values as adc count, and these adc counts are converted into percentage, i.e. if count is 1023 then 100% and if count is 0 then 0%.

uC/Probe Application
The above figure shows the data screen of uC/Probe, as you can see clearly that the above figure has three indicators, one for millisecond counter, another for led status and the last one for adc count percentage.

Steps:
Now let's discuss the steps used to design this data screen in uC/Probe to visualize the internals of our Embedded System, but before that we need the embedded system firmware which is written in IAR Embedded Workbench for ARM, apart from this you also need a debugging tool, you can use any debugging tool of your choice, in my case i am using Segger J-Link. You can download the source code for IAR by clicking here, though is not required because your application will be different, but still if you want you can take reference of this project.
Now follow the steps given below or watch the following video:


  • Enable the uC/Probe plugin in IAR as shown below.
Enable uC/Probe Plugin
  • Open the uC/Probe, and add the text box indicator, we will use this for displaying millisecond counter.
Add Text Box for millisecond Counter
  • Now add the Led Indicator, we will use this for indicating the On/Off state of Led.
Add Led Indicator for displaying Led Status
  • For Off state we already have one indicator with zero value, and for another add state with another color and with value equals to one.

  • Now add the Cylinder, we will use this for indicating the potentiometer adc count in percentage.
Add Cylinder for ADC Count Percentage
  • Once these indicator is present, its time to load the debugging file by clicking on the ELF button, and then loading the *.out file present in the Debug folder of IAR (Note: This format can vary for your application)
Load Debug file.
  • Clicking on setting, and select TCP/IP and then enter the "localhost" as IP address and "1930" as port.
Establish Connection
  • Now it's time to map the variables with indicators, this can be done by simply clicking and dragging the desired variable over the indicator, so map msTicks with text box, adc_data with cylinder indicator and led_state with led indicator.
Drag Variables to the Indicator
  • Now go back to the IAR and program the device using debugger and then start debugging.
Start Debugging in IAR
  • Now in uC/Probe run the design and you will see the output as shown in the image above, it looks very cool.

So without doing a single line of coding we have designed a user interface which can help in debugging of embedded device by visualizing the internal variables.
There are lots of features present in uC/Probe which i will not be able to cover in this post, you can look over these features.
In the current scenario, we used a debugger and IAR, but uC/Probe can work independently by using RS232, USB interface, so you can give that try if you want.
(Note: For using RS232 and USB Interface, you have to merge the company provided code into your embedded system firmware, then only it can work.)

Click here to down the design file and source code of my simple project.

2 comments: