I read on section 14.3.8 of the STM32F4 reference manual that you can mask the LFSR output value partially or totally.

At first I thought that it was used to change the pseudo random pattern (representative polynomial function) but I'm not really sure anymore.

What's the real purpose of this mask?

I'm not very familiar with LFSR noise generation so I might have got everything wrong...


According to section 14.5.1 of that same document the MAMPx[3:0] bits are used to control the amplitude of the generated noise (or triangle) waveform. For noise, they simply mask off (force to zero) the high-order bits of the LFSR output.

It seems pretty clear that the noise/triangle waveform can be used as a "dithering" signal for ADC operations, and that's what they have in mind with this feature.

  • \$\begingroup\$ Thanks for you answer! I still don't understand how masking the high order bits changes this amplitude of the noise waveform though... I thought it would only change the frequency response of the noise \$\endgroup\$ – Florent Jun 9 '16 at 21:48
  • \$\begingroup\$ If you mask off the high-order 8 bits from a 12-bit number, you get values in the range of 0-15 only. If you only mask off 6 bits, you get values in the range of 0-63. Bigger numbers means higher amplitude. The masking actually has no effect on the frequency content -- white noise is white noise regardless of the number of bits of resolution. \$\endgroup\$ – Dave Tweed Jun 10 '16 at 5:08
  • \$\begingroup\$ Oh yeah sure I'm sorry, I didn't think about it like that \$\endgroup\$ – Florent Jun 10 '16 at 7:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.