Confusion in selecting the ATmega328 IC for my Custom application design board

The alternate cores (previously mentioned support a bunch of different clock rates, with corrected code for the various SW dependancies.

The DA series supports 1, 2, 3, and all multiples of 4MHz up to 24MHz.

1 Like

Hi Sir, thanks for the reply. Atmega328PB will work for 8 Mhz Internal Oscillator as mentioned. Many of the Arduino functions like delay, analogWrite, Serial, etc. rely on the clock being at 16MHz. The question raised is, whether the Atmega328PB will support all arduino functions and libraries with 8 MHz Internal oscillator as many of the arduino functions rely on 16MHz External oscillator?

Hi sir, I have a plan of designing two different boards with Atmega328PB and Atmega2560 IC. So i asked for the arduino function and library support for Atmega2560 with internal oscillator 8Mhz.

All basic Arduino functions should work correctly.

There is no guarantee that libraries will work. If they use the hardware abstraction layer, they should work; if they don't, you might have a problem.

You can easily test compatibility, you don't need a board for that, just a core, libraries of interest and the IDE.

Compile some of the examples that come with the libraries and you will soon know if a library is compatibility.

1 Like

Hi sir, You mean that there is no guarantee that the library will work for Atmega328PB with External Crystal 16Mhz or that there is no guarantee that the Library will work for Atmega328 with Internal Oscillator 8 MHz. Kindly let us know. As i am using SPI library in ATmega328PB, it must work for my application.

I have not seen reports of 8MHz Pro Mini boards with problems; the Pro Mini uses the 328P.

Further I have only been referring to the 328PB in this discussion as that seems to be your interest.

Part of development is prototyping and testing that. So start developing and testing; you don't have to design a PCB yet, you can e.g. buy a Pololu - A-Star 328PB Micro, hook it up to your SPI device and see where it gets you.

1 Like

There is no support

1 Like

There is 3rd party support: GitHub - MCUdude/MegaCore: Arduino hardware package for ATmega64, ATmega128, ATmega165, ATmega169, ATmega325, ATmega329, ATmega640, ATmega645, ATmega649, ATmega1280, ATmega1281, ATmega2560, ATmega2561, ATmega3250, ATmega3290, ATmega6450, ATmega6490, AT90CAN32, AT90CAN64 and AT90CAN128.

1 Like

Hi sir, Change in requirement leads to increase in the Pincount to 34 I/O's. In Atmega328PB, only 27 I/O can be supported including the External crystal Pin. So I have decided to work for Atmega2561 which is 64 pins IC with the 54 I/O Pins. Is this Atmega2561 with External crystal 16Mhz will support for all arduino functions and libraries? Kindly let us know sir.

If you are that worried about library compatibility, why don't you use a ATmega2560 chip at 16MHz and program it as a Mega?

There are other means to extend the number of pins of the 328PB

  1. Shift registers.
  2. I2C/SPI port expanders.
  3. Analogue multiplexers (for reading analogue or digital inputs).

The only thing that is not easily expanded is the PWM outputs.

I think it's time that you give a full description of the project.

1 Like

Hi sir, Thanks for the reply. Here is the Port pin used for my application

PortON Change Interrupt - 4 nos
SPI interface:
Digital Potentiometer1  - 3 Nos
Digital Potentiometer2 (ChipSelect) - 1 Nos
with Same SPI Interface Pin(Sclk and DATA):
DAC1 (Chip Select) - 1 No
DAC2 (Chip Select) - 1 No
DAC3(Chip Select) - 1 No
DAC4 (Chip Select) - 1 No
ADC Pins - 2 Nos
RS-485 Pins - 3 Nos
LED Ouputs - 4 Nos
Dip Switch - 4 Nos
Output pins - 4 Nos
External Crystal for 16 Mhz - 2 Nos

Planned to control the 2 Nos of Digital Potentiometer and 4 Nos of DAC with same SPI Port (SCLK and DATA) with different chip Select pins.

You have 6 CS signals for the SPI bus. A port expander can easily handle that.
You can also put the LEDs, dip switches and output pins on a port expander.

Just be aware of the maximum current that you need on the pins of the port expanders or shift registers; a MCP 23017 can e.g. only source 3 mA on a pin (so LEDs between pin and GND will be tricky) and sink 8 mA (LEDs between Vcc and pin will need a bit of consideration).

You haven't described your project, only given a list of "things" that need to be connected. You have also not answered the question why you don't use an ATmega2560 and get it over and done with.

1 Like

Hi Sir, Thanks for the reply. It is the light sensor application. Digital potentiometers are used for adjusting the gain. And the DAC to adjust the reference voltage to compare. LED outputs and Relay outputs based on the Signal. RS-485 communication to monitor the data into Touchscreen / PC.

You have also not answered the question why you don't use an ATmega2560 and get it over and done with.

I thought of using Atmega2561(64 Pin IC) if the size of Atmega2560(100 pin IC) is large due to space constraint. But both the ICs are in the same size 16.5 x 16.5 mm. So i thought of using the Atmega2560 itself.

Just to be clear, the ATmega328PB and the ATmega2561 are NOT officially supported by the Arduino IDE. You must install 3rd party cores and libraries in order to use those processors with the IDE

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.