atmege168pa and atmega328p

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

Hello forum users,

Could you share your experience with me? 

How to convert code from atmega 328p to atmega 168pa?

 

sadf

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

Does your code use more than 16k of flash, 512 bytes of EEPROM or 1k of RAM?

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "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." - Heater's ex-boss

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

My code is 6 kb. I am going to adjust to from atmega328p to atmega168pa.

sadf

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

At the hardware level, other than memory sizes, they are the same chip. So change the processor type selected in your compiler and you should have no problems.

 

[E2A]

From the datasheet...

 

2.2 Comparison Between Processors
The ATmega48A/PA/88A/PA/168A/PA/328/P differ only in memory sizes, boot loader support, and interrupt vector
sizes. Table 2-1 summarizes the different memory and interrupt vector sizes for the devices.

 

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "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." - Heater's ex-boss

Last Edited: Fri. Jan 19, 2018 - 10:36 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I know that they are same chips. MCU is not working after compiling, but it received code. That's why I asked forum. 

sadf

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

But Brian pointed you to the datasheet section which details the differences.

 

Did you look at the mentioned "Table 2-1" ?

 

Have you paid careful attention to all those differences?

 

Have you checked all your Fuse settings?

 

Both chips have on-chip debug - use it to see where things go wrong ...

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

Have you simply tried recompiling the 328 code for the 168? The transition is really just 328p to 168p, the "a" is incidental, that just means a change in fabrication process.

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

So what is your RAM needs?

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

Casper_0770 wrote:
MCU is not working after compiling, but it received code.

Assuming Atmel Studio, i.e. avr-gcc tool chain: Show your build output:

 

  • Do a Rebuild
  • Switch to the Output tab in Studio
  • Mark everything
  • Copy it
  • Paste in a post here

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.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Can you define "not working" (a pointless phrase that means nothing)