Upgrade to ATMega328pb


  • Mod

    Hey there!
    After reading this topic, I recently ordered an ATMega328pb, the successor of the ATMega328p.
    We all know the ATMega328p which is used on e.g. Arduino UNO & Pro-Mini boards.
    An extensive overview of all differences can be read here.
    In short, the new ATMega328pb has a lot of new features, it's footprint is nearly identical to the ATMega328p and it is binary compatible with its predecessor.
    This means you can download a regular ATMega328p binary to it and it will just run!

    As the proof is in the pudding, a single TQFP PB was ordered and it arrived safely at my desk.
    I took a 5V/16MHz Pro-Mini from China, and removed the ATMega328p using hot-air:

    0_1464369529883_2016-05-27 14.48.54.jpg

    As said, the footprint is nearly identical, except for power pins 3 & 6, which are used as IO pins on the PB. I don't feel happy feeding 5V into a pin configured as output, so I decided to simply remove pads 3 & 6 from the PCB (inside the red cicle).
    I soldered the new PB in place (not cleaned yet, and a bit misaligned 😉 😞

    0_1464369790835_2016-05-27 14.56.45.jpg

    Took out the JTAGICE3 ISP programmer, and it was recognized with the PB device signature 0x1E9516!

    Now there are two ways to go:

    1. Program a 'regular' ATMega328p Arduino bootloader (e.g. optiboot) and use the device from the Arduino IDE as a regular ATMega328P (UNO/Pro Mini/...)
    2. Program a specific ATMega328pb Arduino bootloader (e.g. modified optiboot) and use the device from the Arduino IDE as ATMega328PB (no Arduino boards yet -- but I think I just created one)

    Thanks to the guys at Watterott the optiboot bootloader for both configurations can be downloaded from here.
    They also created a board package for the PB version.
    Update Apparently Elektor also did their own board support and peripheral implementation (of course not compatible with Watterott...). More info can be found here.

    Following steps describe how to get things going (for now, May 27, 2016 as stuff probably develops rapidly), with Arduino IDE 1.6.9, on Windows:

    Use as 'regular' ATMega328p

    • Program the ATMega328p optiboot bootloader ('optiboot_m328p.hex') using ISP.
    • Set fuses to: Extended 0xF5, High 0xDA, Low 0xFF (for 16Mhz external crystal/resonator!)
    • Now the chip can be programmed from the Arduino IDE as if it were a regular ATMega328p based board!

    Use as ATMega328pb

    • Program the ATMega328pb optiboot bootloader ('optiboot_m328pb.hex') using ISP.
    • Set fuses to: Extended 0xF5, High 0xDA, Low 0xFF (for 16Mhz external crystal/resonator!)
    • Install the Watterott board location into the IDE (Preferences -> Additional board manager URLs. Add https://github.com/watterott/ATmega328PB-Testing/raw/master/package_m328pb_index.json)
    • Install Board support for ATmega328PB Boards (currently at revision 1.0.1)
    • Restart the IDE
    • Select e.g. the blink sketch, select Board 'Atmel ATmega328PB Crystal Clock', 16MHz
    • and upload the sketch!

    Support for all the extra peripherals in the PB is still ongoing. I expect it to get really up to speed the moment Arduino releases a PB based board. Watterott is already selling PB boards, as is Elektor, and probably others.

    Have fun!


  • Contest Winner

    Cool stuff! I see one thing in particular; 9 byte unique serial. If you like, feel free to add to the software signing backend and the securitypersonalizer a way to use this as serial for whitelisting 🙂


  • Mod

    @Anticimex this feature also caught my eye. Up next is gaining control over these new features 😎


  • Contest Winner

    @Yveaux Runtime detection can make it even simpler to use for the security 🙂 but might be confusing if someone wants to use soft signing and set a soft serial 😛


  • Mod

    @Anticimex quick experiment:

    #define DEVID0 _SFR_IO8(0xF0)
    #define DEVID1 _SFR_IO8(0xF1)
    #define DEVID2 _SFR_IO8(0xF2)
    #define DEVID3 _SFR_IO8(0xF3)
    #define DEVID4 _SFR_IO8(0xF4)
    #define DEVID5 _SFR_IO8(0xF5)
    #define DEVID6 _SFR_IO8(0xF6)
    #define DEVID7 _SFR_IO8(0xF7)
    #define DEVID8 _SFR_IO8(0xF8)
    
    void setup()
    {
      Serial.begin(115200);
      Serial.print(DEVID0, HEX); Serial.print(" ");
      Serial.print(DEVID1, HEX); Serial.print(" ");
      Serial.print(DEVID2, HEX); Serial.print(" ");
      Serial.print(DEVID3, HEX); Serial.print(" ");
      Serial.print(DEVID4, HEX); Serial.print(" ");
      Serial.print(DEVID5, HEX); Serial.print(" ");
      Serial.print(DEVID6, HEX); Serial.print(" ");
      Serial.print(DEVID7, HEX); Serial.print(" ");
      Serial.print(DEVID8, HEX); Serial.print(" ");
      Serial.println("");
    }
    
    void loop() {
    }
    

    Result:

    81 1 D A 0 6E 61 6E 0 
    

    Now I need another PB to see if it is different 😉


  • Contest Winner

    @Yveaux yeah, would be pretty embarrassing for Atmel if they turn out to be identical 🙂


  • Hero Member

    Great OP. Any updates?

    I'm frankly surprised that neither sparkfun nor adafruit nor arduino have come out with a board for it. What gives?


  • Banned

    This post is deleted!

Log in to reply
 

Suggested Topics

  • 87
  • 2
  • 8
  • 3
  • 1
  • 9

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts