Is this a misprint - STM32 ARM PROGRAMMING FOR EMBEDDED SYSTEMS

Thread Starter

ApacheKid

Joined Jan 12, 2015
157
This is a large paperback book that for the most part is quite informative and has a lot of helpful detail.

But I'm exploring DMA and found what look like a misprint or coding error - Page 353.

In the function DMA1_Stream6_setup is the statement:

DMA1->HIFCR = 0x003F0000; /* clear all interrupt flags of stream 6. */

This code is writing a '1' to bits 16 thru 21 inclusive - 6 bits.

However the same book on Page 350 details each bit in the HIFCR register and calls out that bit 17 (and others) are reserved and must be kept at reset value.

This means that instead that assignment should be:

DMA1->HIFCR = 0x003D0000; /* clear all interrupt flags of stream 6. */

That assignment does not write a '1' to bit 17.

Is this correct reasoning or am I missing something?

Thanks
 

Analog Ground

Joined Apr 24, 2019
305
You are correct but it likely has no effect since those reserved bits are not in use.
Also, there is the idea that a reserved bit may be used in the future by the manufacturer. Part of reserving it is not using it now in case it is used in the future. The book has an error. Not a serious one but an error. BTW, always refer to the ST reference manual for the chip on issues with registers. Maybe the register description in the book is incorrect? The reference manual is more accurate than anything else. Also, over time the latest reference manual download is updated but the book may be out of date.
 

Analog Ground

Joined Apr 24, 2019
305
This issue with a reserved bit is an example of why software is never bug free. Writing a 1 to the reserved bit does not cause a problem now and is very difficult to find but is technically a bug. In the future if the bit is used incorrectly, the chip explodes. You have a sharp eye!
 
Top