The errata list is a list of errors and their corrections that were found after the product was released.
The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.
Version |
Location |
Description |
Submitted by |
Date submitted |
ePub |
Page 12
Figure 2-2 |
The bottom right box within the main processor has the letters: "PNMIO". Perhaps this should be "PWM IO".
|
Roy Harrison |
May 21, 2013 |
PDF |
Page 12
Figure 2-2 |
|
Rob Wehrli |
Jan 03, 2014 |
Printed |
Page 18
Footnote |
On the footnote, the link for the Google style guide (http://code.google.com/google-styleguide/) is not valid anymore. Can you, please, provide the current and correct one?
Best regards,
Pedro Silva
|
Pedro Silva |
Feb 13, 2017 |
PDF |
Page 27
|
Non-integral type cannot have in-class initializer and the statement "static Singleton* mInstance = 0;" inside the class definition was incorrect:
class Singleton {
public:
static Singleton* Instance() {
if (mInstance == 0) {
mInstance = new Singleton;
}
return mInstance;
}
protected:
Singleton(); // no one can create this except itself
private:
static Singleton* mInstance = 0;
}
The non-integral type static class variable should be defined as follows:
private:
static Singleton* mInstance;
If you want to initialize it to 0 and you should initialize it outside the class definition as follows:
Singleton * Singleton::mInstance = 0;
|
Emerson Wang |
Jan 16, 2012 |
Printed |
Page 29
Figure 2-8 |
On the main Model View-Controller pattern diagram:
The arrows between the Controller and View should be in opposite directions if they are pointing from the source to destination for the message/information.
|
Anonymous |
Jun 10, 2012 |
Printed |
Page 30
1st paragraph |
This paragraph is discussing output files, so the first sentence:
"The input file can look however you want."
should be
"The output file can look however you want."
|
Kenneth Lo |
Jun 22, 2012 |
Printed |
Page 66
code |
A code example reads: filter = &fir;.
Here filter is declared as a pointer to a function and fir as a function. As the name of a function, without the brackets, evaluates to the address of the function, this should be:
filter = fir;.
If the code works with the address operator it is possibly because the compiler throws the ampersand away. See K&R 1 page 209 and ANSI C.
|
Anonymous |
Aug 13, 2012 |
Printed |
Page 99
last paragraph |
Error in the equation of the timer frequency. The equation should be:
timerFrequency = clockIn/(prescaler * (compareReg + 1))
This should also be corrected in the examples on page 101.
|
Anonymous |
Mar 12, 2015 |
Printed, |
Page 103
1st |
Dear Author,
I found that prescaler = 1023, compare = 230, error should = 0.002%. Not 0.02%.
Because I calculated that
Actual Output Freq = 4MHz/ (1023 * 230) = 17.00029751
So, Error % = 100* Abs(17 - 17.00029751)/17 = 0.002 %
I see and appreciate your passion and experiences in the field of embedded system. I hope my submit will helpful to you and other readers.
Regards,
Salai Aung Myint Myat
|
Salai Aung Myint Myat |
Mar 15, 2017 |
Printed, |
Page 103
Figure 4-9. Brute-force timer solution |
Dear Author,
In the figure, there are three errors.
At no.1, Min Prescaler should = 784.31 instead of 922.72, because goal freq is using 20 Hz.
At no.3, Compare reg resulted = 254.9 by using goal freq = 17 Hz, not 20Hz.
When calculating error %,
using actual out freq = 16.99 will result error % = 0.06%.
So, it should use actual out freq = 16.99488029, error % = 0.03%.
I hope it will useful for you and other readers. Thank you.
Regards,
Salai Aung Myint Myat
|
Salai Aung Myint Myat |
Mar 15, 2017 |
Printed |
Page 142
. |
On lines 4, 5 and 12 timer (or timers) should be task (or tasks).
|
Anonymous |
Aug 13, 2012 |
Printed |
Page 179
1st code/diagram block |
In the first diagram, it seems like the write and read pointers are switched. write should be ahead of read for the data to be between them and (write - read) to be a positive value.
In the second diagram, the pointers are again backwards and the code seems to have them backwards as well.
Perhaps I'm misunderstanding something, but these drawings conflict with the ones on page 178.
|
Anonymous |
Aug 14, 2013 |
Printed |
Page 208
Second Paragraph from the bottom |
The next line (.text:{*(.text)}) says...
should be:
The next line(Code:{*(.vectors).....
|
Anonymous |
Nov 12, 2012 |
Printed |
Page 240 and 241
code at end of page |
After the loop unrolling (as reflected by the code), the while loop now only decrements bufLength once for each two bytes that are written from the byteBuffer. Since bufLength was doubled (bufLength*2) before the loop, it should decrement in tandem with the increments in byteBuffer: otherwise the buffer will run out of bytes half way through the while loop.
An somewhat more elegant solution would involve removing the multiplication (bufLength = bufLength*2) above the loop. However, in this case, the 2nd paragraph of the next page (241) should also be removed. (It starts with "Why don't I care about removing the bufLength multiplication at the top of the function?")
In fact, after reading that line, I was hopeful that my confusion would be cleared up imminently. Instead, it was increased instead :)
Kind regards, and the book was a fun and interesting read!
- Niek van Suchtelen
|
Niek van Suchtelen |
Jun 08, 2012 |
Printed |
Page 245
code at top of page |
The code in the Interview Question box is introduced as a "relatively dumb solution", however, I'm not sure that the writer intended to omit a return statement for its 'output' variable.
Adding "return output;" after the loop would fix this issue.
Kind regards,
- Niek van Suchtelen
|
Niek van Suchtelen |
Jun 08, 2012 |
Printed |
Page 245-246
Example code 1 &.3 and 2nd and last paragraphs of Interview Question |
There are a few things in this interview question I believe could be very confusing or misleading to new embedded programmers.
In Paragraph 2, did you mean to say the bit-shift operator has lower precedence than the bit-wise and operator? (&) This would make sense for there to be an error with missing parentheses, but the missing parenthesis for the subtraction would not cause an error.
In your code examples, you have the for loop setting bits and the 3 line swap operation. The latter is a fairly compact but complicated set of operations per line. It may be worth giving a short explanation of how 1 register is saved by example 3. It also worth noting that even though 1 register is saved, assuming the compiler has optimized out the 3rd, the 1st code example is smaller in flash, saving ~3x the code space without loop unrolling. (Though the loop runs ~42 assembly operations while the 3rd runs only ~15.) I'm not sure if any of this matters, but clarification could mean the difference of understanding the tradeoffs of size and speed and just taking the latter example as the superior.
|
Ivan Bow |
Sep 25, 2021 |
Printed |
Page 252
Figure 9-3 (box at the bottom of page) |
The stated equivalence of the equations for calculation of standard deviation does not hold for the "corrected" STD, i.e. when the denominator is (N-1). A simple test for the values, say, [3,5,7] verifies this: The first form returns 2, and the second form returns 4.062. The equivalence as stated holds only for the "uncorrected" STD, when the denominator is N, as shown in http://dsearls.org/courses/M120Concepts/ClassNotes/Statistics/510B2_derivation.htm.
Alternatively, the second equivalence can be fixed by encompassing the last term, (x_bar)^2, within the summation parenthesis.
|
Yakir Loewenstern |
Nov 25, 2014 |
Printed |
Page 254
The code sample on the top |
variance = (var->sumSquares - (var->var * (*average)))/(var->numSamples-1);
should be ?:
variance = (var->sumSquares)/(var->numSamples-1) - (*avaerage)* (*average);
|
Anonymous |
Nov 23, 2012 |
Printed |
Page 258
Table 9-1 |
In table 9-1, titled "Approximating 1/6 with a power-of-two divisor", one of the divisors listed is 23 (for equivalent shift 5). This is not a power of 2, and should be 32 instead.
Kind regards,
- Niek van Suchtelen
|
Niek van Suchtelen |
Jun 09, 2012 |
Printed |
Page 259
Scaling the Input, first sentence |
The sine function [...] outputs a value from -1 to 1, NOT from 0 to 1
|
Anonymous |
Mar 12, 2021 |
PDF |
Page 264
Table 9-1 row 3 |
Table 9-1 Row 3: Divisor = 23 but should be 32
Table 9-1 Row 10: Error = 0,04 but should be 0.04
|
Lukas Bartels |
Oct 21, 2022 |
Printed |
Page 269
First code example |
In the following section of code:
struct sFakeFloat four = {1, -2};
floatingPointValue = four.num >> shift ==> 1/(2^(-2)) ==> 1 * 2^2 ==> 4
The variable 'shift' should be 'four.shift'.
|
Mathew Henderson |
Feb 08, 2013 |
Printed |
Page 269
Second code example |
Should the value assigned to notTenBillionOne.num be ten biliion one (10000000001)?
In this printing it is one billion two hundred fifty million:
struct sFakeFloat notTenBillionOne = { 1250000000, -3 };
|
Mathew Henderson |
Feb 08, 2013 |
Printed |
Page 271
2nd paragraph |
The paragraph states, "The result's numerator is 126, and the shift is 3, for a floating-point equivalent of 15.84..."
This is incorrect as 126 / (2^3) = 15.75.
Prior to modifying the temporary variable (in the previous code example) to safely fit into an int8_t, this would have been true as tmp was equal to 507 and b.shift was equal to 5.
In this case, 507 / (2^5) is approximately equivalent to 15.84.
|
Mathew Henderson |
Feb 08, 2013 |
Printed |
Page 273
Table 9-4 |
Starting with table 9-4, a maximum result for the A*ADC^2 + B*ADC + C equation is given as 1249.641. However, I can get a higher maximum value by plugging in certain values from Table 9-3:
ADC: 1023
A: 0.001
B: 0.2
C: 3
Now, the equation is: 0.001 * 1023^2 + 0.2 * 1023 + 3 = 1254.129, not 1249.641.
The value for the minimum result is given as -1046.483. This is correct, as it can be obtained using ADC: 1023, A: -0.001, B: 0.002, C: -2.
However, the explanation in the paragraph starting with "We can determine" seems wrong for this case. The first line of that paragraph refers to the max. value, which is a correct explanation, although the actual value obtained doesn't seem to be a result from this explanation (as explained earlier). The part about the minimum value states that: "the minimum result can be obtained only with the maximum ADC, minimum A parameter, and zero B and C parameters". This is not true, and as shown in my previous paragraph, it's not what was used to obtain -1046.483. When using the explanation, the result would be -1046.529, which is indeed lower, but B now falls outside its 0.002 - 0.2 range, and a lower result is still possible by using -2 for C (although B would still be wrong) and it's not the result that is given in 9-4.
Kind regards,
- Niek van Suchtelen
|
Niek van Suchtelen |
Jun 10, 2012 |
Printed |
Page 275
Table 9-6 |
The granularity given in the table (4.2950E+09) is wrong, for both Minimum and Maximum.
It should be 2.3283E-10.
Kind regards,
- Niek van Suchtelen
P.S. It would be great if I could get a copy of the book that incorporates the fixes!
|
Niek van Suchtelen |
Jun 10, 2012 |