Go Down

Topic: ATmega328PB with Arduino (Read 17291 times) previous topic - next topic

jopiek

I can't seem to find the term ATmega328PB anywhere here, but are there people who have used the ATmega328PB and programmed it using the Arduino IDE / toolkit?

The ATmega328PB has in interesting feature that I am interested in: a second twi port. Other chips also offer that but I like the fact that it is basically an ATmega328 chip so I know the chip quite well already.

DrAzzy

ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

jopiek

Well at least I ordered some samples from Atmel and there is a prototyping version with Arduino shield pin compatibility available!

DrAzzy

Nice!

Uh... what was that about a second TWI? It looks like it just has the one...
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

jopiek

http://www.atmel.com/devices/ATMEGA328PB.aspx?tab=parameters

SPI:2
TWI(I2C): 2
UART: 2
...

DrAzzy

Yet the datasheet says... nothing about a second UART, SPI, or TWI interface....
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

dmjlambert


DrAzzy

Hmm, okay - yeah, some parts of the datasheet list it, others don't...

The pin diagram doesn't, the chart does, the SPI description mentions two SPI's, but the TWI and serial sections don't, and the register descriptions don't list the register names.
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

westfw

Quote
the datasheet says... nothing about a second UART, SPI, or TWI interface.
It mentions them in the "features" section, in table 6-1 "Port Function Multiplexing", and section 15.11 "Power Reduction Register", but not in the individual TWI/USART sections, and the control registers do not appear in the "register summary"...   There is no "iom328pb.h" file in the latest Atmel Toolchain that defines anything specific to the PB chip, and it does not appear as a selectable device in the current version of Atmel Studio.
The ATmega168PB, announced at a similar time (Nov, 2014) but more available, does not list extra serial controllers.

Disappointing.

None of the usual distributers have the chips (although several have the Xplained mini eval board.)  This is more typical of Atmel; being very slow to ship announced parts.  Usually their documentation is in better shape during the "I want that and I can't get it yet" phase.  :-(


westfw

Aha.   There is:

Quote
http://www.atmel.com/tools/atmelstudio.aspx?tab=overview
...
ATmega328PB Part Pack for Atmel Studio 6.2
 (37.9 MB, updated July 2015)
 This bundle adds support for ATmega328PB device in Atmel Studio 6.2.SP2. Please see attached word file for more details.
Which installs an iom328pb.h, which contains:
Code: [Select]
#define UCSR1A _SFR_MEM8(0xC8)
 :
#define TWBR1   _SFR_MEM8(0xD8)

And related code defining the second UART and TWI interface, and etc.  So I guess they're real.
(A bit messy.  TWBR0 and TWBR1 used to be bits in the TWBR register (which was stupid, anyway.)   Now they're the bitrate registers for the two TWI peripherals...)  (similarly for the other TWI registers, I guess.)  (This probably means that adding support for the 2nd TWI interface is not going to be very easy; the existing code all assumes a single TWI interface with fixed TWBR/TWSR/etc registers.)


jopiek

#10
Aug 27, 2015, 02:28 pm Last Edit: Aug 27, 2015, 02:31 pm by jopiek
In http://www.atmel.com/Images/Atmel-42397-8-bit-AVR-Microcontroller-ATmega328PB_Datasheet.pdf the 6. I/O Multiplexing shows:

TW0-SDA on pin 27
TW0-SCL on pin 28
TW1-SDA on pin 3
TW1-SCL on pin 6

So I don't understand DrAzzy why you can't find it, it is just a matter of reading it carefully isn't it?! That those are not listed in the initial pin mappings is understandable since they are already showing too many features per pin.

@westfw: thanks for the insight. I ordered some of those evaluation boards, so will try it when I have them. I think this chip will be great for a lot of applications that require to make modular units in one's system (like my applications do).

DrAzzy

#11
Aug 27, 2015, 06:15 pm Last Edit: Aug 27, 2015, 06:19 pm by DrAzzy
So I don't understand DrAzzy why you can't find it, it is just a matter of reading it carefully isn't it?!
Yes, I'm sorry that I missed that. I guess I just didn't read carefully enough. I can find it now, obviously.
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

westfw

There's a new datasheet out that seems to include the "missing" definitions in the register summary:
http://www.atmel.com/Images/Atmel-42397-8-bit-AVR-Microcontroller-ATmega328PB_Datasheet.pdf

retrolefty

Pluses: More serial/TWI ports, more timer ports.

Minus: 
On first review of this new 'B' version, seems to not be available in DIP layout? That kind of sucks for some of us hobbyist types.


westfw

Quote
seems to not be available in DIP layout?
That appears to be the case :-(
(It would have been SO nice to drop a DIP into an existing Uno/etc and get that extra serial port!)

Go Up