ATmega328PB unsupported MCU in ASF 3.27.0 (running Atmel Studio 6.2.1563 Sp2 + part pack for ATmega328PB)

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

Hi all,

 

I have been trying to get an example program running on the ATmega328P Xplained Mini evaluation kit.

I have applied all updates I can find for AS6.2, i.e. Service Pack 2, plus the part pack for ATmega328PB.

 

However, it looks like there is still a problem... I chose an example called "megaAVR led example - ATmega328P Xplained MINI" - note MCU is P, not the PB.

I went to change to the ATmega328PB, but it is not in the list of supported devices. So I selected "All Parts" and the PB appeared - that was the first clue that it may not be fully supported.

 

When I select it, I get a warning that "some of the existing modules may not work", but that's fine, I plan to tinker with the code anyway.

 

But when I build the project, it fails with:

 

avr-gcc.exe(0,0): error: unrecognized argument in option '-mmcu=atmega328pb'

 

Looking deeper I found that a) there is no ATmega328PB.XML file in C:\Program Files (x86)\Atmel\Atmel Studio 6.2\devices

Also, the file ..ASF\common\utils\parts.h does not contain any defines for PB parts

 

Any suggestions?

Thanks in advance!

Garth

 

Last Edited: Fri. Sep 18, 2015 - 04:31 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mine showed up when I installed the part pack (but IIRC, that didn't happen through AS itself...)

 

Atmel Corporation

Atmel Studio

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.

...

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

It shows up in AS6.2 for me too, but avr-gcc.exe doe not accept it as a valid option for -mmcu

 

I assumed that avr-gcc.exe would be updated as part of the part pack, but it appears not to. Is there some other upgrade of the tool chain I am missing?

 

AS reports the following version info:

 

Atmel Studio 6 (Version: 6.2.1563 - Service Pack 2)
© 2014 Atmel Corp.
All rights reserved.

 

...

 

Installed Packages: Atmel AVR (8 bit) GNU Toolchain - 3.4.5.1061

AVR Toolchain 8 Bit
Version: AVR8_Toolchain_Version:3.4.5.1522 GCC_VERSION:4.8.1
Package GUID: 2C7AA7CF-94C6-463C-81DA-4AA03B613C3B
Company: Atmel
HelpUrl: 
Release Description: AVR Toolchain For 8-Bit Devices

 

Installed Packages: Atmel AVR (8 bit) GNU Toolchain Snapshot - 3.4.6.1091
AVR Toolchain 8 Bit
Version: AVR8_Toolchain_Version:3.4.6.1552 GCC_VERSION:4.8.1
Package GUID: 01BAAEB9-EC97-4398-95D1-633DB220CD77
Company: Atmel
HelpUrl: 
Release Description: AVR Toolchain For 8-Bit Devices

 

...

 

Installed Packages: partpack_ATmega328PB - 6.2.9
partpack_ATmega328PB
Version: 6.2
Package GUID: 4d28856e-9778-4530-b4c1-9873701a0450
Company: Atmel
HelpUrl: 
Release Description: Device Support Pack, By installing this device pack you will extend AtmelStudio 6.2 with support for the following devices  ATmega328PB

 

...

Last Edited: Fri. Sep 11, 2015 - 10:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I assumed that avr-gcc.exe would be updated as part of the part pack, but it appears not to. Is there some other upgrade of the tool chain I am missing?

It seems to install a new toolchain in "Atmel Toolchain\AVR8 GCC\Snapshot\3.4.1091\"

It doesn't look like it updates the paths for "Atmel Studio ... Command Prompt"  :-(

 

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

Hi westfw,

 

Thanks for the insight! Yes, you are quite right... I see the "Atmel Toolchain\AVR8 GCC\Snapshot\3.4.1091\" folder, and yet it still seems to be using "Atmel Toolchain\AVR8 GCC\Native\3.4.1061".

 

I tried poking around with registry settings and substituting folders but Atmel Studio doesn't seem to like that.

Hopefully Atmel can provide a patch...

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

See http://www.atmel.com/webdoc/atme...

 

I think you should be able to select 'Snapshot' instead of 'Native' toolchain...

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

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

Hej Morten, mange tak!

 

I have not used that option before, but yes, now that you mention it, it would make sense!

I selected snapshot as you suggested and it no longer complains about the unrecognized mcu.

 

It does however complain about several undefined macros... which traces back to the fact that ATmega328PB is not defined anywhere, so MEGA is not defined as true.

Therefore, ASF\common\utils\interrupt.h fails to compile, with:

 

   error: #error Unsupported device.

 

 

I downloaded the latest standalone ASF, but ATmega328PB is still not defined in parts.h

 

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

I would probably create a support case then. Asf is not my area of expertise...

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

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

BTW, I updated the subject line so that it is clear this issue is more about ASF than the tool chain.

Last Edited: Fri. Sep 18, 2015 - 04:33 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I just posted a support ticket on a similar issue, in my case the part pack would not install...

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

Hmm, that was not an issue for me - that part pack itself installed fine. Hope they can help you.

 

I have a support case ongoing with Atmel regarding the ATmega328PB support (or lack if it):   Case 00024259 - ATmega328PB Xplained Mini unsupported in latest Atmel Studio and Atmel Kits

 

Response has been slow and unhelpful so far. It is somewhat entertaining (at least to me), esp. when they ask me for a link to their own release notes... :S

 

Anyway, I have currently worked around the issue temporarily, by hand tweaking parts.h to define ATMEGA328PB as a MEGA_XX8, and have made sure to select Snapshot toolchain rather than Native (but makefiles are still a problem... the PATH provided by the IDE seems to always point to the Native toolchain, as far as I can tell, despite my efforts to redirect it).

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

Garth,

 

Here's the error in the log:

 

   Install Error : Microsoft.VisualStudio.ExtensionManager.MissingReferencesException: This extension cannot be installed because the following references are missing:
- "Atmel AVR (8 bit) GNU Toolchain Snapshot"

 

However I installed the bundled GNU Toolchain Snapshot toolset just before I attempted to install the pack, so I'm not quite sure what the issue is.

 

Thanks for the response!

 

Randy

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

Garth,

 

Here's the error in the log:

 

   Install Error : Microsoft.VisualStudio.ExtensionManager.MissingReferencesException: This extension cannot be installed because the following references are missing:
- "Atmel AVR (8 bit) GNU Toolchain Snapshot"

 

However I installed the bundled GNU Toolchain Snapshot toolset just before I attempted to install the pack, so I'm not quite sure what the issue is.

 

Here's the observed path, haven't checked registry yet.

 

   C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Snapshot\3.4.1091\avr8-gnu-toolchain

 

Same for you?

 

Thanks for the response!

 

Randy

Last Edited: Tue. Sep 22, 2015 - 07:15 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yeah, that path looks right.

 

I think when I did it, I installed in the following order:

 

1. Atmel Studio 6.2 sp2 (AStudio6_2sp2_1563.exe)

2. AtmelKits (AtmelKits-6.2.371-win32.win32.x86.msi)

3. ASF (as-asf-msi-6.2.1327-win32.win32.x86.msi)

4 partpack toolchain (as-avr8-toolchain-msi-snapshot-trunk-6.2.1091-win32.any.x86.msi)

5 partpack visual studio extension (partpack_ATmega328PB-trunk-6.2.9.vsix)

 

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

Garth,

 

Does the AtmelKit, AtmelKits-6.2.371-win32.win32.x86.msi, install from within the gallery?

 

I'm not seeing that one...

 

AtmelKits-6.2.371-win32.win32.x86.msi ...

 

Selection #4 and #5 I just double clicked to activate and attempt to install...

 

R.

 

Ps. I can see the genesis of my problem is I bought the Xplained mini '328pb, not the earlier '328p, even the latest user guide is 9/2015!

Last Edited: Tue. Sep 22, 2015 - 08:12 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Randy,

 

Yes, Atmel Kits can be updated through the IDE... go to Tools->Extension Manager, choose Sort by Name: Ascending and AtmelKits should be at the bottom of the first page. Version says 6.2.371

You can also get it here:  https://gallery.atmel.com/Produc...?

 

I am using the Amega328PB Xplained MINI as well, and it is working, after several tweaks (like parts.h mentioned above).

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

Well, I got an answer from Atmel Support (pasted below).

 

Apparently there is a bug....(wait for it).... in the RELEASE NOTES!

 

------------------------------------------------------

Hello Garth, 

Sorry for the delayed response. 

The ASF version 3.27.0 doesn't support ATmega328PB xmini board. 

There is a bug in the ASF release notes. 

The ASF support for ATmega328PB will be added in the future release. 

We thank you very nuch for notifying this bug to us. 

If you have any further clarification please come back to us. 

Thanks & regards 

------------------------------------------------------

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

Garth,

 

I too received a response ...

 

"I reproduced this issue on my side and I have escalated this issue to our tool team. Once I get any response, I will update to you immediately."

 

I guess they don't read their own release notes either!?

 

Anyway I probably a good thing to bring it to their attention for correction.

 

Thanks for your valuable time.

 

R.

 

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

The ongoing saga....

 

I am using the ATMEGA328PB in a product now... had 168pb in previous prototype. AS7 / ASF seems to support it mostly, but still not completely. There is a problem using GPIOs on  PORT E.

 

After a lot of searching, I finally discovered the that <ASF>\common\services\ioport\mega\ioport.h declares IOPORT_PORTB, C, and D based on the MCU being a MEGA_XX8 (defined in parts.h).

However, it does not declare IOPORT_PORTE, which is fine for most MEGA chips, but is NOT fine for the 328PB.

 

To verify, I opened an example project for the ATMEGA328PB, MEGA_LED_EXAMPLE. Works fine as written. Change the LED pin to something on PORT E, and it fails.

 

I added my own #define of IOPORT_PORTE and it resolves the error.

Last Edited: Fri. Sep 2, 2016 - 04:27 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Got a response from Atmel:

 

> Hi Garth,
>
> Our internal team confirmed this is a bug in ASF. We need to add define for 328PB. We filed a bug(ASFP-6152).
>
> Our internal team is working on this to fix the issue.
>
> Thanks for reporting to us.

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

Silly question but why on earth would anyone ever need ASF IOPORT for doing IO with a mega AVR? Is the IO in a 328PB especially complicated compared to other mega AVR? 

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

Mainly because we are working on multiple AVR mcu's, and want our code to be portable, so we abstract the hardware if possible. For that reason we often declare pins with:

 

#define DEBUG_LED_RED   IOPORT_CREATE_PIN(PORTD, 5)  // on-board LED for debugging

 

and then use functions like gpio_configure_pin(), gpio_set_pin_high() and gpio_pin_is_high().

Doing it directly with registers means a re-write is required to change from ATmega to Xmega, for example.

 

You've got me curious now how you do it... maybe there is a better way?

 

Thx,

Garth

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

I too have issues with Port E.  Looks like there is a bug or omission in the header file.

 

in parts.h, the 328pb is defined as being part of MEGA_XX8:

/** ATmegaxx8 group */
#define MEGA_XX8 ( \
        AVR8_PART_IS_DEFINED(ATmega48)    || \
        AVR8_PART_IS_DEFINED(ATmega48A)   || \
        AVR8_PART_IS_DEFINED(ATmega48PA)  || \
        AVR8_PART_IS_DEFINED(ATmega48PB)  || \
        AVR8_PART_IS_DEFINED(ATmega88)    || \
        AVR8_PART_IS_DEFINED(ATmega88A)   || \
        AVR8_PART_IS_DEFINED(ATmega88PA)  || \
        AVR8_PART_IS_DEFINED(ATmega88PB)  || \
        AVR8_PART_IS_DEFINED(ATmega168)   || \
        AVR8_PART_IS_DEFINED(ATmega168A)  || \
        AVR8_PART_IS_DEFINED(ATmega168PA) || \
        AVR8_PART_IS_DEFINED(ATmega168PB) || \
        AVR8_PART_IS_DEFINED(ATmega328)   || \
        AVR8_PART_IS_DEFINED(ATmega328P)  || \
        AVR8_PART_IS_DEFINED(ATmega328PB) \
        )

 

but in ioport.h, port E is missing

 

#if MEGA_XX0_1 || MEGA_RF || MEGA_UNSPECIFIED || MEGA_XX8 || MEGA_XX8_A || \
    MEGA_XX4 || MEGA_XX4_A
#define IOPORT_PORTB    1
#define IOPORT_PORTC    2 /* not connected to pins for megaRF*/
#define IOPORT_PORTD    3 
#endif

#if MEGA_XX0_1 || MEGA_RF
#define IOPORT_PORTE    4     <--------------------- no port E for MEGA_XX8 parts..... ?!!?!?!?!
#define IOPORT_PORTF    5
#define IOPORT_PORTG    6
#endif