debugging an AVRmega8535 using SPI

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,
I am new to the AVR (actually I used it four years ago) and wonder if there is a good solution for debugging the AVRmega8535 using the SPI interface. A monitor for example with support on the PC-side for WinAVR or GDB for example.
/Janne

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It is possible, but it would be far easier to do it via the uart. Also note that if you are expecting to be able to do this with your ISP programmer, you will need to modify the programmer firmware, and possibly it's hardware, to act as a slave, and to not assert the reset line.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you are going to dedicate several pins to the debugging interface (e.g., SPI), then you might want to consider developing/debugging on a Mega16 with the JTAG interface. this was discussed in a recent thread.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And if you're using WinAVR / GDB you could use a JTAG ICE and use avarice with GDB for your emulator.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The problem is that the JTAG pins are used for other purposes in the hardware design.
The UART is also used.
I think the only reason that the SPI is still available is that it's needed for programming ;^)
/Janne

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I think the only reason that the SPI is still available is that it's needed for programming

I am confused. I thought the initial programming could be done with JTAG. I don't have the JTAG interface yet, so I haven't tried it.

Can JTAG be used for initial programming?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes I think JTAG can be used for programming.

The thing is that the ultimate target is the mega8535 and it doesn't have JTAG.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In our designs we make a 6-pin ISP header: SCK, MISO, MOSI, RESET, +5, & Gnd. This lets us power our target from the programmer for programming and standalone board testing. [Cautionary note: Your +5 regulator must be able to be "back powered" or have a bypass diode installed to do this. Some regulators are VERY unhappy about being back-powered.]

This also gives a convenient place to add "little features". In your case, consider a MAX31xx SPI UART. Make a little module with the SPI UART that you plug in for debugging. We use this approach for configuration and testing when the design has no provisions for a tranceiver, as well.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

http://www.omegav.ntnu.no/avr/re...

I think I saw a link on this page somewhere that does exactly that. It sends msgs thru PC parralell port. You simply include their code, hook up the connection, and go.