The Arduino Nano is essentially just a smaller form-factor version of the popular Arduino Uno, based on the same ATmega328P processor, and it’s a popular board because Chinese clones are available for a few dollars/pounds. Previously I’d assumed that uLisp would run on it with the same performance as on the Arduino Uno.
However, I was recently contacted by a micro programming group whose students have Arduino Nanos, but have been struggling to get uLisp running on them.
Further investigation revealed that the Arduino Nano differs from the Arduino Uno in one crucial aspect. From the specifications on the Arduino site:
- Arduino Uno (Rev 3): Flash memory 32 KB of which 0.5 KB used by bootloader.
- Arduino Nano: Flash memory 32 KB, of which 2 KB used by bootloader.
If you install uLisp on the Arduino Uno you get:
Sketch uses 32194 bytes (99%) of program storage space. Maximum is 32256 bytes.
It fits, but only with 62 bytes spare.
However, if you try and install it on the Arduino Nano you get the error:
Sketch uses 32194 bytes (104%) of program storage space. Maximum is 30720 bytes. Sketch too big
So uLisp is taking the same amount of space on each board, but the Arduino Nano bootloader is taking up an additional 1536 bytes!
There are two possible solutions:
Run an earlier version of uLisp
The most recent version of uLisp that will fit on the Arduino Nano is Version 2.5:
For a list of newer features that you will be missing out on, see Older versions.
Install the Uno bootloader
A better solution is to install the improved Uno bootloader, and then pretend that the Nano is a Uno. You can always use the same procedure to put back the Arduino Nano bootloader if you want to (although I’m not sure why you would want to do that!).
The procedure is as follows:
- Disconnect the USB cable from the Arduino Nano.
- Connect an ISP programmer to the 6-pin ISP header on the Arduino Nano.
I used the USBasp programmer that comes with a cable that fits on the 6-way header; it’s available from many vendors and on eBay:
Orient the header plug with MISO connected to the pin marked 1.
Alternatively you can use an Arduino Uno as an ISP programmer:
Connect it to the ISP header with six cables. If your board doesn’t have an ISP header, connect to the six corresponding pins on the edge connector: GND, VCC, MOSI, MISO, SCK, and RESET.
- On the Arduino IDE Tools menu set Programmer to USBasp.
- On the Tools menu choose the Arduino AVR Boards core and set Board to Arduino Uno.
- Choose Burn Bootloader.
You should now be able to use the Arduino Nano by selecting Arduino Uno as the board type, and you’ll be able to upload uLisp.