Overview of AVR programming methods

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

Hello all,

 

I have switched from plain Arduino to bare ATtiny and ATmega chips about two months ago.  It was a difficult extremely difficult uphill battle - instructions on internet are fragmented, different schematics are available for the same method...  I lost at least two weeks because of all the inconsistencies.

 

All the time I was making notes and I came to a point that I feel comfortable to publish them online so I might save some novice a week of wondering around.  But, before I publish them, I have to clear up several things:

 

Hardware (SPI) upload method:
1. What is the difference between ArduinoISP and Arduino as ISP in Arduino IDE?
2. Does uploading sketch with this method overwrites the bootloader?
3. Why is it necessary to burn fuses (burn bootloader procedure) for a new ATtiny chip and not for a new ATmega chip, even if bootloader is not used?

 

Bootloader (UART,USB) upload method:
4. At the beginning of the UART transmission, DTR changes its state and the 100 nF capacitor converts this change into a pulse at RESET pin. Is that correct?
5. Does any of programmers had to be selected in Arduino IDE before the transmission or is this selection ignored?
6. Does "burn bootloader" procedure always include burning fuses?
7. It seems that Micronucleus bootloader does not use RESET pin. So it wouldn't be reasonable to turn RESET pin in ATtiny85 to standard pin if only Micronucleus is going to be used?
8. It seems that different pins are used by Micronucleus for ATtiny85 and ATtiny84 chips. Is that right?
 

If someone can spare five minutes, you are very welcome to read what I have written so far and check if there are mistakes - quite possible they are.  The URL is https://www.pinteric.com/avr.html

 

Thanks for help and best regards.

 

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

It was a difficult extremely difficult uphill battle - instructions on internet are fragmented, different schematics are available for the same method..

 

Did you look at the AVR datasheet(s)??  Programming the standard classic parts is quite simple.  Here is a low cost programmer that is easy to use:  https://tinyurl.com/2zv878nn

Hooking up your ISP programmer is quite straightforward & only requires 6 wires:  power ,GDN, MOSI, MISO, SCK, RESET

 

This is all that is needed for the programmer to completely erase the chip and change the fuses and burn in the program.  The Studio programming control panel lets you adjust the fuses as desired.  You don't need to install a bootloader at all.

How would this hookup lose two weeks?

 

 

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Sun. Sep 26, 2021 - 06:44 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

avrcandies wrote:

It was a difficult extremely difficult uphill battle - instructions on internet are fragmented, different schematics are available for the same method..

 

Did you look at the AVR datasheet(s)??  Programming the standard classic parts is quite simple.  Here is a low cost programmer that is easy to use:  https://tinyurl.com/2zv878nn

Hooking up your ISP programmer is quite straightforward & only requires 6 wires:  power ,GDN, MOSI, MISO, SCK, RESET

 

This is all that is needed for the programmer to completely erase the chip and change the fuses and burn in the program.  The Studio programming control panel lets you adjust the fuses as desired.  You don't need to install a bootloader at all.

How would this hookup lose two weeks?

 

Hello, if you carefully read my questions, you would see that I do not ask for help with programming.  I already figured three programming methods and programmed multiple chips with them.  I just posted few specific questions, so that I can check whether my short overview of AVR programming methods ( https://www.pinteric.com/avr.html) is correct before publication.

 

The reason I lost couple of weeks sorting everything out is that when one googles a AVR specific issue, one gets hundreds of pages with different solutions.  Usually, there is no explanation why things should be done specific way so one cannot figure out which solution is appropriate.

 

Learning from AVR datasheet with 653 (six hundred fifty-three) pages?  Seriously?  It would take me two years instead of two weeks...

 

Last Edited: Sun. Sep 26, 2021 - 08:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Learning from AVR datasheet with 653 (six hundred fifty-three) pages?  Seriously?  

What? Are you serious about it and knowing about AVR? cheeky There is a whole section on how the chip programming is accomplished including the connections and tips.   All of those 600 pages are information for you in one convenient place about the chip and its particular features. 

Exactly what do you think the datasheet is for???

 

.... to bare ATtiny and ATmega chips about two months ago.  It was a difficult extremely difficult uphill battle - instructions on internet are fragmented

Hmmm... 

 

I added a bit of oiincreased clarity...for what it is worth

Hardware upload method (ISP)

Basically, the code is compiled to a hex file and uploaded by what is called a device programmer. The code is uploaded using the Serial Peripheral Interface (SPI) protocol with using three dedicated lines, SCLKMOSI and MISO. The upload is triggered by the a pulse on the pin RESET pin, which means that the upload requires four chip AVR pins.

Fortunately, Arduino Uno (or some of its relatives like Arduino Nano, Arduino Mini etc.) can be used as the hardware part programmer and Arduino IDE as the software part of the programmer (instead of using expensive vendor solutions). First, load the special in-system programming (ISP) sketch ArduinoISP onto the programmer. The sketch can be found under Examples in the Files menu of Arduino IDE. Select the appropriate board and the Arduino as IDE as the programmer in the Tools menu. Then connect the MOSI (PB3), MISO (PB4) and SCLK (PB5) pins of the programming device and to the target device. In addition, connect the PB2 pin of the programming device to the RESET pin of the target device along with a 10 kΩ pull up resistor to VCC. Finally, upload the code by selecting Upload Using Commander in the Sketch menu.  How do you know it completed/verify?

You need to mention the programmer and AVR must share a common gnd  & the AVR target needs power (3.3/5V) matching the programmer.

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Sun. Sep 26, 2021 - 10:31 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Hardware (SPI) upload method:
1. What is the difference between ArduinoISP and Arduino as ISP in Arduino IDE?

ArduinoISP is a (now retired) Arduino Product that does ISP programming, while "Arduino as ISP" is a sketch that runs on a bunch of different Arduino board-level products, turning them into ISP programming tools.

2. Does uploading sketch with this method overwrites the bootloader?

Yes.  Any ISP programming of a new sketch will overwrite the bootloader, regardless of the ISP programming hardware.  ISP programming does not include any "erase" command with granularity finer than "the whole chip", while internal self-programming (as used by the bootloader) can erase one "page" of flash at a time.

3. Why is it necessary to burn fuses (burn bootloader procedure) for a new ATtiny chip and not for a new ATmega chip, even if bootloader is not used?

You DO need to burn the fuses for ATmega chips, as well as ATTinys.

 

Bootloader (UART,USB) upload method:
4. At the beginning of the UART transmission, DTR changes its state and the 100 nF capacitor converts this change into a pulse at RESET pin. Is that correct?

Yes.

5. Does any of programmers had to be selected in Arduino IDE before the transmission or is this selection ignored?

No "programmer" needs to be set for a normal bootloader sketch upload.  Only for "burn bootloader" and "upload using programmer."

 

6. Does "burn bootloader" procedure always include burning fuses?

It doesn't HAVE to.  But I think all current AVR board packages do so.  This is under control of the boards.txt file; there is always a "burn fuses" step, but it COULD be set to do nothing.

 

7. It seems that Micronucleus bootloader does not use RESET pin. So it wouldn't be reasonable to turn RESET pin in ATtiny85 to standard pin if only Micronucleus is going to be used?

Yes, and I think some of the DigiSpark-like boards do this.  You need to set the fuse to disable RESET *after* you've programmed the micronucleous bootloader, because RESET is part of the ISP programming protocol, and once you disable it, you can no longer use ISP programming to load additional code or make any more changes.  (unless your ISP programmer supports "High Voltage Serial Programmer", which is ... pretty rare.

 

8. It seems that different pins are used by Micronucleus for ATtiny85 and ATtiny84 chips. Is that right?

Different in what sense?  The 85 is an 8pin chip, the 84 is a 14pin chip, so some of the "same signals" have moved to "different pins."
MN uses a software bit-banged implementation of USB, and IIRC that wants at least one of the USB data signals connected to a pin that generates interrupts on the AVR.  If it needs the full-featured "external interrupt" capability rather than just "pin change" interrupts, it looks like that means it needs PB2 (INT0), which is pin7 on an 85 or pin5 on an 84.

 

The SW USB thing is apparently starting to be non-operational with a lot of newer computers, BTW.  It skirts the edges of "legal behavior for a USB device", and new PC chipsets and drivers are getting fussier.  (or perhaps they NEED to be fussier to also support USB-3/USB-C/etc.)

 

 

instructions on internet are fragmented

Yes.  People with prior microcontorller experience keep wondering how a rather featureless IDE and some not-that-well-written libraries came to dominate the "maker market", without ever really understanding how much of a barrier it was to have to download SW from several different sites, buy and hook up am ISP programmer, read a half-dozen or so lengthy and obtuse documents, and build a circuit, before you could actually DO anything (even as simple as blink an LED.)  Whereas with an Arduino, you installed one app, plugged in your board, loaded an example and flew...

 

I'll check out your site in a bit...

 

 

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

I'll check out your site in a bit...

General comment: It would be good if your circuit diagrams explicitly included the necessary common ground wire.  Because beginners don't necessarily KNOW about that.

 

a 10 kΩ pull up resistor to VCC.

OTOH, the 10k resistor isn't 100% necessary, and it's also likely that it is already present on a target board.

 

Then connect the MOSI (PB3), MISO (PB4) and SCLK (PB5) pins of the programming device and the target device. In addition, connect the PB2 pin...

"Pins" on Arduino boards have too many different names :-(  SCLK. PB5.  D13.  19.
Of those, I think the "PBx" names are the least commonly used.  And the SPI or ISP pins won't always be PBn  (The tiny84 you mentioned has MOSI on PA6...)

 

Finally, upload the code by selecting Upload Using Commander in the Sketch menu.

"Upload using Programmer" on my systems.  Is that a language issue?

 

Arduino Uno uses the CH340G chip

Arduino Uno uses a second AVR chip, usually a ATmega16u2.   The CH340G is very popular on "Chinese Clones" of the Uno, but they're not supposed to actually call themselves "Arduino Uno"  (the more aware vendors usually say something like "Arduino Compatible Uno328" or "Uno R3 compatible with Arduino."   The less aware vendors don't much care about trademark law.

 

The problem is that the ATtiny series microcontrollers do not support the hardware UART protocol.

The ATtiny chips are just as capable of supporting UART protocols (bit-banged by SW) as they are USB protocols (also bit-banged.)  And in fact ATtinyCore supports Serial uploading using Optiboot on most of the chips it supports (including tiny85 and tiny84.)  The Direct USB connection on boards like the DigiSpark is designed to minimize the size and cost of the resulting board (using a UART protocol would have required a second chip like on the Uno, or a special cable.)

 

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

Those datasheets are long because the AVRs have a lot of functionality.  The way I learn is to have a functional requirement for some specific task, and I go to the datasheet and read about the things I need to know and start writing code.  If you want to just learn all about AVRs with no task in mind, I wish you good luck.  Searching the intertubes for anything is going to give you massive amounts of conflicting information.  You should know that by now.  The datasheet is the place you learn.  Arduino is its own language and libraries, although you can write straight C code if you want to as if it's a bare AVR.  It will compile and run.

 

Have fun in the AVR world!  The people here are great will help you all you want, but they expect you to listen to what they say.

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

westfw wrote:
OTOH, the 10k resistor isn't 100% necessary, and it's also likely that it is already present on a target board.

 

I bought some Chinese 'Nano's years ago that had a 1k pullup resistor and the usual capacitor to the DRT (or something Data Ready) pin on the serial chip (FTDI or CH340) that Arduino uses to reset after downloading to flash.  The pull up has to be greater than 10k and the capacitor trace to RESET broken to be able to use debugWIRE with an Atmel ICE.  debugWIRE uses the RESET pin to talk to the IDE when debugging with breakpoints and such, I believe, and the cap slows things down enough that debugWIRE doesn't work.  I don't know if Arduino has a debugger these days.  Wes probably knows.  It used to be Arduino programmed flash via USB and there was no real time on chip debugging that I knew about.  I never spent much time learning Arduino, preferring the bare Atmega chip and the datasheet, AtmelStudio and C.

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

I agree with you.the ATtiny85 Arduino probably as the entries of AVR.Micronucleus(SW) and digistump(as HW).

 

 

www.tokopedia.com/madagang cheap and free worldwide shipping

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

MarkThomas wrote:
I bought some Chinese 'Nano's years ago that had a 1k pullup resistor and the usual capacitor to the DRT (or something Data Ready) pin on the serial chip (FTDI or CH340) that Arduino uses to reset after downloading to flash. 

I think you mean the DTR (Data Terminal Ready) signal, it's pulled low to trigger the reset of the AVR so the bootloader code will start!

Jim

 

Keys to wealth:

Invest for cash flow, not capital gains!

Wealth is attracted, not chased! 

Income is proportional to how many you serve!

Lets go Brandon!

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

ki0bk wrote:
I think you mean the DTR (Data Terminal Ready) signal, it's pulled low to trigger the reset of the AVR so the bootloader code will start!

 

Ah, yes.  DTR.  Not DRT.  At least I got the letters right, but not the order.

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

Pygmalion wrote:
ATtiny85

 

Don't be too long with those old chips.

Modern AVR like Tiny1614/24 or AVR128DB

are better at everything.  Often enough even in the price.

Today 3 lines are sufficient for programming: UPDI,VCC,GND.

 

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

We need to fall on knees and thank Atmel to create the procedure to write the AVR datasheets in a complete sense of necessary information.

I really appreciate the people at Atmel (at the time) responsible for documentation and support, they had a good mindset (military does that) to write all of it, not leaving anything to imagination.

If it would be 2000 pages, it would be okay, no problems.  You don't need to read everything at once, just read enough to start your job, then read again with more attention the part where you are working on.

For example, when dealing with ADC, go there and lay down your brain over the pages, if it takes 2 hours, that's okay, you will learn completely.

I need to confess, the AVR part that always takes me time (every time) is the PWM generation, so many possibilities and setups, but at the end it works.

 

Try to find out the same kind detailed information about any Intel I-5 processor, you can't. Even the pinout physical disposition is not disclosed, you need to have special registration and approval to have that.

I tried to have the physical pinout for the Intel Atom E3827, in order to produce a stainless steel stencil ball soldering, impossible, Intel created all sorts of difficulties.  How in the heck pinout physical disposition would be something strictly confidential?

 

Some people believe that you can learn things in one week or two.  They believe the world is easy, simple and fast.  Days ago I was recommending to a friend to learn FREECAD, in order for him to be able to create 3D objects and print at his resin printer.  When I said it would take few months to start to have some results, he almost punch me.  He answered that he wanted some software that he could learn in a couple of hours, since he had other important things to do in life.   Sometimes I wonder, this kind of people are the ones to control the planet in a decade.

 

In 1975 I bought the complete set of chips from ZILOG Z80 (DMA, CPU, SIO, DMA) at RadioShack in Toronto, each chip came with a BOOK, with more than 100 pages each, the datasheet and technical information, all the information, waveforms, etc, free of charge from ZILOG.   I immediately fell in love with ZILOG, of course.  They respected me from the start.

 

Wagner Lipnharski
Orlando Florida USA

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

For Pygmalion,

 

Forget Arduino and everything you learn from it, even being important for the general knowledge of the AVR, the moment you start to fly solo with AVR microcontrollers, Arduino would be only the old nest where you learn things initially.   Bootloader is something nice, but once you fly solo, you will use only ISP communication.  You don't need bootloader when you can punch bytes directly to flash via ISP.

 

Even after many years of experience with AVR, going through AVRISP-MKII, DRAGON, and other interfaces, today I use a plain cheap Chinese USBASP $3 interface connected to my PC USB.

As the "IDE", I use the Programmer's Notepad 2 (PN2), since you can program Ctrl-KEY to execute external programs, so I use AVRASM2 as the assembly program, and AVRDUDE as the programmer software.

All embedded into the PN2, it end up fast, simple and works.   For more detailed information, when needed, I use AVRDUDESS, it is the AVRDUDE dressed for a party, its graphic interface allows deeper observation.

 

Oh, yeah, in the past (when I didn't know better) I used AVRStudio version 4.19, the fastest.  The actual version is huge to install.

As nothing else is out there, I still use AVRStudio when I need to count clock cycles or instructions some routine run, with the simulation of assembled code.

 

I posted a little more information about IDE for AVRs in my blog, please use "translate to English", since the blog is in Portuguese.

http://waglip.blogspot.com/2021/09/ide-para-avrs.html

Wagner Lipnharski
Orlando Florida USA

Last Edited: Mon. Sep 27, 2021 - 10:27 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

First thank you very much for answers.

 

westfw wrote:

8. It seems that different pins are used by Micronucleus for ATtiny85 and ATtiny84 chips. Is that right?

Different in what sense?  The 85 is an 8pin chip, the 84 is a 14pin chip, so some of the "same signals" have moved to "different pins."
MN uses a software bit-banged implementation of USB, and IIRC that wants at least one of the USB data signals connected to a pin that generates interrupts on the AVR.  If it needs the full-featured "external interrupt" capability rather than just "pin change" interrupts, it looks like that means it needs PB2 (INT0), which is pin7 on an 85 or pin5 on an 84.

 

Well, ATtiny85 apparently uses PB3/PB4 (IDE3/IDE4) and ATtiny84 PA1/PA0 (IDE12/IDE13) for USB communication.  I included pinouts to clear the mess a bit.

 

westfw wrote:

instructions on internet are fragmented

Yes.  People with prior microcontorller experience keep wondering how a rather featureless IDE and some not-that-well-written libraries came to dominate the "maker market", without ever really understanding how much of a barrier it was to have to download SW from several different sites, buy and hook up am ISP programmer, read a half-dozen or so lengthy and obtuse documents, and build a circuit, before you could actually DO anything (even as simple as blink an LED.)  Whereas with an Arduino, you installed one app, plugged in your board, loaded an example and flew...

 

I am neither an electrical engineer nor a programmer. Reading manuals would get me nowhere. But with the Arduino IDE ecosystem I got interested, switched to bare chips and even developed my own DCC turnout decoder. Which is now even being copied by other people.

 

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

westfw wrote:

I'll check out your site in a bit...

General comment: It would be good if your circuit diagrams explicitly included the necessary common ground wire.  Because beginners don't necessarily KNOW about that.

 

I am sorry, I don't understand what you mean.

 

westfw wrote:

Then connect the MOSI (PB3), MISO (PB4) and SCLK (PB5) pins of the programming device and the target device. In addition, connect the PB2 pin...

"Pins" on Arduino boards have too many different names :-(  SCLK. PB5.  D13.  19.
Of those, I think the "PBx" names are the least commonly used.  And the SPI or ISP pins won't always be PBn  (The tiny84 you mentioned has MOSI on PA6...)

 

I added a pinout table to make everything clearer.  I only came across Arduino IDE and official manual names, so I'll stick with them.

 

westfw wrote:

Finally, upload the code by selecting Upload Using Commander in the Sketch menu.

"Upload using Programmer" on my systems.  Is that a language issue?

 

Arduino Uno uses the CH340G chip

Arduino Uno uses a second AVR chip, usually a ATmega16u2.   The CH340G is very popular on "Chinese Clones" of the Uno, but they're not supposed to actually call themselves "Arduino Uno"  (the more aware vendors usually say something like "Arduino Compatible Uno328" or "Uno R3 compatible with Arduino."   The less aware vendors don't much care about trademark law.

Corrected.

 

westfw wrote:

The problem is that the ATtiny series microcontrollers do not support the hardware UART protocol.

The ATtiny chips are just as capable of supporting UART protocols (bit-banged by SW) as they are USB protocols (also bit-banged.)  And in fact ATtinyCore supports Serial uploading using Optiboot on most of the chips it supports (including tiny85 and tiny84.)  The Direct USB connection on boards like the DigiSpark is designed to minimize the size and cost of the resulting board (using a UART protocol would have required a second chip like on the Uno, or a special cable.)

 

 

The important word here is "hardware".  I suspect they realised they will have to bitbang either USB or UART protocol.  And perhaps code for USB protocol was shorter or/and required no intermediate chip, so why not?

 

Thanks again.  Please have another peak at https://www.pinteric.com/avr.html, if you can.

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

GermanFranz wrote:

Pygmalion wrote:
ATtiny85

 

Don't be too long with those old chips.

Modern AVR like Tiny1614/24 or AVR128DB

are better at everything.  Often enough even in the price.

Today 3 lines are sufficient for programming: UPDI,VCC,GND.

 

 

It will take a decade or more to match software and human support that exists for "standard" chips.  For example, I am using huge and complex NmraDCC library that is tested only on ATmega328P and ATtiny85.  Too much hassle to adapt it for other chips or even write a new library for other families from the scratch.

 

Last Edited: Tue. Sep 28, 2021 - 11:07 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Pygmalion wrote:
Too much hassle to adapt it for other chips or even write a new library for other families from the scratch.

 

Yes I understand, have fun with your development.

I myself do not want to be dependent of any libraries and program purely in assembler.  It always supports the latest chips and it's always fun to be able to use their latest features.

Last Edited: Tue. Sep 28, 2021 - 11:29 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Pygmalion wrote:
It will take a decade or more to match software and human support that exists for "standard" chips.  For example, I am using huge and complex NmraDCC library that is tested only on ATmega328P and ATtiny85.  Too much hassle to adapt it for other chips or even write a new library for other families from the scratch.

 

Not so fast.....

 

You can create a simple program in Studio, link the library and run the compiler, and fix whatever it barks at(errors/warnings).

 

One of the great things about most AVR's is the ability to move from platform to platform with minimal headaches(most of the time).  Granted, moving to the more modern devices might pose a challenge, but you have us here willing to help.

 

Also, tr not to think to deep into things.  Just look at what is easiest for you, and build from there.

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

GermanFranz wrote:

I myself do not want to be dependent of any libraries and program purely in assembler.  It always supports the latest chips and it's always fun to be able to use their latest features.

 

???

 

I write my own libraries and program purely in C. My compiler always supports the latest chips.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

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

Brian Fairchild wrote:
own libraries

 

... are also possible in assembler.

 

Brian Fairchild wrote:
My compiler always supports the latest chips.

 

often not immediately, sometimes with bugs.  I heard ... 😉

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

Brian Fairchild wrote:
My compiler always supports the latest chips.

 

often not immediately, sometimes with bugs.  I heard ... 😉

 

Actually the compiler doesn't need to know anything about new chips. Such details are all in a .h file containing the memory address of any new peripheral registers. So that means as soon as a new chip is available it's very easy to be able to compile code for it.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

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

Brian Fairchild wrote:
Actually the compiler doesn't need to know anything about new chips. Such details are all in a .h file containing the memory address of any new peripheral registers.
It's not just .h - devices are usually supported by code in the C library too. EEPROM support comes to mind but there are other things too.

Last Edited: Tue. Sep 28, 2021 - 03:58 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

wagnerlip wrote:
I used AVRStudio version 4.19, the fastest.  The actual version is huge to install.

 

I use AtmelStudio 7 on a 10 year old little laptop with with 2 GB of memory and a 500MB version of Windows 7 Starter.  When I start up AS7, my memory usage goes up about 2MB.  Negligible.

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

MarkThomas wrote:

wagnerlip wrote:
I used AVRStudio version 4.19, the fastest.  The actual version is huge to install.

 

I use AtmelStudio 7 on a 10 year old little laptop with with 2 GB of memory and a 500MB version of Windows 7 Starter.  When I start up AS7, my memory usage goes up about 2MB.  Negligible.

 

It may run nicely yes, but it is fat.  The 4.19 installation file is 125MB in size, while the 7.0.238 is 874MB and after install the folder expands to 1.7GB. 

Of course, the 7.0.238 covers more chips, more functions, etc, I understand that. 

But why would I install fatty files and libraries for SAM, Battery, etc, if I just need the Studio to simulate routines for AtMega and have cycles count?

 

Just for fun, I installed the 7.0.238 in a small computer (Intel Atom Win7, 4Gig, 128GBSSD), it took more than 20 minutes installing.

After that I didn't see anything so much deeduper on version 7 to outshines the 4.19 for AtMega use. 

 

Life options.

 

Wagner Lipnharski
Orlando Florida USA

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

I don't install the whole thing.  I am only using ATmega328p and 1284p.  AS was a natural for me because I developed code for money in Visual Studio C++.  I am 100% Windows.  My wife worked at MSR for a lot of years.

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

The entire AS7 suite does take some time, and it will take about 3Gb off your hard drive, but considering how “cheap” hard drives have become, 3Gb is trivial in this day and age.

 

as Mark accurately wrote, you do not have to install the entire suite.  Just what you think you need.

 

I admit I liked AS4.19.  But the newer debuggers are not compatible with it, neither are newer devices.  If you are using older tools, and the older chips, then no reason not to stay with 4.19.  I have both AS7 and AS419 on my machines for legacy support and current projects……

 

jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

Yep, I have a 4.19 copy too, though very rarely fiddle with it nowadays. I remember an earlier version seemed to only take maybe 40-50 meg.  What is interesting to appreciate (as we slowly forget) is that typing 50meg of anything is a lot of typing.

When the author tells me that some file is "only" 279 meg, I wince a little & say on your mark, get set, start typing.  They forget what it would look like if it were text pages setting in a bookcase. 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

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

I started on AVRStudio 5.1, but I am a relative newbie.

 

avrcandies wrote:
typing 50meg of anything is a lot of typing

 

So true.  Multi meg of source code is daunting.

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



I started on AVRStudio 5.1,

You deserve a free shirt and a banner, saying you lived to  tell...5.1 was terribly awful (the first "big studio") many ran for the hills or set up  shop selling pots and pans and left programming.   

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Fri. Oct 1, 2021 - 07:22 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I use Arduino 1.8.18 and I'm proud of it.   It does all that I need and it does it better, easier, and cheaper than any alternative that I have ever tried.

 

Microchip Studio is huge, bloated, slow, over-engineered, and plagued with an incomprehensible (meaning...worthless) user interface.   Even with a solid-state RAM drive, it takes over a minute and a half to load on a modern laptop.  I work with ATmega328P, ATtiny1634, and ATtiny25:85 only for Microchip parts.  Anything that the mega328 can't handle goes to either a BluePill (STM32F103:ARM), or, more likely now, a $3 WeMos D1_R1 module with 1Meg flash, 20K RAM, 80MHz clock, WiFi, and full TCP/IP stack.  I doubt that I will ever use any of the more modern Atmel AVR chips for no other reason than I can't plug a USB cable from my laptop running Arduino into any inexpensive, widely-available-on-eBay module board that contains a modern AVR device.  And the reason no one will make an inexpensive modern-AVR module board is because the new AVRs don't do anything that the old megaAVRs can't do.  And, no, a $14-$30  XPRESS board is an not inexpensive module alternative, even if does have a debugger.   No one needs a debugger.  Yeah, sure, I'm used them when unscrambling dense assembler code.  But, as St. Paul said, I've put away all my childish things, and don't use assembler anymore.

 

   Someone at Atmel about ten years ago made the decision to completely change the device programming interface from ISP to UPDI, and, then to NOT include a built-in non-volatile bootloader.  I hope that this person has moved on to a new and exciting career in the fast-food-service industry, because it is one of the dumbest things that Atmel has ever done.  It was even dumber than making it absurdly easy to completely 'brick' a chip by changing 'fuses'.  The only people using the newer AVRs are buying them in lots of 10000.  

 

  Using Arduino is like just driving a Honda Civic: using Microchip Studio is like having to learn to fly a Boeing 747.   Sure Studio can work with more AVR devices.  But since the devices are all more-or-less the same, all the effort and hassle of learning Studio doesn't deliver enough more than Arduino does to make all the effort and hassle of learning Studio worth it.

Last Edited: Fri. Oct 1, 2021 - 02:55 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Simonetta wrote:
Even with a solid-state RAM drive, it takes over a minute and a half to load on a modern laptop. 

 

I just 'timed' my Studio install startup time and I counted about 20 seconds from double click of the icon to selecting the project I want to open.  32Gb of RAM, Core i7 and a 1Tb SSD.  Not that it matters.

 

Simonetta wrote:
Using Arduino is like just driving a Honda Civic: using Microchip Studio is like having to learn to fly a Boeing 747. 

LOL, I actually liked that.

 

Since you seem to have nothing positive to say about Atmels tools, or for that matter anything Atmel, why not abandon using their parts and move exclusively to the parts you like to advertise in your posts?

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

avrcandies wrote:
You deserve a free shirt and a banner, saying you lived to  tell...5.1

 

I'll take a free T- shirt.  I liked it.  It was totally familiar and intuitive.  I was just writing C code for a 328p and never ran into any of the bugs I heard about, or I attributed them to myself.

 

Simonetta wrote:
Microchip Studio is huge, bloated, slow, over-engineered, and plagued with an incomprehensible (meaning...worthless) user interface.

 

Blah, blah, blah.  I just loaded my Atmel1284 project in 11 seconds on last year's Lenovo 32GB ThinkBook.  Studio is complicated, but I only learned the few things I had to when I took a job coding after being away from software for 15 years.  It took about 15 minutes to get the debugger running on a couple megabytes of source code on my first day at work and start racing with my future partner in crime to find a particular bug.  It's not that complicated.  Arduino is like the Honda Civic I used to have and love, but I would rather drive my turbo Mini.

 

Does Arduino have on chip debugging yet?  Or did it always?  I avoid Arduino because I'm lazy about learning another language.  The boards are OK.  I like the Chinese Nano's with the 6-pin ISP header.

 

 

 

 

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

Simonetta wrote:

...because the new AVRs don't do anything that the old megaAVRs can't do

The only people using the newer AVRs are buying them in lots of 10000.  

 

You are completely wrong.

Is that wishful thinking?

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

Simonetta wrote:
... with an incomprehensible (meaning...worthless) user interface.
Some operators prefer the Visual Studio look-and-feel (makes Microchip Studio stand out among MCU IDE)

Simonetta wrote:
... because the new AVRs don't do anything that the old megaAVRs can't do.
One may have an interest in the new peripherals (an advantage of the acquisition of Atmel by Microchip and all in the 8 bit design center [PIC peripherals])

Simonetta wrote:
No one needs a debugger.
Concur; a logic analyzer is an alternative.

Asked a former colleague which debugger he operated; he answered with "printf"cheeky

Simonetta wrote:
But, as St. Paul said, I've put away all my childish things, ...
Childish for me; the teenagers here are a cat and dog (I have to rough house as they lost their siblings)

Simonetta wrote:
... and don't use assembler anymore.
Sometimes

  • have to a wee bit (BSP for RTOS and frameworks)
  • customer requires

Simonetta wrote:
Someone at Atmel about ten years ago made the decision to completely change the device programming interface from ISP to UPDI, ...
Five years ago

Simonetta wrote:
... and, then to NOT include a built-in non-volatile bootloader.
That may be currently rectified by a first silicon.

 


Visual GDB is a Visual Studio extension at a relatively low price.

AVR Devices | Choosing a Debug Method – VisualGDB Documentation

 

AVR® Dx - Additional Peripherals | Migration from the megaAVR® to AVR® Dx Microcontroller Families

 

Troubleshooting real-time software issues using a logic analyzer - Embedded.com

[end of first paragraph]

Adding breakpoints to monitor the interrupt will likely break functionality.

 

Tracing requirements through to object-code verification - Embedded.com

 

with thanks to Ron Sutherland :

DU-series | GitHub - SpenceKonde/DxCore: Arduino core for AVR DA, DB, and future DD-series parts - ...

...

...  and a few new self-programming features, "Immutable boot" and a "boot row" pointing towards a builtin facility for USB programming. 

...

via USB or USB OTG Host: AT90USB1287 Only? | AVR Freaks

AVR DU | AVR Freaks

 

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

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

MarkThomas wrote:
Does Arduino have on chip debugging yet?
Some do by OpenOCD though EDBG is present.

MarkThomas wrote:
Or did it always?
No though an AVR GDB stub exists and debugWIRE has been reversed.

MarkThomas wrote:
I avoid Arduino because I'm lazy about learning another language.
Learning C++ is worth the significant (more than?) effort.

Am interested in C++23's fixed-point arithmetic.

 

P.S.

MarkThomas wrote:
... Lenovo 32GB ThinkBook.
Good choice though 32GB mass storage limits to Windows 10 (32GB RAM? ... nevermind)

 


Arduino - Visual Studio Marketplace

...

Arduino for Visual Studio Code

...

[3/4 page]

Debugging Arduino Code preview

 

avr-stub — PlatformIO 5.2.0a5 documentation

debugWIRE via USB UART | AVR Freaks

building on windows · Issue #48 · dcwbrown/dwire-debug · GitHub

AVR Studio On Mac & Linux? | AVR Freaks

AVR in VS Code | AVR Freaks

 

How to Get Started with C++ in Embedded Systems (Barr Group)

C++20 Serves Up Intriguing Embedded Features | Electronic Design (modules replace #include)

Interactive C++ with Cling | The LLVM Project Blog (Cling is a C++ interpreter)

Composition of Arithmetic Types (in standard as a working group)

GitHub - johnmcfarlane/cnl: A Compositional Numeric Library for C++ via The Embedded Muse 361 - Tools and Tips

 

Windows 11 | AVR Freaks

 

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

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

gchapman wrote:

Learning C++ is worth the significant (more than?) effort.

 

I was forced into C++ and really never understood the object thing.  Now after being away from it for 10 years I think I get it.  The other programmers just looked at me in pity and said "it's just code to him."

 

gchapman wrote:

(32GB RAM? ... nevermind)

 

smiley I only got half a terabyte of SSD.  I mainly care about code and datasheets.  It's plenty.  I don't do video or a lot of images.  I recently bought my wife an I7 of the same model with 2 TB.  She needs it.  And it's mostly her money anyway.  She hates to shop for computers.

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

MarkThomas wrote:
Ah, yes.  DTR.  Not DRT.  At least I got the letters right, but not the order.

After all the vac's lately, who is not dyslexic these days! devil

 

Keys to wealth:

Invest for cash flow, not capital gains!

Wealth is attracted, not chased! 

Income is proportional to how many you serve!

Lets go Brandon!

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

I thought vac's was an old computer.

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

Simonetta wrote:

I use Arduino 1.8.18 and I'm proud of it.   It does all that I need and it does it better, easier, and cheaper than any alternative that I have ever tried.

 

Microchip Studio is huge, bloated, slow, over-engineered, and plagued with an incomprehensible (meaning...worthless) user interface.   Even with a solid-state RAM drive, it takes over a minute and a half to load on a modern laptop.  I work with ATmega328P, ATtiny1634, and ATtiny25:85 only for Microchip parts.  Anything that the mega328 can't handle goes to either a BluePill (STM32F103:ARM), or, more likely now, a $3 WeMos D1_R1 module with 1Meg flash, 20K RAM, 80MHz clock, WiFi, and full TCP/IP stack.  I doubt that I will ever use any of the more modern Atmel AVR chips for no other reason than I can't plug a USB cable from my laptop running Arduino into any inexpensive, widely-available-on-eBay module board that contains a modern AVR device.  And the reason no one will make an inexpensive modern-AVR module board is because the new AVRs don't do anything that the old megaAVRs can't do.  And, no, a $14-$30  XPRESS board is an not inexpensive module alternative, even if does have a debugger.   No one needs a debugger.  Yeah, sure, I'm used them when unscrambling dense assembler code.  But, as St. Paul said, I've put away all my childish things, and don't use assembler anymore.

 

   Someone at Atmel about ten years ago made the decision to completely change the device programming interface from ISP to UPDI, and, then to NOT include a built-in non-volatile bootloader.  I hope that this person has moved on to a new and exciting career in the fast-food-service industry, because it is one of the dumbest things that Atmel has ever done.  It was even dumber than making it absurdly easy to completely 'brick' a chip by changing 'fuses'.  The only people using the newer AVRs are buying them in lots of 10000.  

 

  Using Arduino is like just driving a Honda Civic: using Microchip Studio is like having to learn to fly a Boeing 747.   Sure Studio can work with more AVR devices.  But since the devices are all more-or-less the same, all the effort and hassle of learning Studio doesn't deliver enough more than Arduino does to make all the effort and hassle of learning Studio worth it.

 

+1

Totally agree. Quick, easy, less bugs.

Yes I have done successfully projects with Studio 7.

However just like a pilot in a heavy aircraft the thing is so inoperable that the emergency procedure mandates reading documentation while the thing is crashing.

The current Arduino Beta version IDE has auto fill, live debugging and more added.

Also I have found an advantage of Arduino is I have been able to get an easy look in at some of the latest offerings from other manufacturers. 

Considering what has been happening in the arena here that has been a real benefit.

 

Last Edited: Sat. Oct 2, 2021 - 12:31 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MarkThomas wrote:

I was forced into C++ and really never understood the object thing. 

 

+1

Linguistic effort and complex structure are disproportionate when programming small microcontrollers.

What was intended as a simplification quickly turns into a complicated, intransparent and (due to a lack of necessary knowledge) inefficient monster.

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

I always assumed C++ must compile big, with the extra burden of objects and copies thereof.  Maybe it's just a bunch of extra pointers.  We worried about keeping data and functions compartmentalized in the '80's, like objects, but when the idea got implemented it seemed convoluted.  I'm old school.  These wippersnappers and their C# are pussies.

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

GermanFranz wrote:
Linguistic effort and complex structure are disproportionate when programming small microcontrollers.

 

Not just microcontrollers.

 

GermanFranz wrote:
What was intended as a simplification quickly turns into a complicated, intransparent and (due to a lack of necessary knowledge) inefficient monster.

 

+10  yes

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

Quoting myself, I actually sort of liked C#.

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

GermanFranz wrote:

MarkThomas wrote:

I was forced into C++ and really never understood the object thing. 

 

(...)

What was intended as a simplification quickly turns into a complicated, intransparent and (due to a lack of necessary knowledge) inefficient monster.

 

 

Well, you don't need to use all the features in C++. For example, you can use only namespaces to organize your code, and keep programming as if it was regular C.

If a C++ purist tells you this is not how you use C++, you just need to say: "Well, this is embedded C++, you are not aware of the limitations of an MCU" and the purist goes away.

 

Basically you only use stuff that helps and doesn't cause bloat. In fact we already do the same with C, every AVR programmer worth their salt knows floating point code is to be avoided whenever possible.

 

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

El Tangas wrote:
Well, you don't need to use all the features in C++.

 

Actually, I don't need to use any of the features in C++.  smiley

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

I always think, the ones running Intel i7 with 32GB of RAM and SSD should never be programming AVRs...  cheeky

Wagner Lipnharski
Orlando Florida USA

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

Need that class of computer iron to do automated regression testing at a reasonable interval (AVR simulators are relatively slow); likewise for static analysis.

 

Jay has a 4KUSD+ PC though he also has a USB3-interfaced logic analyzer.

Here's how I juggle embedded projects (home office/workspace tour) - Jay Carlson

[2/3 page]

A desktop computer

...

With this setup, I can recompile a (light-weight) Linux kernel in 30-60 seconds and create an entire Buildroot-based rootfs in 15 minutes, so it’s been a measurable boost in productivity for my embedded Linux-based projects.

 


$1 MCU review — looking for AVR part suggestions | AVR Freaks

SWT: Threadripper Workstation

The Logic Analyzer with Analog - Saleae

 

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

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

wagnerlip wrote:
I always think, the ones running Intel i7 with 32GB of RAM and SSD should never be programming AVRs...  cheeky

I'm running i5.  I need the horsepower for AS7 to program the AVRs..

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

MarkThomas wrote:
I need the horsepower for AS7 to program the AVRs..

That is actually not true.  AS7 runs fine on a 2GB Samsung with a spinning disc.

 

Edit:  And Windows 7 Starter.  I think it's called backward compatibility.

Last Edited: Wed. Oct 13, 2021 - 01:05 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My AVR code runs three 16 channel TLC5940 LED drivers.  Our lamp has 205 LEDs in strings of more than 5 different peak wavelengths.  We can make any color you want as bright as you want except 480nm.  If anyone comes across some 480nm LEDs please buy me a hundred.  My compiled code is slightly more than 32k so I had to go to an ATmega1284p.  The code is professional quality, and if you know C you can read it like a cheap novel.  And you don't think I should be writing AVR code?? 

 

Edit:  I have two words for you,

Last Edited: Wed. Oct 13, 2021 - 02:54 AM