Author Topic: Debugging. Is. AWESOME  (Read 2863 times)

0 Members and 1 Guest are viewing this topic.

Offline Razor ConceptsTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
    • RazorConcepts
Debugging. Is. AWESOME
« on: August 04, 2010, 03:54:25 PM »
If you are doing some even slightly complicated stuff, try debugging! In the case of AVRs, you need a JTAG ICE MKII to do it. But debugging is so awesome. I'm coding MSP430s, with a debug enabled programmer, and it is SO much easier than serial-print debugging, trial and error, uploading new code, seeing if it works, reuploading, etc etc.

Basically debugging enables you to go through step by step of your code and monitor EVERY variable you make and EVERY register that is being modified so you know EXACTLY whats going on in the microcontroller!! No more guess and check!! Makes life so much easier. DEBUG  ;D ;D ;D

Offline amando96

  • Robot Overlord
  • ****
  • Posts: 187
  • Helpful? 1
Re: Debugging. Is. AWESOME
« Reply #1 on: August 04, 2010, 04:33:10 PM »
gotta agree, MPLAB IDE comes with a debugger that's a dream, saves time programming and stuff  :D
Rorcle, 60% complete
AATV, 5% complete

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
    • Personal Website
Re: Debugging. Is. AWESOME
« Reply #2 on: August 04, 2010, 05:07:32 PM »
lol, little excited? Yeah in circuit debugging is cool. That's how i got through writing programs in assembly.

My first robot since legos didn't have the option for a debugger or even a serial to use, we ended up having 10-20 distinct short songs played through a speaker so we knew what part of the code the robot was in, and therefore where it was crashing. The rest of the students in the lab weren't really happy with us however. 

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: Debugging. Is. AWESOME
« Reply #3 on: August 05, 2010, 12:34:44 PM »
You can use AVRStudio to debug, single step, view variables, registers,set breakpoints etc. By just running the code in the simulator - ie you just do it all on your PC.  Although it doesn't work too well if you have compiled with optimisations enabled. Also their data definitions of each processor have some bugs in them - so on an ATMega640 (eg Axon or Axon II) then Timer4 (or it may be 5) doesn't work properly.

The other problem with simulators is that it doesn't work with things like I2C (coz the other device isn't plugged into your PC). There is a specification for 'stimuli' files that allows you record the contents of input pins and you can then run the simulator and it reads these values back. A kind of record and playback.

But yep - in circuit debugging is very cool as you are looking at the actual chip 'in situ' rather than some kind of simulation of whats going on. But the simulator is still useful for checking over basic stuff and for checking timings of PWM etc etc.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

paulstreats

  • Guest
Re: Debugging. Is. AWESOME
« Reply #4 on: August 05, 2010, 03:30:57 PM »
I just got a PICKIT 2 so I could use in circuit debugging (I used to use a homemaden programmer but ICD is a must now).
 The simuator that comes with MPLAB is also essential if you are modifying the hardware stack, its good to be able to see this.

 Serial Port communications are also essential for higher level debugging, being able to read map data into the pc (and also control your robot through the serial is good for 5 minutes fun ;D)

Offline Asellith

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 648
  • Helpful? 9
  • "I'm a leaf on the wind. Watch how I soar"
    • CorSec Engineering
Re: Debugging. Is. AWESOME
« Reply #5 on: August 06, 2010, 11:53:49 AM »
where did you get yours? how much? and does it work on the axon? I've been thinking of getting this for a while because yes debugging while programming an MCU project is SO much easier. Digikey has it for $300 thats way to much and I can find knock offs for around $80 - $150 that's do ok but still pricey. More then I spent on my axons.
Jonathan Bowen
CorSec Engineering
www.corseceng.com

Offline Razor ConceptsTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
    • RazorConcepts
Re: Debugging. Is. AWESOME
« Reply #6 on: August 06, 2010, 12:09:50 PM »
I don't have once since I'm moving on to other platforms, but looks like there are a lot of DIY JTAG programmers - heres one (closed source)
http://www.scienceprog.com/build-your-own-avr-jtagice-clone/

Wouldn't cost too much to mess around with these, but I would imagine the debugging would be really slow  :-\  For MSP430, using the TI debugger is really fast, but using the Launchpads built-in one, it just crawls....

 

SMF spam blocked by CleanTalk