Go Down

Topic: Beta testers needed for a new library that generates true random numbers (Read 9 times) previous topic - next topic

Coding Badly

#10
Jun 06, 2012, 05:42 pm Last Edit: Jun 06, 2012, 05:50 pm by Coding Badly Reason: 1

For the watchdog control register, Libc provides a processor independent macro.  There are other things in wdt.h that may help like wdt_enable...

Code: [Select]
#include <avr\wdt.h>

_WD_CONTROL_REG |= (1<<_WD_CHANGE_BIT) | (1<<WDE);


http://www.nongnu.org/avr-libc/user-manual/group__avr__watchdog.html

wanderson

CodingBadly:

Thank you for the information on the WDT device independent information.  Would you provide some more information on why you would suggest using TMR0 on the ATtiny85?  I haven't run any of my raw WDT tests on that chip, but noticed that it does have an 8-bit timer1.  Since TMR0 on the standard Arduino's showed some potential bias problems, which as we have discussed, is probably due to TMR0 being used for an interrupt to maintain micros, etc.. I assumed that would be a similar problem on your ATtiny85 core (I haven't looked at your core code in any detail).

Also, I posted this question in the Programming forum, but I had some difficulty getting my #ifdef to recognize the ATtiny85 was being compiled for...  I would appreciate advice on how to address that issue.

Walt
New true random number library available at: http://code.google.com/p/avr-hardware-random-number-generation/

Current version 1.0.1

Coding Badly

#12
Jun 06, 2012, 06:49 pm Last Edit: Jun 06, 2012, 06:55 pm by Coding Badly Reason: 1
Would you provide some more information on why you would suggest using TMR0 on the ATtiny85?


Standard Core and Tiny Core both configure the millis timer for fast PWM and the other timers for phase-correct PWM (this is probably true for all Arduino cores).  Standard Core uses timer 0 for millis.  Tiny Core uses timer 1 for millis.  Basically, the timer 0 Tiny Core configuration should very closely match the timer 1 Standard Core configuration.  I assume that will improve your library's prospects.

Quote
I haven't run any of my raw WDT tests on that chip, but noticed that it does have an 8-bit timer1.


It does but it is configured to run like timer 0 on the Standard Core.

wanderson


Would you provide some more information on why you would suggest using TMR0 on the ATtiny85?


Standard Core and Tiny Core both configure the millis timer for fast PWM and the other timers for phase-correct PWM (this is probably true for all Arduino cores).  Standard Core uses timer 0 for millis.  Tiny Core uses timer 1 for millis.  Basically, the timer 0 Tiny Core configuration should very closely match the timer 1 Standard Core configuration.  I assume that will improve your library's prospects.

Quote
I haven't run any of my raw WDT tests on that chip, but noticed that it does have an 8-bit timer1.


It does but it is configured to run like timer 0 on the Standard Core.



Okay, thanks.
New true random number library available at: http://code.google.com/p/avr-hardware-random-number-generation/

Current version 1.0.1

wanderson

Well with CodingBadly's assistance I have compiled the library and am testing it on an ATTiny85, specifically, I had a Sparkfun AVR Stick (http://www.sparkfun.com/products/9147) which I am running the same test sketch as above on.  The stick and an FTDI cable was all I needed.  In 36-48 hours I should have a sample dataset from the ATtiny, using CodingBadly's core for that machine.

If someone wants to try this with the ATtiny85, I am attaching the one library file that needed to change.  The file is also on the google code page, but I haven't updated the zip file there yet.
New true random number library available at: http://code.google.com/p/avr-hardware-random-number-generation/

Current version 1.0.1

Go Up