Tool/software: TI C/C++ Compiler
I want to generate a random No. with maximum randomness with the help of ADC.
Please help.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: TI C/C++ Compiler
I want to generate a random No. with maximum randomness with the help of ADC.
Please help.
Chris Karaplis said:You could leave the pin floating, and then take the LSB from several measurements to construct your initial value
Floating pin is bad idea. - Pin can "receive" periodic signal which is far from random. Imagine if pin receives AC mains EMI and ADC sampling freq is way higher than AC freq, like 500 SPS - then you will get strings of 1's and 0's like 0000111111000000111111. No randomness at all.
Creating good hardware entropy source for random number generator is not a trivial task, some are even patented. One of well-known noise source is zener diode - if powered from noiseless voltage source. Instead of using floating pin, I would suggest to sample channel 0x0b (internal VCC divider) using VCC as reference. Obviously as Chris already suggested, only LSB shall be used for entropy, thou quality of such enropy generator remains to be seen.. When enough entropy bits are collected, it is wise idea to scramble them with AES-CTR or similar crypto/hash algorithm
Clemens Ladisch said:The sample-and-hold circuit of the ADC is likely to discharge any random charge.
Did you ever continuously sampled floating pin of msp430 charge redistribution ADC? :) You shall try. Thing is that whole ADC have around 27pF internal capacitance, LSB capacitor is fraction of that. Not that much charge is needed to flip it.
**Attention** This is a public forum