Unable to program ATMEGA328PB?

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

Hello all,

 

I am trying to implement QTouch library with ATMEGA328PB. Code is compiling well but I am not able to upload code to MCU. Below is the response I am getting from avrdude. 

 

avrdude: auto set sck period failed
avrdude: error: program enable: target doesn't answer. 1 
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x886b2e
avrdude: Expected signature for ATmega328 is 1E 95 14

avrdude done.  Thank you.

I am using this USBASP Programmer:https://www.amazon.in/Embeddinator-ENG-PROGV1-1-Embeddinators-USB-ASP-Programmer/dp/B01MT0IFT6?tag=googinhydr18418-21&tag=googinkenshoo-21&ascsubtag=bfa0083c-c853-4d04-93b8-603aba2b0b7f

 

And I am using this ATMEGA328PB board:https://exploreembedded.com/wiki/Tit,_a_supercharged_Arduino_Pro_Mini_with_Atmega328pb

 

The programmer I am using don't have Reset pin so is this the problem because of which I am not able to program?

 

I am checked the connections and are correct.

 

Please guide me.

This topic has a solution.

In love with ARM!

Last Edited: Sat. Jan 13, 2018 - 07:07 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MA1993 wrote:
Below is the response I am getting from avrdude.
mega328PB is a very recent addition to AVRDUDE.

http://svn.savannah.gnu.org/viewvc/avrdude?view=revision&sortby=rev&revision=1397

via http://savannah.nongnu.org/projects/avrdude

and http://avrdude.nongnu.org/

 

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

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

But the current release of AVRDude also lacks support for this. So I changed the config file of it and added ATMGEA328PB. But still the response is same. Due you think my programmer is wrong? because it lacks the Reset pin

 

In love with ARM!

Last Edited: Wed. Jan 3, 2018 - 12:55 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh dear - whoever came up with this was clearly not a native English speaker:

 

Tit-2.JPG

 

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

Yes I am not a native English speaker! smiley 

In love with ARM!

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

MA1993 wrote:
The programmer I am using don't have Reset pin

My guess is RESET is the unmarked pin in the middle....   Please post a picture of your setup.

All six pins must be connected (correctly) in order to program your mpu...

 

Jim

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

ki0bk wrote:

My guess is RESET is the unmarked pin in the middle....

And my guess is that RESET is marked RST, and is available on both sides of the board.

 

EDIT: Or perhaps you meant the programmer...... Silly me.

 

Last Edited: Wed. Jan 3, 2018 - 03:09 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't see a programming header on that Tit board, so are you sure you made the right connections?

You need to connect to MOSI0/MISO0/SCK0 of the 328PB. That is pins 11, 12 and 13. And to reset.

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

Oh dear - whoever came up with this was clearly not a native English speaker:

Tit for tat..?

 

All six pins must be connected (correctly) in order to program your mpu...

 

This might help:

 

Greg Muth

Portland, OR, US

Atmel Studio 7.0 on Windows 10

Xplained/Pro/Mini Boards mostly

 

 

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

ki0bk wrote:
All six pins must be connected (correctly)

Greg_Muth wrote:
This might help

So where's the 6th pin ?

 

EDIT

 

fix quote

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

@awneil wrote:

So where's the 6th pin ?

 

I didn't realize until after I posted that one was missing.  After looking at the diagram some more, it is not an ICSP connector.  The Tit is sold as an Arduino and the webpage the OP gave us above explains how to install the add-on for the Arduino IDE.  I'm guessing it comes with the Arduino bootloader burned into it and it is intended to be programmed with the Arduino IDE.

Greg Muth

Portland, OR, US

Atmel Studio 7.0 on Windows 10

Xplained/Pro/Mini Boards mostly

 

 

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

Actually I have the pinout map of Tit board which gives information about MOSI,MISO,SCK And I have connected it as you said except Reset pin. My USB-ASP programmer lacks reset pin. I have given link to programmer also.
So disconnection of reset pin maybe the reason I am not able to program?

In love with ARM!

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

Yes it has Arduino bootloader. But I am not using Arduino IDE. I am using Atmelstudio7.

But bootloader shall not cause problems in uploading hex files using ICSP isn't it?

In love with ARM!

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

MA1993 wrote:
My USB-ASP programmer lacks reset pin.
That's odd as original USBasp has reset on ISP connector pin 5 :

USBasp schematic

via http://www.fischl.de/usbasp/

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

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

MA1993 wrote:
My USB-ASP programmer lacks reset pin. I have given link to programmer also.

So disconnection of reset pin maybe the reason I am not able to program?

I doubt that your USB-ASP programmer lacks a reset pin, it has to be one of the six pins.

 

The link to the programmer is your ticket to find out what the actual pinouts are.  I am assuming you bought it from them, if so ask them a question at that link to provide the pinout and a schematic of the product.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"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

I took a better look at the programmer, and I think I know which pin is reset:

 

 

If you have a multimeter, you could check for continuity between pin 1 of the MCU and this pin. And remember you have to cross link MISO to MOSI and vice-versa.

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

ki0bk wrote:
My guess is RESET is the unmarked pin in the middle....   Please post a picture of your setup.

El Tangas wrote:

I took a better look at the programmer, and I think I know which pin is reset:

Ya think? ;-)

 

El Tangas wrote:
If you have a multimeter, you could check for continuity between pin 1 of the MCU and this pin. And remember you have to cross link MISO to MOSI and vice-versa.

This is the best advice given so far, though I would just hook it up and see if it worked.  It is a USBASP after all, and all USBASPs that I have ever seen have a reset pin.  MA1993, go for it, hook it up!

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"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: Thu. Jan 4, 2018 - 05:29 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

larryvc wrote:
It is a USBASP after all, and all USBASPs that I have ever seen have a reset pin.

How can one do ISP on an "normal" AVR8 without being able to put the target AVR into reset?  I suppose one could hold down a reset button.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

awneil wrote:
Oh dear - whoever came up with this was clearly not a native English speaker:

Using this device in a class, there were three students -- Tom, Tim, and Tat -- but only two boards.  So when it came to lab time, Tom and Tim got there first.  There was no Tit for Tat.

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

theusch wrote:

larryvc wrote:

It is a USBASP after all, and all USBASPs that I have ever seen have a reset pin.

 

How can one do ISP on an "normal" AVR8 without being able to put the target AVR into reset?  I suppose one could hold down a reset button.

The OP is trying to program the ATmega328 on the Tit using a USBASP device that he bought.  He indicated that his USBASP does not have a reset pin, an assumption only because it is not labeled, but it is pretty obvious that it must.

 

Nothing to do with programming an AVR8.  Or did I completely misunderstand what you wrote :-)

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"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: Thu. Jan 4, 2018 - 09:30 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My cursor goes to the top left of the edit window whenever I hit return.  Things would go a lot easier for AVR students if they would all simply start with a standardized, high-quality, inexpensive, easy-to-use, documented and defined hardware platform.  For now and the foreseeable future, this platform is the Arduino Nano clone using a Mega328P and the Arduino C++ language with extended keywords and the standardized libraries that are included with the distribution (such as Serial.h for USART and Wire.h for I2C).  These little boards sell on eBay and various on-line distributors for about $3 each.  You are not going to be able to make, design, wire, or program a better or cheaper hardware platform unless you are making 100 or more of your prototype design for commercial sale.  So stop trying to do so;  you aren't learning anything useful, you aren't making the little CPU work faster; you aren't 'tuning it up'. You are just screwing up a great hardware platform.  You can do anything in software from the Arduino IDE;inline assembly language;direct peripheral-control register access, macros, recursion, ... everything.  Your teachers are training you to be 20th century programmers with 20th century mind-sets.  Arduino is the first and best 21st century microprocessor development system.  It incorporates everything (except single step debugging) into a super-cheap, well-designed, well-maintained, web-community-supported IDE.  There isn't anything in electronic development tools that comes close in price, support, and ease-of-use for any microprocessor made by any company.

 

Hello,  If you use an ISP interface to program this IC, you will overwrite the bootloader code that is in the Mega328PB.  Depends on whether or not the designers have set the fuses to protect the bootloader area from being overwritten by the ISP.  Most likely not, as the description of how to do this is confusing.   The Mega328PB will have a different signature from the Mega328P, so make sure that the AVRdude's configure file has Mega328PB data in its tables.  The designers went to a lot of trouble to make this IC be Arduino-compatable so that it would be easy to program and work with;  why are you using ISP?  They supply files that configure Arduino to handle the Mega328PB and its additional features.

 

 

 

 

 

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

Simonetta wrote:
My cursor goes to the top left of the edit window whenever I hit return.
OT - Use CTRL enter/return to avoid that, the editors here suck, ask Johan he will tell you all about it.  Another tip, double space when in a reply to keep paragraphs.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"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

Simonetta wrote:

 

Hello,  If you use an ISP interface to program this IC, you will overwrite the bootloader code that is in the Mega328PB.  Depends on whether or not the designers have set the fuses to protect the bootloader area from being overwritten by the ISP.  Most likely not, as the description of how to do this is confusing.   The Mega328PB will have a different signature from the Mega328P, so make sure that the AVRdude's configure file has Mega328PB data in its tables.  The designers went to a lot of trouble to make this IC be Arduino-compatable so that it would be easy to program and work with;  why are you using ISP?  They supply files that configure Arduino to handle the Mega328PB and its additional features.

 

 

Yes, I agree that it would be much easier to use the bootloader to upload code. But maybe the OP doesn't have a USB to serial adapter.

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

theusch wrote:
only two boards

Yes - they usually do come in pairs.

 

I guess, at the end of the practical session, the teacher would have to tell Tom and Tim to stop playing with their tits ...

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

awneil wrote:

theusch wrote:

only two boards

 

Yes - they usually do come in pairs.

 

I guess, at the end of the practical session, the teacher would have to tell Tom and Tim to stop playing with their tits ...

 

Beginning of class:

"Ok, students, everyone has your tits ready?"

"Be sure to check if your tits are working fine."

"Each group grab a tit."

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

I am trying to implement the qtouch library (given by atmel) hence I cannot use Arduino, so I am using USB-ASP. Bootloader won't cause problems to program using USB-ASP as long SPI programming is disabled isn't it? And ATMEGA328PB is not there in avrdude, but I got config file of avrdude on github using which I modified my config file.

In love with ARM!

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

But you don't need to use anything related to Arduino, the bootloader can upload any HEX file via a usb/serial adapater as in post #9. You just need to specify the programmer as "-c arduino" instead of "-c usbasp", set the baud rate to 57600 (-b 57600) and the port to whatever the adapter uses ( -P COMxx).

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you all. Now I am able to program it. I have purchased new programmer Pocket AVR programmer from sparkfun.

In love with ARM!