Bus Pirate JTAG Programmer Part 2

Where did I leave off yesterday?  Oh that right I had just got openocd to talk to my BP.  Well I made some female jumpers this evening so that I could connect the the BP and the cygni together.

Step 5) Connecting to the Cygni board.  I used the JTAG pinout that DP has on their website for the BP and the corresponding schematic for the cygni off of teholabs site.  With the boards now connected together I gave it a go but I got some errors.  I reset the BP and then tried again with no luck.  I double checked that the boards were connected right and they were.  I tried again, no luck.  Then I saw that the power light on the cygni was coming on.  I assumed that the JTAG supplied power to the board but it wasn't/doesn't.  Easy fix.  I disconnected VPU and VTref and then gave the cygni 5v from the BP.  I ran openocd again and this time success!
$ openocd
Open On-Chip Debugger 0.6.0-dev-00322-g16b6b5e-dirty (2012-01-06-20:43)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
Warn : Adapter driver 'buspirate' did not declare which transports it allows; assuming legacy JTAG-only
Info : only one transport option; autoselect 'jtag'
srst_only separate srst_gates_jtag srst_open_drain
500 kHz
Info : Buspirate Interface ready!
Info : Want to set speed to 500kHz, but not implemented yet
Error: Translation from jtag_speed to khz not implemented
Info : adapter-specific clock speed value 500
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Warn : Bypassing JTAG setup events due to errors
Info : lm3s36n26.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'telnet' connection from 4444
There are some errors still which I should investigate.  Otherwise I think I am ready to load programs onto the board.  Actually I'm not ready.  The reset halt command isn't working and I expect it's due to the errors which I'm trying to figure out right now. It also looks nothing like the print out from teholabs.  There's no lines regarding devive id, part #, etc.  More later once I solve the issue.

Step 7) (teho) Flash the board.
UPDATE:  The cygni didn't like being powered by the 5v output of the BP.  I'm guessing that it didn't like the power on sequence.  Anyway I powered it from USB and ran openocd again.  This time it was actually a success!
$ openocd
Open On-Chip Debugger 0.6.0-dev-00322-g16b6b5e-dirty (2012-01-06-20:43)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
Warn : Adapter driver 'buspirate' did not declare which transports it allows; assuming legacy JTAG-only
Info : only one transport option; autoselect 'jtag'
srst_only separate srst_gates_jtag srst_open_drain
500 kHz
Info : Buspirate switched to FAST mode
Info : Buspirate Interface ready!
Info : Want to set speed to 500kHz, but not implemented yet
Error: Translation from jtag_speed to khz not implemented
Info : adapter-specific clock speed value 500
Info : JTAG tap: lm3s3n26.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)
Info : lm3s3n26.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'telnet' connection from 4444
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x41000000 pc: 0x01003ebc msp: 0x200007d0
auto erase enabled
Error: couldn't open blink.bin
in procedure 'flash'
auto erase enabled
wrote 1024 bytes from file blinky.bin in 1.735000s (0.576 KiB/s)
Info : Want to set speed to 500kHz, but not implemented yet
Error: Translation from jtag_speed to khz not implemented
in procedure 'adapter_khz'

Info : JTAG tap: lm3s3n26.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)
shutdown command invoked
Info : Shutting down buspirate.
Info : Buspirate switched to normal mode
The LED blinks!!

Bus Pirate JTAG Programmer Part 1

In this post I will be going through the steps to program the Cygni from teho labs using the Bus Pirate from Dangerous Prototypes.  I will be following the Cygini setup guide found on teho labs website and Gonemad's guide for JTAG with the Bus Pirate.  I will be writing this post as I am going through the process.

Step 1) (teho) Install drivers for the JTAG.  My Bus Pirate is up running so this step is complete.  I might have to load a different firmware but I'll get to that when I get to that point in the guide. (I didn't have to change the firmware.  It's running v6)

Step 2) (teho) Install G++ EABI, a cross compiler for ARM programs.

Step 3) (teho and gonemad) Install and setup Cygwin, OpenOCD and others.  I downloaded the Cygwin setup file and ran it. Now that thats installed it's time to build OpenOCD.  I followed teholabs and Gonemad's guide for this part.  I had to add '--enable buspirate' to ./configure command. That was an interesting process but it was successful! 

Step 4) (gonemad) Make sure that Bus Pirate works with Cygwin and OpenOCD. It works with Cygwin.  Time for OpenOCD.  This took a little work.  At first I tired just the
openocd -f buspirate.cfg
command but I had a space between - and f and didn't realize it at the time.  I then made a openocd.cfg file and entered this into it
# Change this line for your interface of choice
source [find interface/buspirate.cfg]

set CHIPNAME lm3s36n26
source [find target/stellaris.cfg]
I then ran openocd.  I didn't get what I expected so I reset the buspirate and tried again.  This time it worked and here's the output I got
$ openocd
Open On-Chip Debugger 0.6.0-dev-00322-g16b6b5e-dirty (2012-01-06-20:43)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
Warn : Adapter driver 'buspirate' did not declare which transports it allows; assuming legacy JTAG-only
Info : only one transport option; autoselect 'jtag'
srst_only separate srst_gates_jtag srst_open_drain
500 kHz
Info : Buspirate Interface ready!
Info : Want to set speed to 500kHz, but not implemented yet
Error: Translation from jtag_speed to khz not implemented
Info : adapter-specific clock speed value 500
Info : JTAG tap: lm3s36n26.cpu tap/device found: 0xffffffff (mfg: 0x7ff, part: 0xffff, ver: 0xf)
Warn : JTAG tap: lm3s36n26.cpu       UNEXPECTED: 0xffffffff (mfg: 0x7ff, part: 0xffff, ver: 0xf)
Error: JTAG tap: lm3s36n26.cpu  expected 1 of 1: 0x0ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x0)
Warn : Unexpected idcode after end of chain: 64 0x01ffffff
Warn : Unexpected idcode after end of chain: 96 0x00000000
Warn : Unexpected idcode after end of chain: 128 0x00000000
I didn't have the the BP connected to the cygni at the time so that might be the cause of some of the errors. Here's the output with the command openocd -f interface/buspirate.cfg
$ openocd -f interface/buspirate.cfg
Open On-Chip Debugger 0.6.0-dev-00322-g16b6b5e-dirty (2012-01-06-20:43)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
Warn : Adapter driver 'buspirate' did not declare which transports it allows; assuming legacy JTAG-only
Info : only one transport option; autoselect 'jtag'
srst_only separate srst_gates_jtag srst_open_drain
Info : Buspirate Interface ready!
Error: An adapter speed is not selected in the init script. Insert a call to adapter_khz or jtag_rclk to proceed.
in procedure 'init'
Info : Shutting down buspirate.
Info : Buspirate switched to normal mode
I will continue this after I make a cable for my BP so that I can connect it to the cygni.  Overall both guides have been extremely clear and straight forward.

Winter Break Update 2

Time for another update.  The various project are coming along but its time to return to school for another quarter, only two more until I graduate.  Here's an overview of the projects that have updates.

  • SNES to USB
  • Reflow Controller
  • Data Logger GUI
  • Hybrid Rocket

SNES to USB
I found out that my SNES to USB PCBs arrived in the US over four weeks ago and are now travelling back to Seeed Studio are sitting in the post office.  It seems like no an attempt to deliver them was made however they just left a note on my door rather than knocking(I was home all day.)  Seeed Studio is still a great PCB fab house and their standard shipping is pretty quick.  From order to arrival in California was only 2 weeks.  They also offer different thicknesses and colors for PCBs.  The board will get soldered up really soon after I get the package from the post office.


Reflow Controller
The code is pretty much done except for a few tweaks that will need to be made once I'm in the testing phase.  I whipped up a simple GUI(Graphic User Interface) using this as a template.  This was my first attempt at a GUI.  It took some time to understand how it was all working.  I found that GUI I was using as template was all event driven which is nice since that is similar to how microcontrollers are programmed.  I'm going to guess that that is how most GUIs are.

Early version

The GUI has a few buttons that allow the controller to be started or stopped.  It also has a box for commands to be entered and then sent to the controller.  It the final version the temperature profile will sent at intervals of 1 sec to the controller.  It also displays the profile and the actual profile on the graph.

To finish this project up I need to get a toaster over and either a mechanical relay or a solid state relay.


Data Logger GUI


Since I was working the GUI for the reflow oven I figured that I could change it a little and have a pretty nice GUI for Ser Tiny Logger, which was my original intention.  It is similar to the oven GUI but it has options for the number of channels and sample rate.  It also displays all the channel reading on the graph.  I need to add file output so that I can save the data that I collect.  Right now, as you can see from the graph it output in raw ADC counts.  I could add control box that allows the user to enter the sensitivity for the sensor that is being measured.


Hybrid Rocket
I finished almost all of the machining for it.  I had to order a tube for everything to fit in.  I need to machine a groove for an internal snap ring however I don't have a tool to do that.  I need to get a bench grinder so that I can grind my lathe tool bits.  This set back will give me some time to think more about the ignition sequence.  The one I'm am basing this off of uses some grain preheater that starts burning the grain and also burns through a burst disc, releasing the N2O.  It is probably the easiest way to do it but it'd be cool to have an automated valve/ignition system.



Recent Posts