Brad Stewart

Using the usbWiggler

Discussion created by Brad Stewart Employee on Jun 14, 2010
Latest reply on Apr 21, 2011 by Yogesh Yogesh

Recently, I had the opportunity to test the low cost USBWigger on a iMX51 EVK (Babbage Board).  I was hoping to overcome the need to purchase/beg/borrow an ARM RealView system as it costs several thousands of dollars.  The USBWiggler, on the other hand, retails at about $250.  A faster version, called USB2Demon, offers faster data transfer at a slightly higher cost.  Both units connect to the JTAG port of the EVK, and the other end connects to the host PC running Window.  In my case, I am using Windows XP SP3. 


So far, the device seems to work reasonably well.  It has some limitations, as will be explained later on.  I was able to connect and examine internal SRAM memory, view the ARM registers, single step, and run the code. 


The software that comes with the device is called OCD Commander.  It's written in Java.  It's not a full-featured debugger, but it does allow you to upload code or macro commands, so it should be able to bring up a bare-metal system, set the clocks, power management, DDR registers, etc. 


Sounds good, right?  But there are some issues you need to be aware of before using this.


You need to short one of the resistors on the EVK to let the Wiggler firmware sense voltage correctly.  The resistor is R341.  It's located on the top of the PCB between the JTAG connector and the small button battery.  I simply soldered a wire to short the resistor.


You need to boot up with Uboot or RedBoot.  This is the limitation I spoke of earlier.  With no bootloader present, the EVK will never "turn on".  I suspect this is because the internal boot ROM is not enabling the PMIC or does not disable the WDT, or something.  But whatever the bootloader is doing, it allows the burn to turn on and stay on.  Hopefully, I find a way to allow JTAG connections without first running a bootloader.


You need to configure the OCDCommander to talk with the JTAG logic inside the ARM.  In the case of the iMX51, you need to define "multiple devices."  When the OCD Commander Setup window appears, click the check box Multiple Devices.  then add the following three devices:


Index       Vendor                 CPU           IR Len         Bypass Op     DR Bypass Len



0            FREESCALE        iMX51x          -                     -                        -      

1            OtherJtagDevice      -                  4                   f                         1

2            FREESCALE        iMX_SJC        -                    -                         -




If you look in the help file under OcdCommander Configuration, you'll see how to set up for other ARM processors (such as iMX23, etc).


NOTE:  When you first apply power to the EVK or Wiggler, it won't boot.  I think the reason is that the Wiggler is holding the reset line.  To fix this, run one of the provided programs.  You can use OCDCommander, but you'll have to run it again.  I use USBDemon Finder.  Once you do this, the Wiggler should connect.


When you first turn on the EVK, and with Uboot or RedBoot started, disable the booting of Linux by using Ctrl-C from the terminal program to get the bootloader prompt.  Or change the bootloader script to stop at the prompt and not load the OS.


When you get the message, "Initialized target at speed1:  6 MHz", you are connected. 


At this point, click on the Halt button.  Once the processor is halted, you can view memory and registers.


For example, to view the first 100 16-bit values of internal SRAM, type the command,

half 0x1ffe0000 100

to run a ram test on the first 0x100 locations, issue the command:

ramtest 0x1ffe0000 0x100 2

Curisously, this test fails if you use a "4" instead of a "2", signifying that the test should run using 32-bit words.  I guess internal SRAM is x16.  Can anyone verify this?