Notifications
Clear all

ATmega328P query

33 Posts
5 Users
1 Likes
7,740 Views
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
Topic starter  

I have got some 28DIP ATmega328P chips on order and I was wondering if there is any way to determine if a bootloader is already installed. Or if a bootloader is already installed whether I can re-burn the bootloader on to the chip?

I was looking at the ArduinoISP sketch, but there does not seem to be an error thrown if the sketch finds a bootloader already on the chip!


   
Quote
Topic Tags
Evile
(@evile)
Member
Joined: 4 years ago
Posts: 12
 

The P designation indicates they are  Preloaded. *

Terms and conditions apply, cheap Chinese clones may copy model numbers but not function.

This post was modified 4 years ago by Evile

   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
Topic starter  
Posted by: @evile

The P designation indicates they are  Preloaded. *

Terms and conditions apply, cheap Chinese clones may copy model numbers but not function.

That was what I worried about, I have sourced one chip locally and 10 from the other end of the Silk Road, because I couldn't wait 4-5 weeks to get at least one, for testing with my remote sensors!


   
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1018
 

@pugwash and @evile

You mention the "P" designates the bootloader, but I could use some verification.

The chips I bought, from Digi-Key not from One-Hung-Low, have "-PU" after the ATMEGA328.  Not "P-PU," but do not seem to have the bootloader on them.  I thought I remembered from the DroneBot Workshop video that Bill said the "PU" indicated an already installed bootloader.  Is it the "P" directly after the 328 that is the significant one to be looking for?  Guess I'll get to learn how to burn the boot loader now!

 

SteveG


   
ReplyQuote
Evile
(@evile)
Member
Joined: 4 years ago
Posts: 12
 

Ahh you got me..I was just recalling Bill's video myself.

More research later... 662 page  datasheet /sigh
PU is the temerature rating (-40 to +85) more industrial versions have ANR (-40 to +105).
P directly after the part number actually means picopower, a newr range of low poer chips. 
Okay this is where it gets confusing Amtel have been brought out by Microchip, who have changed the designations, just because. So depending on how old the stock is, The Microchip designations above may not be relevant.

There are about 60 total designations in total (p628 onwards), outlining the package shape, temperature and power consumption, hardware interrupt vectors, and a bunch of other stuff but here is the gotcha.
None of the designations indicate bootloader preload, this kind of makes sense, as different manufacturers and applications would have their own suitable bootloaders, just because a bootloader is present, it does not mean it's compatible with the Arduino IDE, it could as easily be a bootloader for an automotive applications, secure bootloader and so on. 
The takeaway for this is the bootloaders are applied by third parties and may or may not be what you want for your application, unless explicitly stated. They wont have any impact on the designation printed on the chip unless its a clone or the third party chooses to print additional information.
Ultimately if you've brought a tube of bare SMDs unless sold as Arduino compatible, you'll just have to try a blink upload and see if it works.

Ref:- http://ww1.microchip.com/downloads/en/DeviceDoc/ATmega48A-PA-88A-PA-168A-PA-328-P-DS-DS40002061A.pdf


   
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1018
 

Has anyone actually burned a bootloader on to ATmega328 that did not already have the bootloader installed?

I'll have to admit I'm stumped trying to follow the directions provided by Arduino at this link!

The instructions are quite pitiful or at least confusing and then add in the comments in the ArduinoISP sketch and you can get really lost.

I eventually thought I had it figured out but then was getting the error shown in the pic below.  I even tried a fix I found in a another forum but that didn't work either.  Was still getting same error!

BurningBootLoaderError

Has anyone that has programmed a bootloader encountered this error and subsequently resolved the issue?

SteveG


   
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1018
 

@evile

I tried to upload the blink sketch on to a fresh chip from the batch I bought and it just seemed to hang.  Thought that might mean no boot loader.

And from my error message it says try to force with the "-F' parameter.  Any idea how to do that?

SteveG


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
Topic starter  

@codecage

My understanding is that sketches should run on the ATmega328 even without a bootloader, as the chip will always start at register 0 of the flash memory. Not all microprocessors have bootloaders, the ones in your washing machine or dishwasher probably don't. But it may be the case that if you load a sketch on to a chip without a bootloader, you may never be able to write new code to that chip.

I believe the simplified explanation is as follows:

The function of the bootloader, which is stored at the top of the flash memory, is to decide whether new code is being received through the serial interface. If YES, write the new code over the old code starting at register 0 and then run the new code, if NO, go immediately the register 0 and run the existing code.


   
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1018
 

@pugwash

Well that's not quite the way I understand it, but I have been wrong at least once in my life! ? 

In order to upload sketches to the Arduino I think you have to have the bootloader on the Arduino ATmega328 (again that's my understanding at the moment).  I'm intending to do a lot of research today to see what I can find out, and that may alter my understanding.

Stay tuned everyone as I will post my results in this thread.

SteveG


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
Topic starter  

@codecage

This might be a well spent 25 minutes before you start!


   
NewburyPi reacted
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1018
 

@pugwash

I am going to watch it for sure, but I have had success in getting the bootloader installed on the ATmega328 chip!   It was a round about and convoluted journey, but I can now accomplish the task.  I will get this WELL documented and share with the group, but first I want to figure out and resolve how to make it work with the current version of the Arduino IDE.  That's not to say it won't be another hair pulling experience when the next version of the IDE is released, but I'll at least have a clue of what  the issue is.

First and foremost I want to tell everyone ALWAYS buy the ATmega328P chip, NOT the ATmega328 (without the P after the *8!).  The variety without the P is no longer supported by Arduino, hence the issue trying to install the bootloader.  The P on the end does NOT guarantee that the bootloader is there!  It is just an indicator for "Pico" power, the one everyone wants anyway.  The non-P chip consumes more power, so if you are going for battery savings you definitely don't want that chip.

I found some posts on Instructables that helped me get to a state where I could install the bootloader on the non-P chip, but even they left some things to be desired.   Taking what I have learned so far I am going to attempt to accomplish the same thing with the version of the Arduino IDE that I am currently running, i.e. 1.8.10.

Stay tuned for further updates!

SteveG


   
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1018
 

@pugwash

Good video!  But he covers just the P version.  I have 10 of the non-P version, but doubt I'll ever buy another, but if I happen to have one fall in my lap I'll be able to handle it!

SteveG


   
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1018
 

@pugwash

And to address your first post in this thread, I think it just overwrites the bootloader when you go to install it.  I think somewhere in the documents I waded through today I came across a blurb about the first thing it does is erase anything that is there before writing the 'new' bootloader.  If that wasn't the case you'd have no way of upgrading a bootloader if there was ever some new and improved version that need to be installed.

SteveG


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
Topic starter  

@codecage

I eagerly await to hear how you got on!

I did a "Dr Christian Barnard" on an Arduino Uno and the blink sketch uploaded and ran, as did some other sketches. Therefore I assume that the ATmega328 I sourced here already had a bootloader installed. But I am still having trouble getting the chip to run on the internal 8MHz oscillator.

I guess it is back to youTube and watch those videos again to see what I am missing. 


   
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1018
 

@pugwash

Again I could be mistaken on this point, but I think you have to load the bootloader while running in 8MHz mode for ATmega328(P) to run later in 8MHz mode.  If the bootloader is installed using the 16MHZ crystal, then it will only function as a 16MHz ATmega328(P).  That's something I stumbled across in the many videos and post I waded through yesterday.  Either that, or I misunderstood completely.

Notice I used the "P" in parentheses when I used ATmega328 above.  Mean both varieties of the chip.  I thought it wise to start specifically identifying which of the two versions of the chip I was referring to, especially in the context of the bootloading issue, since the procedure to do that is convoluted at best.

While Bill had mentioned in his first video about just using the ATmega328P chip instead of using a full blown UNO he referred to the "P" as indicating that the chip had a bootloader (I pretty sure he said that).  But I'm now aware that the "P" stands for "Pico power" which means the chip is able to consume less power than the variant without the "P" (ATmega328).  We probably all want the Pico model anyway, so from now on that is all I will ever order.  Now I just need to figure out how to use the ten ATmega328 chips I ordered from Digi-Key a few months ago.  At least now I can get the bootloader on them.

By the way I noticed the other day that Digi-Key now throws a note up on their page to contact them for programming their ATmega328(P) chips (don't remember seeing that note when I ordered mine).  From that I gather that if you don't contact then about programming all their chips come WITHOUT a boot loader.

SteveG


   
ReplyQuote
Page 1 / 3