Jump to content

eLua for SAM3 (Arduino Due)

Recommended Posts

I am porting eLua to the Atmel SAM3/4 processors, in particular the SAM3X8E used in the Arduino Due.


Port is running, with support for the serial console and several devices.


  • PIO - works
  • UART - works, except for buffering (xmodem does not work on serial console).  Hardware flow control written, but not tested.
  • USB CDC - works, except for buffering (although attached build does not use it).
  • Timers - works
  • PWM - works, but has some issues (sometimes the drivers return wrong values to eLua, but it does work).  Have not tested for accuracy of frequency or duty cycle.  So far just uses the hardware pwms, use of timers as PWM (e.g., so can use more pins for PWM) is in the works.
  • spi - written, but not tested (if you try it out, let me know).
  • rand (generate numbers at random) - works
  • rtc - works (but not sure about using external crystal)
  • i2c (twi) - not finished
  • adc - not finished
  • can - not finished
  • cnt (counter) - not finished
  • dac - not written


Source code available on github -

https://github.com/ecdr/eluain the SAM branch
To talk to the console, use the programming port on the Arduino Due Usual settings 115200 baud, N, 8, 1You may need to set your terminal program to send a CR and LF as end of line.
You can program the attached bin file to an Arduino Due using the Arduino boot loader (bossac).e.g., if the programming port is connected as COM8 (on windows)
bossac.exe -Ufalse -pCOM8 -e -w -v -b elua_lua_arduinodue.bin -R
Thank you to Sergio at simplemachines.it

For my eLua port for the Stellaris launchpad, see



Link to post
Share on other sites
  • 2 years later...

Where download source code?


It is on github in my fork of eLua, in the branch named SAM.

The direct link is.



Most of the SAM specific adaptations are in the src/platform/sam34 directory.



If you haven't used git it takes a bit of learning, but is really nice when using/managing a large project.

I haven't done much on this recently, but would welcome contributions to the branch.  (Would be nice to get it totally working

and incorporate into the eLua main line.)

Link to post
Share on other sites
  • 3 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...