8/16-bit Atmel XMEGA A3BUMicrocontroller

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

What does 8/16-bit Atmel XMEGA A3BUMicrocontroller mean? Is it 8 bit or 16 bit?

Sometimes in the datasheet we see a 256kb/128kb flash memory, what does that mean? 

Padma Reddy

Last Edited: Tue. Nov 19, 2019 - 03:12 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

8 bit data, 16-bit instructions. Simple!

 

Flash is a bit more complicated. In some places, it is figured on the basis of bytes. In other places, 16-bit words. Instructions are all multiples of a word, so the word size is important figuring program size. But, if you store data, like strings, in flash, then it is the byte value that is important.

 

By the way, this is true for all the non-32 bit AVRs (Tiny, Mega, XMega).

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

Last Edited: Tue. Nov 19, 2019 - 07:18 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:

8 bit data, 16-bit instructions. Simple!

 

Flash is a bit more complicated. In some places, it is figured on the basis of bytes. In other places, 16-bit words. Instructions are all multiples of a word, so the word size is important figuring program size. But, if you store data, like strings, in flash, then it is the byte value that is important.

 

By the way, this is true for all the non-32 bit AVRs (Tiny, Mega, XMega).

 

Jim

 

Thank you for your answer. In addition to this, does 256kb/128kb Flash also mean that 128 kb of flash memory can be extended to 256kb?

Padma Reddy

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

 

You didn't actually say which model of A3Bu but I just checked:

C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr>dir *a3bu*
 Volume in drive C is OSDISK
 Volume Serial Number is 7AF3-B2D0

 Directory of C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr

25/06/2019  09:49           356,760 iox256a3bu.h
               1 File(s)        356,760 bytes
               0 Dir(s)  268,849,201,152 bytes free

and there only is one. So the 256 in the name means it has 256KB (bytes) of flash. It is an 8 bit micro (aka "avr8"). The datapaths in this diagram are all 8bit wide:

 

 

EDIT: small correction - the path to the right from flash memory to "Instruction Register", "Instruction Decode" is 16 bit. In fact that may be why they make this curious claim on the first page of the datasheet that it is "8/16bit microcontroller"

 

But the AVR opcodes are all multiples of 16 bits (so 2 bytes, 4 bytes, 6 bytes etc) and as such Atmel have this really weird habit of giving flash memory sizes in terms of 16 bit words. So they describe it as a chip with 128K words meaning that you could get 128K single word opcodes into it.

 

This gets particularly complicated when it comes to positioning bootloader code as (for chips in the Xmega family) this lives in an additional section just beyond the "end" of the main flash. Now a "normal" programmer, thinking in bytes would assume that the range of flash addresses in such a "256K" device were 0x00000 .. 0x3FFFF so that the boot section would then be at 0x40000. But Atmel, in their wisdom gives this address in terms of 16 bit words so say it is 0x20000:

 

 

In fact that is a very odd diagram indeed. It says "Application Section" then gives "(256K)" and that number is in terms of 8 bit bytes. But then down the left it shows it spanning to 0x1FFFF.

 

It is doubly confusing because "Application Table Section" is part of that 256K yet it appears to show it as a separate 8K yet that is 8K within the first 256K (as you can tell as, in word terms: it ends at 0x1FFFF).

 

Life would be a lot simpler if all programmers, everywhere, would agree to all define memory spaces in terms of Bytes.

 

(and don't get me started about the old days when DRAM (and some EEPROM) sizes were always given in terms of bits not bytes!)

 

Last Edited: Tue. Nov 19, 2019 - 09:43 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The OP asked:

 

does 256kb/128kb Flash also mean that 128 kb of flash memory can be extended to 256kb?

No!

 

What that means is that there are 128K WORDS or 256K BYTES of flash. Those two numbers mean the same thing (1 word = 2 bytes). In other words, in a perfect world, you could pack 128K of single-word instructions into the flash. But, its not a perfect world because some byte data gets stored there, also, and some instructions are two words, or more, in size. 

 

Jim 

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

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

Rather curiously the chip actually has 264KB of flash ;-)