bugAVR C Runtime Library - Bugs: bug #47937, Incorrect "0" suffix in...


You are not allowed to post comments on this tracker with your current authentication level.

bug #47937: Incorrect "0" suffix in names of SPI registers and bits for ATmega324PA and ATmega164PA

Submitter:  David Grayson <davidegrayson>
Submitted:  Mon 16 May 2016 09:59:03 PM UTC
Category:  Header Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Header files
Status:  Confirmed Percent Complete:  0%
Assigned to:  None Open/Closed:  Open
Release:  2.0.0 Fixed Release:  None

( Jump to the original submission )

Mon 28 Aug 2017 08:22:07 PM UTC, comment #7: 

Atmel has updated the ATmega324PA datasheet.  It now uses names like &quot;SPCR0&quot; in the tables that define the registers, but they still have plenty of example code and wording in paragraphs that refer to &quot;SPCR&quot;.

The ATmega164PA datasheet still does not use the name &quot;SPCR0&quot;, so users of that chip will have trouble due to the missing register names in avr-libc.

I submitted this patch 15 months ago and I thought it would be pretty straightforward.  Are there any issues with it?

David Grayson <davidegrayson>
Mon 10 Oct 2016 10:12:58 PM UTC, comment #6: 

Hey, it looks like my patch has not been applied to avr-libc.  This is just a reminder to do that.

David Grayson <davidegrayson>
Mon 23 May 2016 09:30:48 PM UTC, comment #5: 

An Atmel tech support representative has told me that he will file a bug report, but did not give any other useful information.

David Grayson <davidegrayson>
Wed 18 May 2016 06:31:59 AM UTC, comment #4: 

OK, great if your patch maintains both names.  I'll apply
it shortly then.

Quite possible Atmel tried to maintain some "forward
consistency" (they did it in other situations that way in
the past, e.g. USART bit names), but the datasheet and XML
description ought to match, no matter what.

Joerg Wunsch <joerg_wunsch>
Project Administrator
Wed 18 May 2016 02:05:00 AM UTC, comment #3: 

While I was researching my bug report to Atmel, I noticed a new part definition file in Atmel Studio 7.0.934: the ATmega324PB.  This part will have two SPI modules, so it makes sense that all of its SPI registers and bits are suffixed with 0 and 1.  I suspect that Atmel is purposely renaming the SPI registers on the old parts for consistency's sake.  They renamed the SPI registers for the ATmega164{A,P,PA} and ATmega324{A,P,PA}, but they have not yet done it for the ATmega644* or ATmega1284*.

I will still contact them anyway, because I noticed an inconsistency: in ATmega164A.atdf they defined a bit to be named SPR01 when they really meant SPR10.  That's definitely an error, but in general their adding of these prefixes might not be an error.

David Grayson <davidegrayson>
Wed 18 May 2016 01:37:13 AM UTC, comment #2: 

Hello, Joerg.  I have seen your name a lot over the years during my AVR-related work, so it is nice to hear from you.

Yes, the datasheets look inconsistent, and the XML files in C:\Program Files (x86)\Atmel\Studio\7.0\packs\atmel\ATmega_DFP\1.0.98\atdf seem to be incorrect.  I plan to write to Atmel support.

As you said, we should supply both definitions.  That's what my patch does; it only adds definitions and does not remove any.


David Grayson <davidegrayson>
Tue 17 May 2016 06:35:16 AM UTC, comment #1: 

Actuall, the datasheet is inconsistent on this: in the register
summary at the end, the bits do have the 0 suffix, while the
description omits them.

Likewise, the Atmel Studio XML files (where our header files
have been derived from) also uses the 0 suffix.

So please file a bug report with Atmel so they get all their
documentation and description files consistent.

Due to the inconsistencies, I think the way for us to fix it
is by supplying both definitions.

Joerg Wunsch <joerg_wunsch>
Project Administrator
Mon 16 May 2016 09:59:03 PM UTC, original submission:  

The attached patch fixes the names that avr-libc defines for several SPI-related registers in iom324pa.h and iom164pa.h.  The datasheets call the registers SPCR, SPSR, and SPDR, but avr-libcs's definitions had "0" at the end of the name: SPCR0, SPSR0, and SPDR0.  The names of bits defined in these registers were wrong in the same way.  This patch adds new definitions with the correct names, while leaving the old definitions around for backwards compatibility.

Please apply the patch.  Thanks!

David Grayson <davidegrayson>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #37181:  spi_fix_m164pa_m324pa.patch added by davidegrayson (1KiB - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by joerg_wunsch (Posted a comment)
  • -email is unavailable- added by davidegrayson (Submitted the item)



    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-05-18 joerg_wunsch StatusNone Confirmed
    2016-05-16 davidegrayson Attached File- Added spi_fix_m164pa_m324pa.patch, #37181

    Back to the top

    Powered by Savane 3.9