Using FIGnition+Raspberry PI for ssh AVRdude!

110 views
Skip to first unread message

Carl Attrill

unread,
Jan 25, 2014, 5:14:55 AM1/25/14
to fign...@googlegroups.com
Hi I wanted to share with you a perfect use for my Raspberry Pi,

I have been using a donated Dell Inspiron 5151 to support my experiments on my FIGnition, I have used it with Ubuntu installed to burn new firmware and files to the DIY computer.

It is showing its age, I am unsure to how old it actually is, however it no only works if powered by mains, and thats if it has had a charge for a few hours prior to use.

the option to purchase a spare battery seems to be a risky one with prices ranging from £35 upward,also my previous experiences with 'genuine fakes'are not good ones.

I have managed to compile T2E2 onto my main computer, this is a Compaq CQ1000 running win7,it's nothing special, but a good all rounder for the house.T2E2 automatically converts programs written in notepad to bitesized hex files that can be transferred to FIGnition with AVRdude.

AVRdude is installed for this computer and I had installed AVR burn-o-mat prior to this, however the PC really grumbles when my FIGnition is connected via USB, it don't like it and keeps interrupting power to the fignition when the desktop is informing me of an unrecognised device plugged into it :-< 
I tried the 'legacy driver' route to no effect.

Because of this I can transfer flash files, these are the programs okay, but the firmware revisions to EEPROM quit at around 80% of the write cycle, this has bad consequences for my poor figgy!

Knowing that the Lappy is on borrowed time and preparation is needed to be used, I had the idea of employing my Raspberry pi.

If, like me you are using a Windows PC and are struggling to use the usb for avr transfers, you could not do worse that getting a Raspberry Pi and doing the following...

go to the Adafruit site and follow these steps for enabling SSH

learn.adafruit.com/adafruits-raspberry-pi-lesson-6-using-ssh/enabling-ssh

and also while your there install and setup tightvnc, this is for mouse controlled tasks, like file transfers.

learn.adafruit.com/adafruit-raspberry-pi-lesson-7-remote-control-with-vnc/installing-vnc

If you have performed these steps successfully, you can open putty / tightvnc on your pc desktop

and then start a new LXterminal session from your desktop

then do: sudo apt-get install avrdude

when this is done, put all you FIGnition files in one directory and navigate to it, use avrdude!

Two different ways of teaching people how computers work, I do see the FIGnition as the computer and the interface, but both can be owned and used, even together.

Regards,

Carl.



ssh_window_avrdude.png
ssh_window_setup.png
fignition_progs.png

Stuart Taylor

unread,
Jan 25, 2014, 5:24:49 AM1/25/14
to fign...@googlegroups.com

Hi Carl.

Are you saying you develop your forth on windows in a notepad type environment and copy to the raspi, or you vnc to the raspi and develop on a notepad environment there?

Also, are you uploading your forth, compiled into avr .hex using avr icsp?

Cheers,

Stuart

--
You received this message because you are subscribed to the Google Groups "FIGnition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fignition+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

carl

unread,
Jan 25, 2014, 5:39:17 AM1/25/14
to fign...@googlegroups.com


On Saturday, 25 January 2014 10:24:49 UTC, Stu Taylor wrote:

Hi Carl.

Are you saying you develop your forth on windows in a notepad type environment and copy to the raspi, or you vnc to the raspi and develop on a notepad environment there?

Hi Stu, I use wordpad on my PC and then 'save as' a plaintext doc. I always put the .fth extension in the filename. Windows throws a few warnings at me but I ignore them. 

So I use the PC, but before the laptop started to play up, it was all done there. So I guess you could do it all via Tightvnc on the Pi, but its soooo slow!
 

Also, are you uploading your forth, compiled into avr .hex using avr icsp?

I use t2e2, I compiled it to PC using a solution that user Mikey found here 

its really good as it divides the blocks up into whole commands no more than 511 bytes, its luxury compared to the first version. ( well done Julz!)

But if I had the pi running this concept earlier, I would have compiled to there with less procedures, with it being linux and all that.

Cheers,

Stuart


Regards

n.b. I was meant to say the FIGnition is the real computer, and Pi the interface right at the end of my post.
 

carl

unread,
Jan 25, 2014, 10:08:12 AM1/25/14
to fign...@googlegroups.com
So I covnvert .fth to .hex on my PC, transfer the hex files to the raspi my means of a memory stick. Then avr dude the .hex files from raspi to fignition with avr dude, controlled by the PC. ( kindle or nintendo wii, they have a vnc client on them too!) But that is over complicating things :-)

Stuart Taylor

unread,
Jan 25, 2014, 10:40:52 AM1/25/14
to fign...@googlegroups.com

Ah OK I got you. Your using the 512b method.

It would be fairly trivial to have that raspi interface do a bit more of the heavy lifting. I may investigate that further.

To easily copy the files, take a look at winscp. It uses the same connection details as SSH (putty), and will allow you to copy files from windows to raspi in a fashion akin to ftp.

Stuart

On 25 Jan 2014 15:08, "carl" <carl.a...@gmail.com> wrote:
So I covnvert .fth to .hex on my PC, transfer the hex files to the raspi my means of a memory stick. Then avr dude the .hex files from raspi to fignition with avr dude, controlled by the PC. ( kindle or nintendo wii, they have a vnc client on them too!) But that is over complicating things :-)

carl

unread,
Jan 25, 2014, 11:04:28 AM1/25/14
to fign...@googlegroups.com


On Saturday, 25 January 2014 15:40:52 UTC, Stu Taylor wrote:

Ah OK I got you. Your using the 512b method.

It would be fairly trivial to have that raspi interface do a bit more of the heavy lifting. I may investigate that further.

To easily copy the files, take a look at winscp. It uses the same connection details as SSH (putty), and will allow you to copy files from windows to raspi in a fashion akin to ftp.


Thanks Stu,

I would like to know how to do this if you manage it, we can make it work a bit harder perhaps.I know that transferring PC files to the raspi is superfluous as it could be done on the Raspi in the first place. But its what I am used to and I prefer the windows gui.

Blue sky thinking here; I also wonder if the PI can be used as a mass storage device, like a big amic chip, so  more bytes can be stored in one area, thus reducing the transfers needed to compile a lengthy programme?

If it could undertake some low-speed usb transfer to the FIGnition chipset...

Carl.


carl

unread,
Jan 25, 2014, 12:06:14 PM1/25/14
to fign...@googlegroups.com
I have also transferred data via serial usb to arduino that is linked to FIGnition, I looked into shift/enter commands to be sent that would jump the FIGnition out of editor and save the block and then put itself back into editor for the next block. You would only need paste one long script via Putty, with all the commands in the right place it could have been a tape load equivalent. But I could not find the right jump out ascii chars. One way could be for a physical connection to be made by the arduino or Pi. Perhaps.

Stuart Taylor

unread,
Jan 25, 2014, 12:20:03 PM1/25/14
to fign...@googlegroups.com

I was thinking along the lines of the raspi doing the conversion from forth to hex, enabling the bootloader on the fignition, sending the chunks and sending the edit list and load commands.

Stuart

On 25 Jan 2014 17:06, "carl" <carl.a...@gmail.com> wrote:
I have also transferred data via serial usb to arduino that is linked to FIGnition, I looked into shift/enter commands to be sent that would jump the FIGnition out of editor and save the block and then put itself back into editor for the next block. You would only need paste one long script via Putty, with all the commands in the right place it could have been a tape load equivalent. But I could not find the right jump out ascii chars. One way could be for a physical connection to be made by the arduino or Pi. Perhaps.

Julian Skidmore

unread,
Jan 25, 2014, 12:40:28 PM1/25/14
to FIGnition

Hi Stuart, yes I was going to say, GCC on raspi to compile t2e2. It will also be worthwhile getting the open version of java to run on your pi as some tools (namely the graphics conversion program) are written in java. Cheers julz

carl

unread,
Jan 26, 2014, 4:21:51 AM1/26/14
to fign...@googlegroups.com
So you might be ale to use the pi to close and open sw1 then automatically load hex blocks, would you then be able to get the raspi to send typed commands to the fignition like the auduino can do at present on a serial connection?

Stuart Taylor

unread,
Jan 26, 2014, 5:17:39 AM1/26/14
to fign...@googlegroups.com

That's the idea yes.

So you send forth files to the raspi, via smb cifs or web. Then the raspi will "compile" the forth, and upload the hex in chunks to the fignition using the bootloader (enabled by closing SW1).

There are some things to consider. On raspi cache, and some sort of hash schema for that. A job queue, watchdog and post upload test.
A web interface to manage it all would be a nice to have. However, I want to make connecting the raspi as easy as possible, so that its not about the raspi, its about the fignition. I don't want people to have to assemble YARPI (yet another raspi pie interface), so I need to have a look at the cheap ($1 + free p&p) eBay modules, and their reliability, vs building a fignition board.

I had a good rummage through the source last night (early this morning). And I understand the machine much better for that.

I'll write up a blog post at some point, i've kept notes.

Stuart

On 26 Jan 2014 09:21, "carl" <carl.a...@gmail.com> wrote:
So you might be ale to use the pi to close and open sw1 then automatically load hex blocks, would you then be able to get the raspi to send typed commands to the fignition like the auduino can do at present on a serial connection?

carl

unread,
Jan 26, 2014, 7:05:08 AM1/26/14
to fign...@googlegroups.com
Thats sounds like a good idea, it is about FIGnition, as you say.
Do you have a link to your blog?

I see the task in four main operations

Serial transfer to figkeys for -n edit & cmd+w typed commands

Script and gpio connections to hold sw1 and undo that command.

The same as above to interupt the red wire in the usb lead to FIGnition,thus powering it on/of so it can resume bootloader or come out of bootloader.

Finally to put all this in operation that includes a script to run avrdude and move the selected hex files.

There must be a way to de-raspi this operation, as the task is not excusive to raspi. I think with >port> on another fignition harnessed to the target fig you could do the sw1 and a klunky data entry. But the drawback there is that I am looking to close/open connections, not sending 5v, whoops, forget that!

Regards
Carl

Stuart Taylor

unread,
Jan 26, 2014, 7:25:57 AM1/26/14
to fign...@googlegroups.com

Well if we use a cheap USB serial interface we can use the DTR or CTS line to reset the AT168/AT328, so the same is achievable with the raspi, we don't need to mess about with the power of the USB or cut into lines etc. Just pull the reset line.

The scripting side is very straight forward. Little more than a few batch commands in bash.

You could take the raspi out of the mix, and use another avr to provide serial, and poke various lines on the fignition. Hmm, it would be trivial to make an SD card loader for the .hex files. Another "shield" for the fignition?

I'm off for a ponder...

Stuart

Julian Skidmore

unread,
Jan 26, 2014, 11:14:07 AM1/26/14
to FIGnition

Hi Stuart, also it should be fairly easy to convert the flash disk and vdisk code so that you can write .fth files directly to its external flash chip using spi. No t2e2 needed then, super fast copying!

-cheers julz

Stuart Taylor

unread,
Jan 26, 2014, 1:53:04 PM1/26/14
to fign...@googlegroups.com

Ha ha, yes. I spotted the spi earlier and thought the same thing. I have an SD card on the breadboard ready.

The SD card slot has a micro switch for card insertion/removal.....

Stuart

Stu Taylor

unread,
Jan 27, 2014, 8:26:03 AM1/27/14
to fign...@googlegroups.com
Well, last night i tinkered with the sdcard, and of course the first thing to trip me up was the lack of /CS.  The fignition is using two of the AVRs ports, and i'm not sure whether to use another pin (because i'd like to detect the sd card insertion switch) or use the current two ports (PB1 and PB) as a 2 bit address bus to allow me to select flash, eeprom and sdcard. I think i have a 74138 or 74139 which would work for a POC.

I'm thinking, put the .fth files on the sd card. Pop sd card in slot (the insertion sw is closed), and the fignition using (updated) disk code copies the files to external flash.

Thats the easiest i can think of making it.

Stuart

To unsubscribe from this group and stop receiving emails from it, send an email to fignition+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "FIGnition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fignition+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "FIGnition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fignition+unsubscribe@googlegroups.com.

Julian Skidmore

unread,
Jan 27, 2014, 8:51:42 AM1/27/14
to FIGnition
Hi Stu,

I am rather confused by what you're saying. The following statements seem ambiguous or confusing:

1. "The lac of /cs" - do you mean a lack of /cs on FIGnition or on the SD card itself?
2. "The FIGnition is using two of the AVRs ports" The FIGnition is using PortB, PortC and PortD and leaves 3 or 4 port pins free.
3. "I'd like to detect SD Card" You want to detect an SD Card using a FIGnition?
4. "Or use the current two ports as a 2-bit address bus" Then FIGnition won't be able to run any Forth code, as the Forth VM will make assumptions about how it controls PB1 and PB2.

It looks to me like you want to get a FIGnition to interpret an SD Card in order to copy .fth programs to its external Flash chip. Or perhaps you want FIGnition to use an SD Card instead of its flash chip. I think this isn't a good way of doing things. I would do the following: Write some software for the Raspberry PI which copies .fth files DIRECTLY to an SPI-based Amic Flash Chip using the sector management algorithms on FIGnition. Let's this program: F2F (File 2 Flash).

To do this you'll need a simple program which reads binary files (or text files); 4 spare GPIO pins on your FIGnition and a simple circuit which can drive and read the SPI pins on an 8-pin socket (maybe you'll need a few resistors to do level conversion to 3.3v for the Amic chip, but something tells me Raspberry PI GPIOs already run at 3v ish so you'll just need a small cap and a direct connection).

Read the code in:
Spi.c
AmicFlashSpi.c
FigVFlash.c
(and possibly ForthDsk.c).

It's the smallest, simplest Flash Translation Layer you'll probably come across, amounting to about 1.5Kb of compiled code. It's good code, interesting stuff - a program I have wanted to write for 20 years! It is designed to be used on third party products as a way of providing disk-like access to MCU projects rather than the half-brained write-once algorithms I'm always coming across. I'd like to see it more widely used and the relatively easy effort of porting to the Raspberry PI would be one way of doing that.

I can see the appeal of doing it the other way: get FIGnition to understand SD Cards and then you can load Forth programs directly on a FIGnition, like people do with SD card interfaces for other 8-bit computers. But, I believe it's a shorter development path to get a Raspberry PI talking to an Amic chip.

-cheers from Julz


To unsubscribe from this group and stop receiving emails from it, send an email to fignition+...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.



--
                             
                  The DIY 8-bit computer from nichemachines™

FIG - black on whiteMini.jpg
NmLogoMini.jpg

Stuart Taylor

unread,
Jan 27, 2014, 10:02:04 AM1/27/14
to fign...@googlegroups.com
Sorry Julz.

Fignition is using PB1 and PB2 as the chip select lines for the external SPI chips. To add an SD card to the mix (use the existing SPI bus) i would need another chip select line.
yes i was think that the fignition would detect card insertion, and be able to access the SD card.

stuart

Julian Skidmore

unread,
Jan 27, 2014, 10:40:49 AM1/27/14
to FIGnition
Hi Stu,

For my part, sorry I used caps in the previous email, what I meant by the caps was that I think using a Raspberry PI to interface directly to the Flash chip is a cool idea, but not the obvious one.

There are a few difficulties with using SPI to SD card on a FIGnition. One of the major ones is that it'd take quite a lot of source code to do it ie.: SD Drivers aren't tiny; so you'd either end up having to write stand-alone copying firmware for FIGnition (and having to reflash the FIGnition back every time) or, if it would fit, restricting its use to AtMega328 based FIGnitions (thus excluding most FIGnition owners). If it's a person project that's probably fine, if you want to share it, it'll limit the audience.

The other difficulty is that you'd have to find a way of kludging an SD card interface to a FIGnition (I guess that's why you suggested the shield). Nevertheless there is some provision for SPI interfacing on FIGnition from Forth in that FIGnition Forth has a crude SPI driver. The difficulty with using it is that SD Cards have quite a long preamble so it'd probably push the limits of the Forth spi command to support it, it's only designed to support fairly simple spi devices.

On the other hand, interfacing the Raspberry PI to a FIGnition Flash chip is an interesting little project in its own right IMO: something that can be used in other scenarios. You'll find that the FIGnition AMIC drivers are fairly easy to port even on a 32-bit machine. You should only need to really modify the spi.c code itself. The reason for this, is because I used the same code to test the FigVFlash.c code on my desktop computer in simulation. Only when the algorithm was working 100% did I start testing it on a FIGnition, it should basically already run correctly on a 32-bit machine.

It'd also be less involved. With a direct write you could have the Raspberry PI say waiting on a ethernet port for data and then program the Flash chip with a Forth file directly. Or copy multiple raw sectors (e.g. some bitmapped images) without having to go through the .hex stage. For example:

./f2f 100 pong.fth

Then all you have is a (a) Copy files to Amic Flash (b) Move Amic Flash to FIGnition.

I think that's neater than (a) Copy files to SD; (b) Move SD Card to FIGnition (c) Copy files from SD to FIGnition.

But it's always your choice, if you feel the SD card approach is better go for it, it's your FIGnition, Ras-Pi and programming tools :-)

-cheers from Julz
NmLogoMini.jpg
FIG - black on whiteMini.jpg

JESSON SEAN

unread,
Jan 27, 2014, 11:43:54 AM1/27/14
to fign...@googlegroups.com
Showing my ignorance, would it be possible (with a hardware mod) to switch the SPI lines to the AMIC flash between the R-Pi and the FIGnition? My picture involves hooking some wires to the R-Pi and flicking a switch rather than repeatedly moving the flash part between the two.

[I haven't looked at the hardware design to see whether the SPI lines can be exposed in this way, but Julian probably knows off the top of his head.]

Carl Attrill

unread,
Jan 27, 2014, 12:04:48 PM1/27/14
to fign...@googlegroups.com
Hi Sean 

I read that the method that you suggest was used by games programmers in the days of Sinclair and commodore. Normally with a TRS80.

The programmer would develop on the TRS wich shared the other computers memory. Then the switch was throw and the data was available to the speccy or Commodore.

This would be great, the data could be dumped via the raspi client and then adopted on demand by the FIGnition. 

Of course I have no idea on how possible this is, but its a concept I understand.

Regards

Carl

Si Brindley

unread,
Jan 27, 2014, 1:21:19 PM1/27/14
to fign...@googlegroups.com
I know Matt Smith wrote entered his code and level data on a TRS-80 and repeatedly “squirted” it to the Spectrum - as he put it; perhaps that is how he did it.  (He also said that the TRS-80 crashed every time someone switched the kettle on.)

Stuart Taylor

unread,
Jan 27, 2014, 2:44:20 PM1/27/14
to fign...@googlegroups.com

Hmmmmm. Well PB is available on a header, so it might be possible, but my experience is that the pull ups on the board may cause an issue with an extternal programmer. I'll have a play.

Stuart.

Stuart Taylor

unread,
Jan 27, 2014, 6:24:41 PM1/27/14
to fign...@googlegroups.com

SD card shield:
So tonight I've realised that to work with fat16 sd cards I can get away with an at168 but for working with fat32 I'm going to need an at328 (for the ROM).
So an SD card shield would need an at328, SD card socket, a 16MHz xtal (because i'm running at 3.3v) and some header pins.
I've got all of that, so next step will be to veroboard a POC. Still not sure about fignitions on board resistors in the spi lines.

Raspi:
Loaded kernel driver for broadcom spi, and got flashrom installed (flashrom.org), and running, I think it will support the chips used in the fignition. It supports the 4Mb version of the same family. Will wire it up and try dumping the flash.

Avrdude
I'm going to try and access the amic using a usbasp. Seems to be a popular choice in the RC community.

Stuart.

Reply all
Reply to author
Forward
0 new messages