Debugging SUB-20 applications

All about Sub-20 Multi Interface USB Adapter USB to I2C, SPI, GPIO, RS232, RS485, Ir, LCD

Moderator: serg

Post Reply
serg
Posts: 143
Joined: Mon Aug 31, 2009 9:17 pm

Debugging SUB-20 applications

Post by serg »

In some rare cases, when a problem is not obvious we ask our customers to provide us with a trace log of communication between SUB-20 board and a host PC.

Capturing trace log under MS Windows

This can be achieved by using the SUB-20 tool GUI application, included into the standard SUB-20 software package and DebugView capture utility, which can be downloaded from the Microsoft website http://technet.microsoft.com/en-us/sysi ... s/bb896647

Below are the steps you should follow in order to capture the communication trace log.

1. Run the SUB-20 tool application, switch to the "Debug" tab and set the "Debug Level" to 10.
You can also call the sub_set_debug_level function or the SetDebugLevel .NET method from your code to set the DebugLevel to desired value. The maximum value is 10. This value is stored in a memory of the loaded instance of the sub20.dll, therefore don't close this application until you finish with the debugging. Also, having multiple sub20.dll instances on a same system may cause a situation when the DebugLevel is set in one instance and debugging application is using different instance of the sub20.dll. The best practice is to have only one instance of the sub20.dll, located in the Windows\System32 directory or Windows\sysWOW64 directory if 32-bit SUB-20 package installed on a 64-bit system.
sub-tool-debug.JPG
sub-tool-debug.JPG (37.55 KiB) Viewed 10919 times
2. Run the DebugView utility and make sure that Menu->Options->Force Carriage Returns is "unchecked"
3. Run your application until an error or a weird behavior happens
4. Click the "capture" icon or press Ctrl-E to stop the capturing
5. Save the log into a file (Menu->File Save As)

Here is an example of the trace log
SUB-20 log.JPG
SUB-20 log.JPG (96.9 KiB) Viewed 10920 times

Post Reply