simulavr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Simulavr-devel] ATmega644


From: Petr Hluzín
Subject: Re: [Simulavr-devel] ATmega644
Date: Sun, 27 Feb 2011 03:25:08 +0100

Hi folks

I just commited support for ATmega164A/164PA/324A/324PA/644A/644PA/1284/1284P.
(This is experimental. Please verify each peripheral using code which
is known to work on real silicon.)

ATmega644A is just like ATmega644, except it has additional USART.

Less coherent notes about porting follow:

On 22 February 2011 17:41, Michael Hennebry
<address@hidden> wrote:
> On Mon, 21 Feb 2011, David Madden wrote:
>> On 02/21/2011 10:25 AM, Sebastian wrote:
>>>
>>> are there plans to support ATmega644?
>>>
>>> Would that be just a matter of combining stuff from ATmega16/32 (which
>>> are pin compatible) and ATmega328 (which has some (all?) new features,
>>> like external interrupts, new timers, USART)?
>>
>> It looks like there's support for several chips in atmega668base, with
>> individual chips choosing whatever peripherals are appropriate.  That looks
>> like a good place to start.
>
> ...
> I had tried to make a 168 from a 128.
> One of the many difficlties I found was that the timers weren't much alike.
> As mentioned, someone else did the heavy lifting.

Pin compatibility is nice but peripheral details/version/capabilities
are more important. Fortunately after exhaustive comparison the
peripherals they seem identical. (Well, at least I was exhausted.)

This is my brain-dump of what I have found (about their differences).


The ATmega644 is similar to ATmega644P: the P device has a second
USART (and better analog properties).
See "AVR508: Migration from ATmega644 to ATmega644P".
The ATmega644P is officially replaced by ATmega644PA, which only
improves analog properties (AVR527).
ATmega644PA is member of 164A/164PA/324A/324PA/644A/644PA/1284/1284P family.

We might rather implement the 164/324/644/1284 PA family.


== ATmega1284P versus ATmega328 by comparing datasheets ==

In ATmega328 the PRTIM0 bit in PRR must be dissabed. No mention in
ATmega1284 revA datasheet. (We do not detect if user tries to use a
peripheral while it is disabled.)

ATmega328 family datasheet has a chapter "16.Timer/Counter0 and
Timer/Counter1 Prescalers" while ATmega1284P family datasheet does
not.

ATmega1284P family datasheet has TIMSK2 register description,
ATmega328 does not.

ATmega1284P family has two USARTs, ATmega328 has one. (Same feature
set of the USARTs.)

ATmega1284P has also 2.56V ADC reference, differential modes with
selectable gains. ATmega328 does not have, but it has temperature
sensor. Different mux selection bits and capabilities in ADMUX
registers.

ATmega1284P has SIGRD bit (Signature Row Read) in SPMCSR.

(The ATmega1284P allegedly has a 16b Timer3 which is not mentioned in
current datasheet.)


== ATmega1284P versus ATmega644 by comparing only _register summary_
("Arkanoid") in datasheets ==

ATmega644 lacks the second USART.
ATmega644 lacks BODS & BODSE bits in MCUCR register. (Only PA parts have it.)

Seems like Sebastian will have to live with the extra UART.


== ATmega644 versus ATmega328 by comparing XML ==

I took Atmel's XML files and compared/verified the fragment
AVRPART/IO_MODULE (about 5k lines):

DIDR0 - 2 ADC channels are now on IO pins

ADCSRB - ATmega644 has MUX5 bit
- has different address in XML vs datasheet (<MEM_ADDR>0x7C</MEM_ADDR> vs 7B)
- XML of both parts have the same values
- datasheet of both parts have the same values
- is not mentioned in ATmega88 <ANALOG_COMPARATOR>

ADMUX - more bits

has <PORTA>

PORTC7 is ordinary pin, not combined with RESET#

EICRA - has ISC21,ISC20 bits (because extra INT2)

more pin change registers

<EEARH> - "EEPROM Address Register Low Byte" - WTF?

<SPMCSR> - missing in XML, present in datasheet

The XML nodes had to be reordered to get reasonable diff. Still, there
were many annoying and trivial changes ("0x" vs "&", typos,
capitalization, whitespace, missing descriptions, ...)


Datasheet summary:
both claim to have 131 instruction, however ATmega644 does not claim
"On-chip 2-cycle Multiplier" (datasheet summary)
bigger Flash, EEPROM, SRAM
has JTAG (we do not simulate that)
has ADC with "Differential mode with selectable gain at 1x, 10x or 200x"
does not have temperature measurement
more IO (has PORTA, PC7, PC6), larger packages
more interrupts (28 vs 26)


AVR527: Migrating from ATmega164P/324P/644P to ATmega164PA/324PA/644PA
- just analog changes
AVR508: Migration from ATmega644 to ATmega644P - "Between ATmega644
and ATmega644P some register bits has been added, but
none of the existing bits has been removed, nor moved to different locations."

==

I did not understand if simulavr internally uses interrupt vector
addresses (byte based) or indexes. The code carefully avoided
providing any clues. Fixed.

-- 
Petr Hluzin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]