SPI programming

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

Hi, 

I do not understand how programm my µC which is the ATMEGA64M1? I joined you two pictures of the datasheet. To programm the µC it seems that I need PB3, PB4 and PB5. But when I look the Pin configuration there is no SPI interface on those pins. So is it possible that without visible SPI interface, I can programm the µC ? There is also a note that explains that it is possible that all parts can be programmed without having an SPI interface... But it's a bit weird and I have to be sure !
 

 

Thank you very much and have a nice day ! 
 

This topic has a solution.
Last Edited: Fri. Jul 28, 2017 - 12:30 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

leoleoleo240 wrote:
But when I look the Pin configuration there is no SPI interface on those pins.
SPI != ISP

 

A number of the 64 pin AVRs (mega64, mega128 etc) use different pins for ISP compared to SPI. This is not unusual.

 

Actually your post is fairly unusual - what we normally see here are folks who just blindly wired up ISP to the SPI pins and then post to say "why won't this work?". You are unusual in having actually read the datasheet and spotted the difference! cheeky

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

leoleoleo240 wrote:
There is also a note that explains that it is possible that all parts can be programmed without having an SPI interface.

I think you've misunderstood that note.

 

What that note is saying is that the pins used for programming are not necessarily the same as the pins used for the "normal" SPI interface

 

 

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

Ok actually, I thought that the ISP was based on the SPI protocol because I saw MOSI/MISO/SCK. Is it false ? An other question, but i think it is not a problem, Is it possible to use the ISP pins for programming and for the normal operation of the system ? (I m so bad in english ...)

 

And Is there something else that newbie like me could forget in order to programm an Atmel AVR ? 

 

Thank you ! 

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

leoleoleo240 wrote:
I thought that the ISP was based on the SPI protocol because I saw MOSI/MISO/SCK. Is it false ?
It is an "SPI like" protocol but the point is that it does not (or rather does not have to) use the actual SPI peripheral in the AVR. In these 64 pin chips clearly the ISP inputs are connected to some kind of "cut down" SPI interface that is only used during ISP but is otherwise not available to the user of the chip.

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

Ok thank you ! :D 

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

Hi, 

Is it possible to programm a microcontrôler with just the ICE Atmel ? And without external power supply ? Because I 'm just using the ICE Atmel and when i'm trying to measure the voltage between GND and Vcc, i have 0 V ... Is it normal ? It tell me something like it is expecting 0xGC and it have an other thing ... So the programmation doesn't work ... I told to verify my fuse bits but I can't change it this fuse bits because the microcontroler seems to be power off

 

Thank you very much ! 

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

leoleoleo240 wrote:
Is it possible to programm a microcontrôler with just the ICE Atmel ?

Possible but I won't do that because you load your USB port with your MCU unless your certainly know the current drain.(unless the ICE had self power?)

 

 

 

MG

I don't know why I'm still doing this hobby

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

Ok thank I tried with an external power supply and it doesn't work ... I don't know why ... I can't read the device signature ... I m just able to read the target voltage which is 4.6V ... It seems there is an Hardware problem ? I don't know what it is my problem ... I m using the ATMEGA64M1. I connected the MOSI to PB3, MISO to PB4, and SCK to PB5, RESET is connected to PE0. Should I add something on the reset PIN ? there is no pull up resistance ... 

The ICE has a green LED which is on and a red LED also ON . Could you please help me ? 

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

The current absorbed is about 0.020 mA and there are 3 others IC ... It seems to be normal. I read that normally I don't need to have a pull up resistance on my reset pin unless if i m a noising environnment but it is not the case ... And it nevers works ... 

Last Edited: Fri. Jul 28, 2017 - 09:39 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And I can see with a multimeter that the reset pin is held High about 4.2 V. here is the error that I have when i m trying to read the device signature : 

Last Edited: Fri. Jul 28, 2017 - 09:45 AM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have not used the ATMEGA64M1.

I find it interesting that in the datasheet (10/2016) Table 1-1 indicates programming on PD2-PD4 rather than PB3-PB5. ???

 

Edit: Just found an older datasheet (01/15) where table 25-15 shows programming on PD2-PD4 NOT PBx.

David (aka frog_jr)

Last Edited: Fri. Jul 28, 2017 - 10:16 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Looks like you correctly connect all the ISP connection.Make sure that again.
Any chance you programmed the wrong fuse? Or you can't enter the progamming mode from the begining?
Better add pull up in your reset pin. It should read 5V.
.
Edit: if what frog said is right then you should double check the datasheet.
.
MG

I don't know why I'm still doing this hobby

Last Edited: Fri. Jul 28, 2017 - 10:20 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The ISP pins for programming the microcontroler are also connected to an other IC. Is it possible that is the problem ? ... 

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

leoleoleo240 wrote:

The ISP pins for programming the microcontroler are also connected to an other IC. Is it possible that is the problem ? ... 


Could be if the IC holding the line.
Usually from ISP pinout to other device has series resistor. While ISP programmer connected to MCU pinout directly.
.
But you had check what frog_jr advised?
.
MG

I don't know why I'm still doing this hobby

Last Edited: Fri. Jul 28, 2017 - 11:43 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You'll know that when you break the connection to the other IC!

 

(but yeah, SPI is a "bus" on which multiple slaves may co-exist but only one can be active at the same time - the other devices on the bus should tristate when not selected so they don't interfere with the signalling to/from the active device. SPI devices "let go" when their chip selects are deactivated. To be sure of this happening you might need pull-up/down to hold them in the inactive state).

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

frog_jr wrote:

I have not used the ATMEGA64M1.

I find it interesting that in the datasheet (10/2016) Table 1-1 indicates programming on PD2-PD4 rather than PB3-PB5. ???

 

Edit: Just found an older datasheet (01/15) where table 25-15 shows programming on PD2-PD4 NOT PBx.

That would appear to be the answer. Plus make sure you connect AVcc as shown.

'This forum helps those who help themselves.'

 

pragmatic  adjective dealing with things sensibly and realistically in a way that is based on practical rather than theoretical consideration.

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

Hi, 

 

Thank you for your help ! I will try to do what frog_jr said. I don't think it is the others IC that are troubling the SPI protocol, because the components are octal bus transceiver and the line should be in "high impedance" or just closed. It is an interrupter.

 

Thank you very much ! 

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

Ok Frog_jr is right ! I have connected the wrong pins and it is SPI_A which works ... Thanks a lot for the help and have a nice day :D ! 

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

 Just from looking at the pin-out of the square IC diagram provided, it seems like there are two SPI channels on this IC.  (I've never used this variant of AVR).  There is MISO on PB0 pin 8, MOSI on pin 9 PB1, and SCK on PB7.  There is also a MISO_A on pin 1, MOSI_A on pin 2, and SCK_A on pin 12.  Try using the PB0:PB1: PB7 combination for ISP flash programming.