Errata

AVR Programming

Errata for AVR Programming

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Printed
Page XIV
7th Paragraph

* An ATMega 168 ...
"The AVR Family of Controllers" on page 11

Should be page 12.

Anonymous  Mar 28, 2014  Mar 03, 2015
Printed, PDF
Page 3
5th paragraph

Please change "gigabyte" to "gigabit"

Brian Jepson
Brian Jepson
 
Apr 01, 2014 
Printed, PDF
Page 9
2nd paragraph under "Inputs"

The description in the paragraph beginning with "Hook up a button" and ending with "closer to zero volts or VCC." needs correction. Please replace this paragraph with:

Hook up a button to the supply voltage through a resistor on one side, and connect this junction to one of the AVR's pins that's configured for input. Connect the other side of the button to ground. When the button isn't pressed, the AVR will read the +VCC+ voltage, but when you do press the button the AVR's input pin will be grounded. Thus, by reading in the voltage on the pin, the AVR is able to detect whether or not you've pressed the button. Physical states are turned into voltage levels, which are in turn converted to logic values inside the chip.

Brian Jepson
Brian Jepson
 
Feb 03, 2014  Feb 14, 2014
Printed, PDF
Page 10
4th paragram

Please change "previous examples" to "following examples"

Brian Jepson
Brian Jepson
 
Apr 01, 2014 
Printed, PDF
Page 10
paragraph 1

Please change "USART serial in Chapter 5" to "USART serial, described in Chapter 5"

Note from the Author or Editor:
Change is fine by me, but occurs on the bottom of page 9 in my printed copy of the book.

Philipp Marek  Apr 02, 2014 
Printed, PDF
Page 18
First paragraph under Linux setup

Aptitude is not installed by default on Ubuntu. Suggest using apt-get instead or directing readers to install aptitude.

Note from the Author or Editor:
Change first literal command line to begin with
"sudo apt-get install ..."

Brian Jepson
Brian Jepson
 
Apr 01, 2014 
PDF
Page 26
1st paragraph under "Flashing AVR chips using the Arduino as a programmer"

The third word of the second sentence should be "instructions" rather than "instruction."

Bogdan Barbu  Feb 27, 2014 
Printed
Page 26
Figure 2-3 and corresponding/following text

Accroding to the datasheet of the ATmega48..328 the analog supply voltage connection AVcc also supplies the digital functions of the lower 4 bits of Port C. Therefore it is recommended to always connect both Vcc and AVcc. Also both GND pins should be connected to share the return current.

Note from the Author or Editor:
This will require a sidebar, written from scratch, to explain.
Added in Atlas

Uwe Zimmermann  May 25, 2014  Mar 03, 2015
Printed, PDF
Page 29
1st paragraph under "Getting Started: Blinking LEDs"

Please change "possbile" to "possible"

Note from the Author or Editor:
this is the last occurrence of the word "possible" in the paragraph

Brian Jepson
Brian Jepson
 
Apr 01, 2014 
Printed, PDF
Page 34
Bullet item #2

Please change "nonself" to "non self" or "non-self"

Note from the Author or Editor:
2nd sentence should end "non-self-powered flash programmers."

Brian Jepson
Brian Jepson
 
Apr 01, 2014 
Printed, PDF
Page 39
Paragraph under F_CPU

Please change "1,000,000" to "1000000" and set as constant width.
Please change "8,000,000" to "8000000" and set as constant width.

Note from the Author or Editor:
Should read
"1000000" and "8000000" respectively, and be set in code font / monospace.

Brian Jepson
Brian Jepson
 
Apr 01, 2014 
Printed, PDF
Page 40
First paragraph under Troubleshooting

Suggest introducing a resistor where you instruct the reader to connect an LED across the AVR power pins, as it may blow the LED.

Note from the Author or Editor:
Change last sentence of first para in Troubleshooting to

A quick way to double-check is to put an LED with a series resistor across the AVR power pins, where you've got a capacitor.

Brian Jepson
Brian Jepson
 
Apr 01, 2014 
Printed
Page 45
Example 3-1

The code in the example has

DDRB |= (1 << PB0)

However, at this stage of the book, that's still potentially "magic" to the reader. In the text (e.g., page 41 first and third paragraphs) you talk about writing DDRB = 0b00000001. I suggest you make the code in the example match the exposition.

Note from the Author or Editor:
Change
DDRB |= (1 << PB0)
to DDRB = 0b00000001
in example 3-1 code

Andy Dalton  Mar 22, 2014 
Printed, PDF
Page 45
Example 3-1

The code listing seems to be older than text:

"DDRB |=" is wrong, text on p46 says "DDRB = ..." (which is better)

In pseudocode, "[event loop]" appears outside of while. The while is the event loop, though. Probably OK to remove it, or replace "while(1)" with [event loop].

Note from the Author or Editor:
Two issues here:

the DDRB bit is a duplicate of an errata I've already filed

In the pseudocode block in "The Structure of AVR C Code":
delete the line "[event loop]"
and change the line
"while(1){" to "while (1){ [event loop]"

Brian Jepson
Brian Jepson
 
Apr 01, 2014 
Printed, PDF
Page 49
first paragraph under blinkLED Summary

Suggest removing < and > from filenames here because they are not part of the filenames.

Note from the Author or Editor:
change "<avr/io.h>" to "avr/io.h" still formatted in filename font
change "<util/delay.h>" to "util/delay.h" still formatted in filename font

Brian Jepson
Brian Jepson
 
Apr 01, 2014 
Printed
Page 60
Example 4-1

In the listing, the local variable i is used before it is initialized. Maybe the AVR initializes the stack to 0 before running the program (guessing here?), but I would still explicitly initialize it to 0.

Note from the Author or Editor:
change line in example 4-1
just after // -------------- Inits -------------------- //
to:

uint8_t i =0;

Andy Dalton  Mar 18, 2014 
Printed
Page 61
First paragraph

Text references "C Asides: #defines" on page 61, but the aside is on page 62.

Note from the Author or Editor:
Change page reference from 61 to 62.

Andy Dalton  Mar 18, 2014  Mar 03, 2015
Printed
Page 62
First paragraph not in the aside

Text references "Bits, Numbering, and Significance" on page 62, but it should be page 63.

Note from the Author or Editor:
change page number reference from 62 to 63.

Andy Dalton  Mar 18, 2014  Mar 03, 2015
Printed, PDF
Page 62
top of second column in C Asides: #defines

Regarding "reminds you that they�re constants.", #defines are not constants. They often _evaluate_ to constants, but they *are* just textual replacements.

Note from the Author or Editor:
end of 3rd para

change "remind you that they're constants." to "remind you that they're not normal variables."

Brian Jepson
Brian Jepson
 
Apr 01, 2014 
Printed, PDF
Page 67
First paragraph

Please change:

read and write from and to

to:

read from and write to

Brian Jepson
Brian Jepson
 
Apr 01, 2014 
Printed, PDF
Page 68
Last two lines of Example 4-2

Please line up the two instances of |

Brian Jepson
Brian Jepson
 
Apr 01, 2014 
PDF, ePub
Page 69
example 4-3

In Example 4-3. "Using XOR to toggle a bit" there are two lines using the bitwise OR operator that should be using the XOR operator. The two lines are:
| = 0b11000111 // LED2 bit flipped on

and

| = 0b11000011 // LED2 bit flipped off

they should be:

^ = 0b11000111 // LED2 bit flipped on

and

^ = 0b11000011 // LED2 bit flipped off

Thomas Weisbach  Feb 11, 2014 
Printed, PDF
Page 74
Bit Twiddling sidebar

The "#define BV(bit)" should have "(1 << (bit))". The "()" around "bit" is missing.

Note from the Author or Editor:
Change to
#define BV(bit) (1 << (bit))


That's a good catch. In some circumstances, the difference could matter. Although I'm usually invoking such macro functions with "PB0" rather than with a complicated expression that could cause order-of-operations issues. Still, better safe than sorry.

Brian Jepson
Brian Jepson
 
Apr 01, 2014 
Printed
Page 75
second line of Summary

Sentence should start with "In the last chapter..." instead of "Last chapter..."

Note from the Author or Editor:
Fixed in Atlas

Andrea Lini  Jun 20, 2014 
PDF, ePub
Page 87
#2 of section "Troubleshooting Serial Connections"

This section suggests using 'lsusb' on Mac, but 'lsusb' is not a standard Mac utility. However, a version is available here: https://github.com/jlhonora/lsusb

Note from the Author or Editor:
That's right.

For point #2 on p. 87, add (A Mac version of lsusb is at https://github.com/jlhonora/lsusb.)

Thomas Weisbach  Feb 23, 2014 
PDF, ePub
Page 92
last paragraph

"Similarly, there is a receive complete bit (RXC0) in the status register UCSR0A that lets you know when a byte has received" should read "when a byte has been received".

Note from the Author or Editor:
Hyphenation will sort this out.

Change to "Similarly, there is a receive-complete bit ..." and add "been" before "received"

Thomas Weisbach  Feb 23, 2014 
Printed
Page 98
First line under figure 5-9

Please change "computer montior" to "computer monitor"

Note from the Author or Editor:
fixed in atlas

Andrea Lini  Jun 20, 2014 
Printed
Page 116
1st paragraph of text, error in line of code

(BUTTON_IN, BUTTON)

should read

(BUTTON_PIN, BUTTON)

Andrea Lini  Jun 24, 2014 
PDF, ePub
Page 124
last sentence of first paragraph

Last part of the sentence is "so the AVR basically unburdened" should be "so the AVR is basically unburdened".

Note from the Author or Editor:
Exactly as described.

Last part of the sentence is "so the AVR basically unburdened" should be "so the AVR is basically unburdened".

Thomas Weisbach  Feb 25, 2014 
PDF
Page 132
5th paragraph

"Capacitors block DC current entirely, but
let higher and higher frequency AC current through
with less and less resistance."

DC means direct current and AC means alternating current so the usage of DC current or AC current would be a redundance of the word "current". This could appear throughout the book but this reader only noticed in this paragraph.

Note from the Author or Editor:
fixed in atlas

Anonymous  Jun 07, 2014  Mar 03, 2015
PDF, ePub
Page 136
last paragraph

The last paragraph reads: "Next, we want to send the value over the serial port to our computer. To make things easy, we convert the 10-bit number into a single 8-bit byte so that it�s easier to send over serial. A two-bit right-shift converts it down."

However, this refers to functionality that is not in the code in example 7-1, but to the later example 7-2 code.

Note from the Author or Editor:
He's right.

That entire final paragraph at the bottom of the page, beginning with "Next, we want to send the value over the serial port..." refers to an older version of the demo code.

If it's not too disruptive, strike the entire paragraph.

Thomas Weisbach  Feb 28, 2014 
Printed
Page 139
1st item on the list under ADC Gotchas

"1. Did you hook up AVCC? The ADC needs power, and it needs to be within around 0.6 V of the AVR’s VCC."

The datasheet for the Atmega168 says that AVCC must not differ more than ±0.3V from VCC...so I guess 0.6V is a little too much.

Note from the Author or Editor:
CORRECTED IN ATLAS

p.139 1st item on the list under ADC Gotchas

change to
"1. Did you hook up AVCC? The ADC needs power, and it needs to be within around +/- 0.3 V of the AVR’s VCC."

Jan Ray  Oct 16, 2014  Mar 03, 2015
Printed
Page 153
2nd paragraph

In the sentence "So we�ll expand on that and build a capacitative touch sensor."

should change "capacitative" to "capacitive".

Jiang  Apr 05, 2014 
Printed
Page 157
helloInterrupt.c listing

I believe there is a mistake in the ISR macro. The line:

if (bit_is_set(BUTTON_PIN, BUTTON)) {

should read

if (bit_is_clear(BUTTON_PIN, BUTTON)) {

for LED1 to turn ON and OFF when the button is pressed.

Note from the Author or Editor:
fixed in atlas, git repo

Andrea Lini  Jul 05, 2014  Mar 03, 2015
Printed
Page 158
4th paragraph

This is very minor. The fourth paragraph makes references to "For the nitty-gritty on interrupts, see "Interrupts: Under the Hood" on page 158." but the "Interrupts: Under the Hood" reference is actually at the top of pate 159.

Note from the Author or Editor:
Change 158 to 159 (or whatever it ends up being in revision)

Anonymous  Mar 04, 2014  Mar 03, 2015
Printed
Page 158
4th paragraph, 3rd line

Wrong page reference: replace 158 with 159

Andrea Lini  Jul 05, 2014  Mar 03, 2015
Printed
Page 163
First Paragraph

Just below "Figure 8-1" the first paragraph includes a "For Instance" which states:

PCMSK2 | = ( ( 1 << PCINT18 ) | ( 1 << PCINT18 ) ) ;

// NOTE That the PCINT18 is used twice.

And following that the book makes references to the normal pin references:

PCMSK2 | = ( ( 1 << PD2 ) | ( 1 << PD4 ) ) ;

I believe that the PCINTXX values should read instead (see below) PCINT18 and PCINT20 to match the PD2 and PD4 pin references like this:

PCMSK2 | = ( ( 1 << PCINT18 ) | ( 1 << PCINT20 ) ) ;

Note from the Author or Editor:
Change the second occurrence of (1<<PCINT18) to (1<<PCINT20) as suggested.

Anonymous  Mar 04, 2014 
Printed
Page 172
3rd paragraph, line 1

Extra word in sentence:

"What about our the AVR's special memory registers [...]"

Should read

"What about the AVR's special memory registers [...]"

Andrea Lini  Jul 06, 2014 
PDF, ePub
Page 196
paragraph before "Summary"

"Transmitter" is misspelled "tranmitter".

Thomas Weisbach  Feb 06, 2014  Feb 14, 2014
PDF, ePub
Page 259
5th paragraph, section titled "Exponentially Weighted Moving Averages"

Very minor issue: 'the' occurs twice in the sentence "feel free to skip on down to the �The Code� on page 262".

Thomas Weisbach  Apr 02, 2014 
Printed
Page 354
last sentence

"...I'm running the SPI bus at a 1/16th multiplier, or 500 kHz."

It wasn't clear to me from the code in example 16-3 that the system clock on the atmega168 would be running at 8MHz without reseting the default clock of 1MHz. So 1/16th multiplier of 1MHz would be 65.2 kHz. Actually, I think the example code sets SPR1 in SPCR which from the data sheet means a divisor of 64.

Totally not a big deal. I'm sure the code runs fine because the 25LC256 has a max of 10MHz slave clock speed.

Note from the Author or Editor:
Two changes need to be made two the last paragraph on page 354.

In the second sentence, 8MHz should read 1MHz

In the next-to-last sentence, "running the SPI bus at 1/16th multiplier, or 500 kHz" should read "running the SPI bus at 1/64th multiplier, or 15.6 kHz".

The comments in the code listing for 25LC256.c in the initSPI() function should also be changed to read "div 64" rather than "div 16". The code itself is fine.

Bob Burns  Dec 03, 2014  Mar 03, 2015
Other Digital Version
10134
Figure 17-3

Figure 17-3 shows the LM75 in a DIP package on the breadboard. However the supplier I checked (Mouser) only has it available in surface mount packages.

Where do I get a DIP version of LM75? Alternatively, how do I fit the SMD version in a breadboard?

Note from the Author or Editor:
Will need a note added to the text. This is a major edit, and should probably be done inline.
Resolved in atlas

John Brewer  Apr 24, 2014  Mar 03, 2015