ATmega4809 Curiosity Nano
Microchip's ATmega4809 Curiosity Nano evaluation board makes a very low-cost platform for running uLisp.
The ATmega4809 provides 48 Kbytes of flash memory, 6 Kbytes of RAM, and 256 bytes of EEPROM, and runs with a 20MHz internal oscillator. The board includes a debugger, providing a USB-to-serial interface:
It's available from suppliers such as Farnell [1].
Installing uLisp from the Arduino IDE
- First download the latest AVR version of uLisp from the Download uLisp page.
- Install MCUdude's MegaCoreX from GitHub, as described in MegaCoreX - How to install.
- On the Board menu, under the heading MegaCoreX select Atmega4809.
- Check that the subsequent options are set as follows (ignore any other options):
Clock: "20MHz"
Pinout: "48 pin standard"
Programmer: "Atmel nEDBG (ATSAMD21E18)"
- Connect the board to the computer via USB.
- Select the device corresponding to the USB port from the Port menu.
- Upload uLisp to the board.
You should then be able to select Serial Monitor from the Tools menu, and enter Lisp commands.
LED
The Curiosity Nano has a yellow LED connected to pin 39 which you can flash with the following program:
(defun bli (&optional x) (pinmode 39 t) (digitalwrite 39 x) (delay 1000) (bli (not x)))
Run it by typing:
(bli)
Exit from the program by entering ~.
Pin 39 can also be used as an analogue output pin, so you can pulsate the yellow LED slowly on and off with this Pulse program:
(defun pls () (loop (dotimes (x 512) (delay 5) (analogwrite 39 (if (> x 255) (- 511 x) x)))))
Run it by typing:
(pls)
As before, exit from the program by entering ~.
You can save the Pulse program to EEPROM by typing the command:
(save-image)
You can now load it again after a reset by typing:
(load-image)
Note that there's very little EEPROM on the ATmega4809, so this is close to the largest program you will be able to save with (save-image).