Programming the Atmega4809

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

I recently bought the Atmega4809 TQFP package as I loved its specifications.
http://www.microchipdirect.com/p...

But I have no idea to how to program it without the ATMEL-ICE or the Xplained pro board as they are quite expensive.
Could someone suggest some other way to program the controller using an arduino uno maybe? please help!

Last Edited: Mon. Mar 12, 2018 - 03:59 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If it is an AVR, why post the question in the ARM forums?
See https://www.avrfreaks.net/forum/cant-figure-out-how-program-attiny817

Last Edited: Mon. Mar 12, 2018 - 02:25 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

UPDI implementation in python: https://github.com/mraardvark/py...

 

Also there's some work by some users here to make a STK500v2 implementation... 

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

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

meolsen wrote:
Also there's some work by some users here to make a STK500v2 implementation...
by El Tangas : https://www.avrfreaks.net/forum/stk500-updi-working-was-enabling-xtiny-updi

 

"Dare to be naïve." - Buckminster Fuller

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

kunal_22 wrote:
Xplained pro board ... are quite expensive

 

Go on - GBP 27.16 ?!

 

https://www.microchipdirect.com/product/search/all/ATMEGA4809-XPRO

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
Go on - GBP 27.16 ?!
That's about $40 isn't it? In some parts of the world that could well represent a monthly take home. Equally when you can buy Arudinos for $5 and USB converter leads and programmers for $2 then, yes, $40 does sound kind of expensive.

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

@kunal_22 wrote:

Xplained pro board as they are quite expensive

The Xplained Mini boards are less than $10US and include the mEDBG for programming and debugging.  There isn't one for the 4809 however (or any Xmegas).

Greg Muth

Portland, OR, US

Xplained/Pro/Mini Boards mostly

 

Make Xmega Great Again!

 

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

It looks like this is a new AVR device that has only the UPDI (Universal Programming Demented Interface) method of communicating with the factory-new IC.  UPDI may or may not have advantages over the older ISP method of programming.  No doubt the engineers who developed it could dazzle me with demonstrations of its manifest superiority over the previous methods of device interface.  However, it has one primal disadvantage that has afflicted the embedded-systems industry since the 1970s: it requires a very expensive programming device made only by the CPU company whose only use is to get the object code into the memory of the microcontroller.  And this expensive programming device will only be purchased by companies that will be buying this IC design by the tens-of-thousands.  Not by you.

 

Basically there are four ways to get compiled/assembled object/hex code into an AVR device.  One is the new and vastly superior UPDI method, which few people use because it is new and expensive.  Expensive means any device that costs 50 times more than the cost of the IC itself.  This is actually the oldest approach: Intel sold "bond-out" programmers for $15,000 back in 1978 for 8051-based devices. If you wanted to be a player in the new embedded-systems industry, you bought one, along with a highly-trained and expensive engineer to program and operate it.

 

The next was an in-circuit-programming approach.  The reset pin was activated and often a higher-than-normal voltage was applied to the IC. Then bytes were sent in a serial-based code to the device one-by-one until the entire program was loaded. The reset was de-activated and the program ran on the device from its internal non-volatile memory.  The serial-based code was unique to the device family.  Non-corporate users could build parallel-port based bit-banging devices to implement this approach.

 

Next was JTAG: an industry standard means of reading/writing the memory of the device, and "freezing" it in the middle of a program's operation to examine each pin's logic at the moment of the "freeze". It also required advanced training, expensive equipment, and expensive engineers.

 

Finally, around 2005-2010, came boot-loaders. The device has a small program that monitored the UART peripheral on power-up/reset.  Signals arriving on the UART within a timeframe were assumed to be object code.  The bootloader would put these UART bytes into the non-volatile memory.  At next reset, the bootloader timed out and ran the program that had been previously loaded.  The Arduino system works with this method.  It requires no training or expensive equipment, but the bootloader program has to have been installed previous to the delivery of the IC device to the user.  This is clearly the best approach for low-cost non-corporate developers.  However, it doesn't have the ability to freeze and examine the CPU during an actual program run. Which can be essential for debugging complex programs and is demanded by engineers with big corporate budgets that are making tens-of-thousands units of single design.

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

Simonetta wrote:
However, it has one primal disadvantage that has afflicted the embedded-systems industry since the 1970s: it requires a very expensive programming device made only by the CPU company whose only use is to get the object code into the memory of the microcontroller...
Total Rubbish!  El Tangas has built an Arduino based, you know the ones you always recommend and are also pushing again in your post above, UPDI programmer and has also written a working avrdude.conf for avrdude 6.3 to use with it.  Granted it is limited to a few chips at the moment, but it is a great programmer!  I've used it to program ATtiny1616s. 

 

The avrdude folks are also busy getting UPDI chip support up and running, and the results of that effort should see the light of day somewhat soon.

 

Simonetta, technology evolves, there is always something new on the horizon, embrace it before you get left behind in the past.  I thoroughly enjoy reading your comments, they are a wonderful mix of fact, fiction, history, and your spirited point of view.

 

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

Last Edited: Tue. Mar 13, 2018 - 05:05 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What, a Left Coast Argument?

 

Wahoo!

 

In fact, posts #7, #8, #9, & #10 are all us "Western Radicals"! While I understand Simonetta's point, I am pretty much with Larry on this one.

 

Jim

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

Last Edited: Tue. Mar 13, 2018 - 05:28 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If a factory new ic doesn't require the high voltage 12V reset pulse, then it is quite easy to program and in fact it's the most elegant way of doing that, because it is a real uart (one-pin half duplex but still an uart). I worked in the past with the exact same type of interface, on Z8Encore! chips.

 

If it requires that 12V pulse, then probably you need an atmelice indeed.

 

So, is there anyone that works with real brand factory new ic on custom boards that require initial programming? And using anything else than an atmel-ice? I tried to find that information in the datasheets but I'm still not sure. Do brand new chips require only 5V programming?

 

Users of only Xplain boards probably won't see this issue. The board chip may be pre-programmed at the factory.

 

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

EDIT: So my answers here were for the new tinyAVR-1 series and are not representative about the new megaAVR-0 series chips.  Please excuse the chatter, especially anything to do with 12V programming! 

 

​Thanks to Rabbap's post #17 and GermanFranz's post #20 for reminding me that this was a different and marvelous new chip!

 

rammon wrote:
So, is there anyone that works with real brand factory new ic on custom boards that require initial programming?
Yes, I program my own.

 

rammon wrote:
And using anything else than an atmel-ice?
Yes, see my post above - El Tangas Arduino based UPDI programmer.

 

rammon wrote:
I tried to find that information in the datasheets but I'm still not sure. Do brand new chips require only 5V programming?
Yes, only if the SYSCFG0 register gets borked do you need 12V programming.

 

rammon wrote:
If it requires that 12V pulse, then probably you need an atmelice indeed.
  Do you know how can I use my Atmel-ICE to do 12V UPDI programming?

 

rammon wrote:
Users of only Xplain boards probably won't see this issue. The board chip may be pre-programmed at the factory.
In almost all cases yes.

 

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

Last Edited: Tue. Mar 13, 2018 - 05:38 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you know how can I use my Atmel-ICE to do 12V UPDI programming?

 

No, I don't, but I would expect it to be able to insert a 12V pulse on the reset pin. At that price, at least... It's not even a new thing for atmel.

 

Once I had a very versatile programmer, for PALs, GALs, EPROMs, etc. It had some ZIF sockets, DIP40 being the biggest.

And it had 40 controllable pins, every one being able to be GND, 5V or 12V (or 13V I think) at any time, independently.

Quite expensive though.

 

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

rammon wrote:

Do you know how can I use my Atmel-ICE to do 12V UPDI programming?

 

No, I don't, but I would expect it to be able to insert a 12V pulse on the reset pin. At that price, at least... It's not even a new thing for atmel.

You are correct that it is a 12V pulse, and I already am aware of it, but this is not the same as the old 12V programming interfaces from Atmel.

 

This sums it up, from the Atmel-ICE documentation:

Important: The Atmel-ICE does not support 12V on the UPDI line. In other words, if the UPDI
pin has been configured as GPIO or RESET the Atmel-ICE will not be able to enable the UPDI
interface.

So back I go to the other thread with El Tangas and who-me.

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

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

@kunal_22, try the Arduino based UPDI programmer written by El Tangas.  You can get it here: https://github.com/ElTangas/jtag2updi 

 

Follow the instructions in the README.md file.  Good luck.

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

Last Edited: Tue. Mar 13, 2018 - 07:48 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yeah... bad news.

I would be embarrased a little if I was atmel. Now Microchip.

You are right. Serial programming didn't require high voltages. Until now...

 

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

As a matter of fact, SPI required HV(PP) for the exact same scenario as UPDI does, i.e. to re-enable the programming interface you've somehow managed to fuse out.

The difference is that with UPDI, you can unlock it with access to just the pin in question. With a mega328, you'd have to remove the entire part from the circuit to get at it with HVPP.

 

Furthermore, for the larger parts (like the 4809), the UPDI pin is dedicated and cannot be disabled (and the pin can as such never require HV to unlock).

 

In other words, when you claim that "Serial programming didn't require high voltages. Until now...", the truth is literally the exact opposite. 

 

As for the cost of a programmer: if you happen to have a usb-serial adapter and a single resistor lying around, https://github.com/mraardvark/pyupdi/ will get you one for free :)

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

Atmel-ICE ist a very versatile programmer for ARM and all AVR Devices. I'm using the pcb version and think 45€ I have paid for it absolutely worth it. UPDI needs only one pin for debugging and programming, this works very well and economical.

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

Do you know how can I use my Atmel-ICE to do 12V UPDI programming

The Atmel-ICE does not have the capability to do 12V at all. The 12V UPDI support is available on the Power Debugger and the STK600 which are both capable of generating this pulse.

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

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

meolsen wrote:

Do you know how can I use my Atmel-ICE to do 12V UPDI programming

The Atmel-ICE does not have the capability to do 12V at all. The 12V UPDI support is available on the Power Debugger and the STK600 which are both capable of generating this pulse.

But not forget: Programming this new Mega MCU does not require such a pulse. Never :-)

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

Deleted - Forgot we are in a thread about the ATmega4809 not an ATtiny1616 - apologies to all

 

GermanFranz wrote:
But not forget: Programming this new Mega MCU does not require such a pulse. Never :-)

​That is absolutely great!  Wish they would have thought about this for the tinyAVR-1 series :/

 

Time to switch to this chip!
 

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

Last Edited: Tue. Mar 13, 2018 - 05:21 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's not so much a matter of "thinking of", it's more that on the smaller parts the customer starts complaining if he can't use the programming pin as an IO pin.

On the larger parts, the value of you not shooting your foot exceeds the added value for the customer with better aim.

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

Rabbap wrote:
It's not so much a matter of "thinking of", it's more that on the smaller parts the customer starts complaining if he can't use the programming pin as an IO pin.

They will complain even more if the RSTPINCFG bits get changed inadvertently on those smaller parts that share the RESET pin with, or can be made GPIO, on the UPDI pin .  Atmel-ICE, batteries not included, no 12V UPDI capability.  Power Debugger is US $190, the STK600 is on sale through the end of March for US $199, as meolsen wrote, they both do 12V UPDI programming.

 

@everyone, I edited my post #12 that had mentioned 12V programming, it obviously does not apply to the ATmega4809.

 

@kunal_22, If you have not seen post #15 look there for an alternative way to program your ATmega4809 or use Rabbap's solution from post #17:

 

Rabbap wrote:
As for the cost of a programmer: if you happen to have a usb-serial adapter and a single resistor lying around, https://github.com/mraardvark/pyupdi/ will get you one for free :)

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

Last Edited: Tue. Mar 13, 2018 - 06:14 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Erm, the Atmel ICE is not that expensive and will work.... I paid GBP40 odd for mine, not sure of the current price, obviously a lot more will be flying off the shelf now.