Close
0%
0%

*uino Mini Super (Atmega328PB)

Next Gen Arduino Mini Pro with Atmega328PB

Similar projects worth following
The Next Generation of the Arduino Pro Mini: Using the brand new Atmega328PB.

Why another Arduino Clone?

Well, there is a simple answer. Interfaces. For our work I developed a Programming and testing machine. These machine uses currently 45 Wattuino's. While using it for programming, I faced to a bigger problem. I am in need of a second hardware serial interface. Because of that reason, I looked for an alternative µC which supports my needs.

Another Problem is the size of the chip itself. Another Chip is probably bigger. In the beginning of wanted to use an Atmega32* µC but the smallest package was even bigger then the Atmega328. But that should not the real big problem.

Luckily I found at the Atmel website the new Atmega328PB.

I even found out, that this chip is available.

So I made new Design which has the same size as the origin and can even replace the origin without getting damaged.


Datasheet:

Atmega328PB Summary

Technical Specs:

  • Same Size as Arduino Pro Mini (18*30mm)
  • Arduino Pin Compatibel
  • 20MHz CPU Frequency
  • 9PWM Channel
  • 2x Hardware Serial
  • 2x SPI
  • 2x I²C (TWI)
  • 8x ADC
  • Filtered ADC Power Supply
  • Capacitive Touch Controller
  • 24 IO
  • 3x 16Bit Timer

Comparison Atmega328 vs. Atmega328PB

http://www.atmel.com/Images/Atmel-42559-Differences-between-ATmega328P-and-ATmega328PB_Application Note_AT15007.pdf

(Thanks to Winston)

Atmega328PBAtmega328
Unique Device ID -
2* Serial Interface
1* Serial Interface
2* SPI1* SPI
2* I²C/TWI1* I²C/TWI
27* Digital IO23* Digital IO
3* 16Bit Timer1* 16Bit Timer
10 PWM Channel (PD2 double used)6 PWM Channel
Clock Failure Detection -
Waveform Generator -
USART Sleep Mode Wake up -

  • Another Atmega328PB Board - The Superstick

    Andre Moehl12/20/2016 at 14:01 3 comments

  • Worlds first Atmega328PB Package for Arduino

    Andre Moehl12/15/2016 at 13:50 0 comments

    Sorry for the long time that i didn't write something here.

    What's new?

    Since a while, Arduino changed the AVR compiler to 4.9.2. With this version it is possible to compile now for the new chip without patching it. I wrote now a package which do exactly this.

    This package contains also the specific Atmel files for this MCU. Because the header file io.h doesn't know about this chip, I used a small hook to get it known. Another hook is to let the linker know about this chip. You can find this in the platform.txt.

    You can install the package just copy this URL into your Arduino IDE:

    https://raw.githubusercontent.com/amoehl/uino-atmega328pb/master/package_atmega328pb_index.json

    Check out my repository:

    https://github.com/amoehl/uino-atmega328pb

  • Bugs

    Andre Moehl03/23/2016 at 22:03 0 comments

    Found a BUG in my SPI Lib. So please don't use. I will upload a new one later. I work currently with this chip at work. I develop a Test- and Programming Station.
    The boards with the 328PB act as slave controller which test and programs the target boards. So they need to talk to a Master and to the Target. Therefore I need two hardware UART. Software Uart is to slow.
    In one test, the target (has a Atmega328P, running at 16 MHz) sends data with 115200 Baud. The function uses Arduino-like Serial.write(...). Weird is, that the 328PB seems to have a problem to receive at full speed. If I slow down by 400us between each write, it's working.

    The Slavecontroller receives at Uart1, which is combined with MISO0 and MOSI0.

    I will see more tomorrow.

    Good Night.

  • *uino Prototypes

    Andre Moehl02/28/2016 at 17:11 0 comments

    I've got some prototypes from a German company: Watterott

    They will be available soon. These boards have the same Pinout like the Arduino.

  • USB Host with Atmega328PB and MAX3421

    Andre Moehl02/28/2016 at 17:05 0 comments

    Project Update:

    I patched the USB Library for the MAX3421E USB Host chip to use SPI1 of the Atmega328pb.

    Yes, it is working now too. Problem is that is now hardcoded. In the Host Library you cannot choose the SPI Port.

  • Easy Way to a Toolchain for the Atmega328PB

    Andre Moehl01/29/2016 at 16:29 0 comments

    After compiling a lot time the avr toolchain by myself, I found an easier solution.

    I tried the gcc version 6.0.0, 4.8.9 and 4.9.2. There is are some problems with the gcc. every time i patched the new device, the gcc doesn't know about the Atmega328pb. It means, the device is never shown in the call:

    $ avr-gcc --target-help

    but I always could compile the for this device, so the gcc itself knew about. I used the information from the Patch, which someone from Atmel send to the gcc-developer. As someone want to know about all the patches, I did, I wrote all down. But just now, I want to describe the easy way.

    Thanks to Atmel, they provide a toolchain for Windows and Linux. Because I am working with Linux, I downloaded the toolchain there:

    http://www.atmel.com/tools/atmelavrtoolchainforlinux.aspx

    This toolchain contains the gcc 4.9.2 with a few patches from the 6.0.0 version. I don't know exactly, which patches, but I analysed their compiling script (http://distribute.atmel.no/tools/opensource/Atmel-AVR-GNU-Toolchain/3.5.0/build-avr8-gnu-toolchain-git.sh).

    But luckily, they have a finished toolchain. But now we need to add the device. These informations are int the AVR device pack: http://www.atmel.com/images/partpack_ATmega328PB-trunk-6.2.9.zip

    But aware, these files are outdated already, there Atmel Studio has newer one.

    In the end, I found 3 different header files. In one file, there were some Register missing.

    Here is the another Pack Link, which is newer:

    http://packs.download.atmel.com/ - Atmel ATmega Series Device Support (1.0.91)

    We need the following files:

    1. libatmega328pb.a
    2. iom328pb.h
    3. crtatmega328pb.o

    Put the lib and the crtatmega328pb.o into "/avr/lib".
    Put the io*.h into "avr/include/avr"

    Done !

    I also patched the "io.h", but this seems not necessary since the header file can build the filename by itself, when it is not found.

    I put everything into Arduino, so I could easy see, if it's working. Because i made my own PCB, I made my own board.txt.

    super.name=Super Mini
    
    super.upload.tool=avrdude
    super.upload.protocol=arduino
    
    super.bootloader.tool=avrdude
    super.bootloader.low_fuses=0xff
    super.bootloader.unlock_bits=0x3F
    super.bootloader.lock_bits=0x0F
    
    super.build.f_cpu=20000000L
    super.build.board=AVR_MINI
    super.build.core=arduino:arduino
    super.build.variant=super
    
    ## Super Mini w/ ATmega328PB
    ## -------------------------
    super.menu.cpu.atmega328=ATmega328pb
    
    super.menu.cpu.atmega328.upload.maximum_size=28672
    super.menu.cpu.atmega328.upload.maximum_data_size=2048
    super.menu.cpu.atmega328.upload.speed=115200
    
    super.menu.cpu.atmega328.bootloader.high_fuses=0xd8
    super.menu.cpu.atmega328.bootloader.extended_fuses=0x05
    super.menu.cpu.atmega328.bootloader.file=optiboot/optiboot_atmega328pb.hex
    
    super.menu.cpu.atmega328.build.mcu=atmega328pb 
    super.build.extra_flags=
    and my own variant "pins_arduino.h". About that, later.

    Finally I need to patch the avrdude.conf:

    Simply add below the Atmega328 Part:

    part parent "m328"
        id			= "m328pb";
        desc		= "ATmega328PB";
        signature		= 0x1e 0x95 0x16;
    
        ocdrev              = 1;
    ;
    

    Later I explain about the bootloader...

  • Testing the PWM

    Andre Moehl01/27/2016 at 08:59 0 comments

    I forgot to set to DC...

  • For the Gallery

    Andre Moehl01/27/2016 at 08:46 1 comment

  • Firmware runs with 20 MHz

    Andre Moehl01/27/2016 at 08:42 0 comments

    I worked a while on the code. This is the result now:

    A short update:

    • Bootloader - OK
    • Every IO Pin - OK
    • Both Serial - OK
    • 9* PWM - OK
    • SPI - SPI0 works, SPI1 TODO
    • I²C/TWI - TWI2 works, TWI0 TODO

    Usable with Arduino 1.6.5 IDE

  • Compiling for Atmega328PB

    Andre Moehl01/24/2016 at 22:18 2 comments

    I will start to describe the problem to compiling software for the Atmega328PB.

    As most people know, the Atmega328P is a very often used and older IC, which is supported by the gcc since a while. This chip is also used on a lot of Arduino Boards.

    Atmel and also Arduino uses the gcc for compiling the sources. If you use the latest Atmel Studio under Windows you can compile a firmware for that chip.

    IMHO: I don't recommend the Atmel Studio 7 as development tool. 
    It is very, very slow and has a very weird menu structure. 
    Completely unusable.

    October 2015 Atmel send a patch to gcc which should add the support of these IC ( and some other more). But the problem is, it is a patch for the gcc 6.0.0 (gcc patch). Arduino itself uses the gcc 4.8.1, even in the latest IDE version 1.6.7.

    So what I did till now:

    I look deeper and found a Atmel Website with a Atmel Pack, which contains even the Atmega328PB xml file, the header and some other stuff.

    I even found the Atmel Toolchain script. But also there is a helpful information, how to build the avr toolchain at the avrlibc website.

    Later I will describe the toolchain build, why the Atmel script doesn't work for me and how I found a way to use Arduino.


View all 10 project logs

Enjoy this project?

Share

Discussions

EngineerAllen wrote 07/24/2017 at 18:42 point

i might have to make one of these..

what crystal did you use for 20mhz

and did you have problems with arduino bootloader burning since you use 20mhz

  Are you sure? yes | no

Johan Winäs wrote 02/04/2017 at 12:52 point

Noticed that the TX1/RX1 pins on the 328PB are shared by the MISO/MOSI pins used for ISP.
How about an option to change the bootloader to use TX1/RX1 instead of TX0/RX0?
This way a simple board can have the normal 6pin ISP header where we can program the initial bootloader and then use this for future updates as well as having a debug port.
All while leaving the usart0 free for normal use. Any exiting project can then move to the 328PB version and gain a dedicated firmware upload and debug port.

My sw knowledge is a bit shallow for this, I'm more hardware design..

  Are you sure? yes | no

Sandeep Patil wrote 05/03/2016 at 07:08 point

I was porting the code to our Atmega328pb board named Tit; noticed that the additional PWM output pins 0, 1 and 2 do not work..
The fix is simple, as you may already know it :), is to define relevant timers on pins_arduino.h file.
#if defined(AVR_ATmega328PB)
TIMER3A,
TIMER4A,
TIMER4B,
#else
NOT_ON_TIMER, /* 0 - port D */
NOT_ON_TIMER,

NOT_ON_TIMER,

// on the ATmega168, digital pin 3 has hardware pwm
#endif
Will send a pull request once all the testing is done.

  Are you sure? yes | no

Sandeep Patil wrote 04/02/2016 at 06:25 point

Should a pro-mini style breakout board for this help? We got samples for this chip few days back and initial tests are encouraging enough to make such a board. We have designed a pro-mini compatible board, sending off to make a few prototypes. Do message me if anyone is interested in the prototype, can ship a few for testing.   This is a good idea, thanks for the project and inspiration. We will as-well create a repo and post the kicad design files etc soon. . . 

  Are you sure? yes | no

Guglielmo Braguglia wrote 03/25/2016 at 21:46 point

Here you have working SPI and working Wire (I hope ... please test and post results) ... https://github.com/watterott/ATmega328PB-Testing

  Are you sure? yes | no

Paolo Paolucci wrote 03/04/2016 at 10:44 point

This is a new version of Wire library (https://forum.arduino.cc/index.php?topic=374642.msg2645753#msg2645753) but don't work :-(

Can you check the code?

For the code I took inspiration from HardwareSerial.h and DallasTemeprature.h/OneWire.h.

  Are you sure? yes | no

Andre Moehl wrote 03/08/2016 at 21:54 point

I will try to check this tomorrow. Thanks a lot for the work.

  Are you sure? yes | no

Andre Moehl wrote 01/27/2016 at 11:43 point

Thanks Winston. I added some Information to details.

  Are you sure? yes | no

Winston wrote 01/26/2016 at 15:45 point

This might be a good link to add to your "Details" section:

AT15007: Differences between ATmega328/P and ATmega328PB

http://www.atmel.com/Images/Atmel-42559-Differences-between-ATmega328P-and-ATmega328PB_Application Note_AT15007.pdf

  Are you sure? yes | no

davedarko wrote 01/26/2016 at 17:41 point

thanks for sharing this!

  Are you sure? yes | no

Alex wrote 01/25/2016 at 15:53 point

Oh this 328PB is quite interesting. Atmel did add everything I did missed on the 328p some times. Specially a second Uart, i2c and SPI bus is a good thing. I am now thinkin to mkae some Arduino Nano like board with this MCU mh.....

  Are you sure? yes | no

Andre Moehl wrote 01/25/2016 at 11:54 point

About the 10th PWM: PD2 is doubled used for that Output.

  Are you sure? yes | no

davedarko wrote 01/25/2016 at 10:23 point

Datasheet says 10 PWM channels, btw.

  Are you sure? yes | no

davedarko wrote 01/25/2016 at 09:02 point

Interesting! It would be awesome of you if you could make a little comparing table of the atmega328p vs. the atmega328pb. I checked the datasheets last night in bed, but only saw the three 16bit timers instead of the two 16bit plus one 10bit timers. Looking forward to read the updates! Any plans on adding silkscreen labels to the board or are they "in but not on" because of the production costs of prototypes or something? 

It's a bit too easy to overlook this project when it looks like another mini clone, but the actual message is more 'B as in better'.

  Are you sure? yes | no

jaromir.sukuba wrote 01/25/2016 at 09:28 point

Second USART is perhaps the most useful addition. As well as second SPI and IIC (TWI actually).

  Are you sure? yes | no

davedarko wrote 01/25/2016 at 10:28 point

I've seen some projects that only use an arduino mega because of a second serial connection (when software serial isn't enough or not known) - this could easily replace some. But then again there's no easy arduino support yet... 

  Are you sure? yes | no

Andre Moehl wrote 01/25/2016 at 11:57 point

Hi, This is a prototype, for that reason, no silkscreen. If this PCB is working, we plan to make a few, cause we need. Not sure how we make them public later. 

  Are you sure? yes | no

davedarko wrote 01/25/2016 at 12:12 point

thought so, thanks :)

  Are you sure? yes | no

drojf wrote 04/06/2017 at 00:53 point

I'm a bit late to the party, but Atmel has an official document comparing the 328P and 328PB:

http://www.atmel.com/Images/Atmel-42559-Differences-between-ATmega328P-and-ATmega328PB_ApplicationNote_AT15007.pdf

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates