So, as mentioned earlier, I have installed FlashForth on an Arduino Nano.
In this blog I will tell you how I did it. There are some small things that make put you of on the track there.
Get the tools
To get the things going you will need:
- Some Arduino board (Nano, Duemilanove, Mega 2560 R3 or Uno R3)
- A way to get the hexfile on the board. I’m using a second Nano card with the ArduinoISP sketch and avrdude.
- The code to burn. Can be found at Source Forge (Download link).
I am running Kubuntu, so the installation of avrdude is done by:
sudo apt-get install avrdude
Unpack the FastFoth archive and find the hex file needed. In my case
~/work/flashforth-code-537e623ec97a1f9c912eba7d6c7afaafbdd0c60d/avr/hex
Get a Programmer
If you allready have an ISP system, you can skip this part.
How to hook up two Arduino Uno to use one as an ISP for the other is shown here.
For two Nano, it is more or less the same:
Or as a Fritzing sketch:
Program!
So, looking in the file “A Tutorial Guide to Programming PIC18, PIC24
and ATmega Microcontrollers with FlashForth” (found here.) I found a avrdude command to use:
$ sudo avrdude -p m328p -B 8.0 -c jtag3isp -P usb -e \
-U efuse:w:0xff:m \
-U hfuse:w:0xda:m \
-U lfuse:w:0xff:m \
-U flash:w:ff_uno.hex:i
Now, this line contains some errors for my setup. The easy ones:
I don’t use jtag3isp, I use avrisp. I have the programmer on /dev/ttyUSB0, not only usb.
There is one more problem. I don’t know if it is board, processor or programmer related. When I enter the line:
sudo avrdude -P /dev/ttyUSB0 -b 19200 -c avrisp -p m328p -v -e -U efuse:w:0xff:m -U hfuse:w:0xda:m -U lfuse:w:0xff:m -U flash:w:ff_uno.hex:i
I get an error:
avrdude: safemode: efuse changed! Was ff, and is now 7
Would you like this fuse to be changed back? [y/n] n
It seems my setup return unused bits in efuse as 0, but 1 is expected. Chaning the line to:
sudo avrdude -P /dev/ttyUSB0 -b 19200 -c avrisp -p m328p -v -e -U efuse:w:0x07:m -U hfuse:w:0xda:m -U lfuse:w:0xff:m -U flash:w:ff_uno.hex:i
does the trick.
Start playing…
To hook up to the new toy to the computer, I use:
sudo gtkterm –port=/dev/ttyUSB0 –speed=38400 –delay=10 –flow=Xon
and now I have a Forth Arduino Nano.
More on FlashForth
good stuff