Arduino · 9 May 2013 3

New advancedFunctions library for Arduino DUE

Arduino DUE R3

Arduino DUE

I’ve started writing a new library that let to use the integrated peripherals into the Atmel SAM3X8E microcontroller of the Arduino DUE board that are not yet supported by the Arduino IDE core.

At the moment the library, called advancedFunctions, supports the real time clock (RTC), that provides the timing and a calendar, and an alarm too, and the true random number generator (TRNG) that has passed the NIST tests too. The support for other hardware will be added in the future.

To use the library, download the package that you find at the end of this article and uncompress it. When you have extracted the folder advancedFunctions, move it into the folder /libraries that the very latest versions of the Arduino IDE 1.5.x create into the sketches’ folder, that it’s now named /Arduino. To know where the sketches’ folder is located, open the IDE and click on the menu at “File/Preferences”. After you did this, you’re ready to use the functionalities of the library by simply adding it to your sketch with the following instruction:

#include "advancedFunctions.h"

As I said before, the library doesn’t support all the hardware integrated into the microcontroller that is not supported by the Arduino core. Being it at a very early stage, at the moment it only supports the following peripherals (more functionalities will be added later):

RTC (Real Time Clock) module

The RTC integrated into the SAM3X8E is a real time clock capable of timing, calendar and alarm for month/day/hours/minutes/seconds (still to be supported) functionalities. These functionalities are available with the object rtc. You can find the instructions on how to use it into the file RTC_MODULE.txt.

Important! The user Embed has pointed my attention on the fact that by default the chip SAM3X8E doesn’t use the external 32 kHz crystal but instead makes use of an internal RC oscillator, not so precise. So I introduced a fix into the file myRtc.cpp that enables the use of the external crystal. In case your Arduino DUE wouldn’t have this crystal (some boards of the very first production lot didn’t have it) or if you are using a standalone chip without that crystal, the RTC module won’t run because it won’t have a valid clock source. You simply have to modify the above file following the directions that I’ve written into the doc file named RTC_MODULE.txt.

TRNG (True Random Number Generator) module

The TRNG that is integrated into the microcontroller is very robust and it has passed the America NIST Special Publication 800-22 and Diehard Random Tests Suites. It is capable to generate 32 bits of entropy with very high casuality (so the name of “true” generator) every 84 clock cycles. You can find the instructions on how to use it into the file TRNG_MODULE.txt.

WDT (WatchDog Timer)

The WatchDog Timer is a timer that can reset the microcontroller if the code becomes trapped in a deadlock. The user can choose the interval in milliseconds between 1 and 16000.
IMPORTANT: to use this module you have to edit a file of the Arduino core (read the /doc/WDT_MODULE.txt).

License and warranties

The library and the included examples are released under the terms of the GNU General Public License 3.0. The software is provided as is, without any warranty for its functioning and without any liability for its usage. More details are included into the file README_FIRST.txt and in the doc files inside the /doc folder.

AdvancedFunctions
AdvancedFunctions
advancedFunctions-0.5.0.zip
Version: 0.5.0
29.0 KiB
3787 Downloads
Details...