View Full Version : [Question(s)] What's your ISP programmer work flow?

06-17-2013, 08:40 PM
Hey guys,

I got a Pololu USB AVR Programmer in today and just got it working with Arduino 1.05 and the Arbotix Robocontroller. I got it mainly because i wanted to quit having to swap the Xbee in and out every 5 minutes while debugging and testing. I'm also really liking how fast this thing is uploading!

Question 1: I failed to realize until now that even though the Pololu AVR Programmer is a virtual serial device, it isn't physically connected to the serial lines on the board. So I can't use serial terminal debugging methods unless i go back to the FTDI setup. I suppose i could install the Xbee and use the UARTsbee on my PC as a serial link. Would that method work? But then i'd be swapping radios between my PC and Commander which sort of defeats the purpose. I guess i can send commands from the PC. Is there a way i can physically connect the FTDI interface for its serial port, but use the ISP for programming? But the Xbee would probably break that functionality and i'd be back to square one.

How do you guys setup your debugging/test flow using the ISP programmer? Any advice on how to maximize my efficencey here? I normally upload my code with serial debug prints with a hard coded navigation command. Make sure it works, then take out the serial prints, upload, install the Xbee, and test with the Commander. loop over and over.


06-17-2013, 10:59 PM

I don't see a reason why the ICSP + XBee + UARTsBee setup wouldn't work. I have done something similar once I think. I don't really see what purpose it defeats though, wasn't the goal to get rid of the tiresome XBee uplugging and replugging?

Connecting an FTDI cable and an ISP (or JTAG) at the same is no problem either in principle.

It seems to me that you want to debug the code of the MCU of the Arbotix of your robot when it is talking with the controller through the xBee: is that it?
If that's the question, then, if we consider that none of the UART can be polluted with debug messages in any way, the only option I can think of would be to use another communication port on the Arbotix fo the printing the debug information.
The general idea would be to use another peripheral on some of the free I/O of the MCU to output information to another board that would then relay that info to a virtual COM port on the computer.

It's a shame this option is not directly available in the Pololu Programmer (to act as a SPI slave on the ISP pins and send back the bytes to the virtual COM port thay have already declared...)...

So the options for that that I can think of are (considering that all UARTs on the MCU are already used):
- soft serial + FTDI [very slow]
- I2C (master) + Arduino (slave) [reasonably fast]
- SPI (master) + Arduino (slave) [very fast]
- parallele + Arduino [the fastest possible, if you have around a dozen pins available :D ]
Unfortunately, I don't know if these tools have already been developped, you might need to DIY...
BTW, a Teensy (arduino compatible but much better in terms of code optimisation) would be the most efficient platform I can think of to use as such a tool.

Alternatively to using an Arduino, you could hook up a logic analyser (like the Saleae Logic) on the communication pins and have a look at what is said on the debug output, but you loose the "live" aspect of the feedback :/
The Bus Pirate could maybe be of help too.

06-18-2013, 12:03 AM
As I have mentioned before is I often use my logic analyzer.

In addition with commander I have a vb app, that i have that you select two comm ports, one that logically you connect commander to, and other connect robot to. The app forwards everything sent by commander to the robot, and displays everything sent by robot in a list box.

Alternatively with my DIY remote, the xbees are setup in packet mode, and I have protocols to display stuff on led or can send to debug terminal program on PCM...


06-18-2013, 01:02 AM
If you have an XBee link, just use that for your output display, too. Define some packet type that has text as payload, and display it on the other side.

I often use a logic analyzer: Saleae Logic 8. I recently also got an oscilloscope, which is not as good for logic signals, but much better for analog or repeating signals.

I almost always end up using I2C for interfacing to my microcontrollers (or even between microcontrollers -- I have a post upcoming about the new power management on Onyx!) On Onyx, I now have a teeny-tiny (0.98" diagonal) OLED display, that gives me 21 columns and 4 rows of text.

Finally, I make sure to always have at least one output for a "diagnostic" LED. If I want to know that I'm making it somewhere (or not making it somewhere,) I turn off the LED in start-up, and turn it on in the particular piece of code I'm interested in. Because re-running my code is a simple ":make flash" from within vim (using a serial programmer,) making a change and seeing whether the LED shows up or not will quickly let me zoom in on what's going on in the code.

And, yeah: ICSP programming is the win. In fact, I've used two of them at times, programming two different boards that talk to each other :-) As long as each make file can tell the two apart (different models, or different serial ports) then ":make flash" in the right window programs the right device.

06-19-2013, 05:11 PM
Thanks for the feedback. You guys are more advanced than me. I'm super pumped with just the standard ISP setup now. I can leave it connected all the time, leave my Xbee installed. Its making life much easier. I'm just swapping the Xbee between the Commander and UARTsbee on the PC as necessary to either control it or monitor serial output. I should probably make more use of diagnostic LEDs, that's a good idea.

Now that I've programmed the board using ISP, did i overwrite my Arduino bootloader?

What is the difference in the Arduino menu between AVRISPvII and AVRISPvII (serial)? Right now i'm using the serial option and I don't fully understand why it works. I thought that I'm no longer using a serial interface? Or does that just refer to the virtual COM port?

06-19-2013, 05:28 PM
I just ordered one of the programmers for myself, as I too was getting tired of having to pull the Xbee. I'm not specifically using the commander, but I use a PS3 controller paired with my laptop via bluetooth. I used Pygame to read the joystick values and spit out commander packets to the connected Xbee. I get messages back from the bot (when I get Leg IK fail messages for example). This is not the same code you are using, but you can definitely return debug data back to the computer. If you have a PS3 or other controller you want to use you could do like I did and use it instead of the commander.
Eventually I am going to make up a custom controller but for working things out I like the laptop/PS3 combo.

06-19-2013, 08:01 PM
Now that I've programmed the board using ISP, did i overwrite my Arduino bootloader?

Maybe, if your program was big enough.

There are two parts of the "bootloader" process: Getting the bootloader code into the right place, and making sure that the bootloader is started on start-up.

The bootloader lives in the top few kilobytes of RAM. If your program is < 28 kB then you will not overwrite the bootloader code.

The "start bootloader on start" behavior is set with a "fuse bit." When you set the fuses manually, you get to choose this behavior. If you're using the Arduino IDE, I don't know what it does with these bits. It would make most sense that, if you're using an ISP programmer, you don't need the serial bootloader, so it would turn that off.

Worst case, you're a "burn bootloader" menu item away from restoring it.