Atmel-ICE SPI configuration

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

Hi,

 

I am designing a board with an ATMEGA328-MMH and I am not sure how to configure the "slave select" pin (PB2).

 

I am assuming that the Atmel-ICE is always the master, so should I just connect PB2 on the ATMEGA328 to GND?

 

One last question...will I be able to debug over SPI or is there a better way (using Atmel-ICE) to program and debug the ATMEGA328?

 

Thanks,
Dan

This topic has a solution.
Last Edited: Tue. Aug 1, 2017 - 04:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sounds like your confusing ISP with SPI, although on the 328 they use mostly the same pins, they are not the same(ISP does not use SS pin.

debugging is done with debugWire (serial comm over reset line) and does not use spi(or isp) at all.

 

Jim

I could not find the 2x3 image alone, but all you need for ISP + Debug is a 6 pin header shown on the left.

 

Image result for avr isp header

Last Edited: Tue. Aug 1, 2017 - 03:23 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Look at the schematics for an Arduino Uno.  Or any simple mega328 board.

 

The 3x2 ICSP header receives the ribbon from your ATMEL-ICE.

 

When an AVR is being programmed by In Circuit Serial Programming (SPI),   the AVR appears like a regular SPI Slave with the /RESET pin as Chip Select (/CS)

 

You can use the 3x2 for Application Slaves because it contains MOSI, MISO, SCK, GND signals.   Obviously each Slave requites a separate /CS pin.

If you look at Arduinos,  the 3x2 is used as the SPI header when a Shield mates.

 

If you own an ATMEL-ICE,  you can hardware-debug with AS7 using the debugWIRE interface.

There is nothing wrong with using printf statements for debugging a program if you have a USB-UART chip and a Serial Terminal.  

Just like an Arduino.

 

David.

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

Hi Jim,

 

So, if I use debugWire and the 6-pin header, I only need to connect RST, VTG and GND?

 

Also, will I be able to program the memory using debugWire?  I need to give our factory a way to program these devices.

 

Thanks,

Dan

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

dps wrote:
So, if I use debugWire and the 6-pin header, I only need to connect RST, VTG and GND?
Err no because the transition into/out of debugWire mode involves changing the DWEN fuse in an ISP operation.

 

Don't mess about with this - you need a 2x3 for this to work so just do it like the most famous 328 circuit on planet earth (Arduino).

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That is what all the pins on the ISP header are for, programming!

 

Debug (while debuggig) only uses the RST/GND, The debugger will enter debug mode on the chip using the ISP to set the dWire fuse(don't do this by hand, let the debugger handle this)

When the fuse is set, it disables ISP, but the debugger can disable debug mode and return the chip back to ISP mode.

And yes, the debugger can program memory using dWire, but that is not how the factory will program it, it will use ISP mode.

 

 

Jim

 

 

 

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

Hi Jim

 

Sorry for all the dumb questions.  I usually do my own homework, but the design that I am working on also involves a Xilinx Zynq.  The amount of documentation on the Zynq chip is mountainous and I just haven't had enough hours in the day to read everything that I should.

 

Having said that, I have one more question:

The Atmel-ICE looks like it has a port for SAM or AVR.  From what I can see, it looks like I should use the AVR port.  Do you agree?

 

Thanks again,

Dan

 

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

yes, use the AVR port. 

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

Thanks Mark!
Dan