Quantcast mbedLPC1768 - eLua Wiki
Locked History Attachments


Using eLua on the MBED boards

Board Specifications



Using '''eLua''' on the mbed LPC1768 under Windows

The following instructions are known to work on Windows XP (SP3)...

If you haven't done so already, download the mbed USB serial driver (mbedWinSerial_16466.exe) from the mbed site. Run this .exe to install the serial driver. You will get several warnings about unsigned installations; just click Continue in each case.

Connect your mbed board to the PC with an USB cable. You should see a new removable disk drive (for example, E:) in your Explorer. The device manager should also show a new serial port, named mbed serial port (for example, COM3). Open a terminal program, such as HyperTerm, and create a connection to the mbed serial port. Configure your connection for 115200 baud, 8N1.

Go to the eLua page of binary images and grab the latest mbed eLua image (for example, the 0.9 image, elua0.9_lua_lpc1768.bin). Drag this binary image onto your mbed removable disk drive. After the transfer finishes, press the mbed's reset button. After the blue LED stops flashing, you should see the eLua start screen on your terminal program.

Type 'help' (no quotes) to see the available shell commands.

Using the stock 0.9 eLua binary, your mbed has two drives. There is a small, read-only drive called /rom, which holds selected files placed during the build process; this drive is empty on the 0.9 eLua binary image.

There is also a small, read/write drive called /semi. This drive is unique to the mbed board and uses the off-chip flash storage provided by the mbed developers. This is the same drive that you see in your Explorer window on your desktop. This is also your gateway into working with eLua.

Open a text editor (such as Wordpad set for text-only). Copy and paste the following text into your editor and save the resulting file to your PC hard drive as blinky.lua:

-- blinky.lua
-- blink LED1 on the mbed board
-- press any key to end this program

led = mbed.pio.LED1
pio.pin.setdir(pio.OUTPUT, led)

print ""
print "Press any key to exit program..."

while (term.getchar(term.NOWAIT) == -1) do
tmr.delay(0, 500000) -- delay is in usecs
tmr.delay(0, 500000)

Drag this text file onto the mbed drive on your desktop. Go to the terminal window and, at the eLua# prompt, enter:

lua /semi/blinky.lua

The shell will load the blinky.lua program from the /semi directory and launch the eLua program, running your script. Watch the LED blink for a while, then press any key on the terminal keyboard to end the program and return to the eLua shell.

(Note: The above text was taken, with minor changes, from this website [http://www.seanet.com/~karllunt/mbed_eLua.html] and appears here with that author's permission.)

Using '''eLua''' on the mbed LPC1768 under Linux

This (below) is not a tutorial but a simple hint extracted from a mail list message. It will be kept here until someone can add more detailed instructions.

Compile and copy the .bin file to /media/MBED (or whever your mbed filesystem is mounted). After it finishes copying reset the board (you might want to umount /media/MBED first) and wait until the blue LED finishes blinking. At that point your eLua firmware should be programmed. Also note that at least on my machine the mbed serial port (used by the eLua console) is exported under the name /dev/ttyACM0 (not /dev/ttyUSBx).