Friday, September 04, 2015

If you've got a problem .....

If you've got a problem, don't care what it is
If you need a hand, I can assure you this

I can help, I've got two strong arms, I can help
It would sure do me good to do you good
Let me help

Few people today are aware of Problem Oriented Languages - a term first coined by Charles H. Moore - just over 45 years ago in June 1970.

Here is his unpublished book retyped some years ago into HTML, which again today I came across, this time on the Raspberry Alpha Omega blog of Frank Carver.

Frank is clearly an experienced and talented software engineer, and understands the inner workings of computer software in ways that I just struggle to grasp. So it was a pleasant surprise to find that Frank and I have been following virtually parallel journeys for the last couple of years, he from a software perspective - and myself from a hardware perspective.

This post is not specifically about Problem Oriented Languages, but more how they are still relevant today and can be applied to a range of fields of computing science.

A Problem Aired....

My immediate problem is that I am now working with a range of microcontrollers,  both AVRs and ARMs of several different flavours and I need to find some common ground between them, and establish a comfortable development environment - founded on mutual territory.  Throw into the mix, some stack-based soft cores running on FPGAs, and the chance of finding my Nirvana rapidly fades into dust.

All of these processors fit into the 20MHz to 200MHz clock speed, and really don't have enough memory resources to support an operating system like Linux.  Some of the larger parts can be programmed in MicroPython or JavaScript but that's not much use for the soft cores or the smaller parts.

I wondered for a while whether Arduino might become the lingua franca, at least for "hobby" projects - because as well as the ATmega,  it has been implemented on the STM32F  ARM M3 and M4  parts and also the ZPUino soft core - hosted on the Spartan 6 of the Gadget Factory Papilio Duo.

So for the moment, you have a range of different microcontrollers, with which you can share Arduino sketches and libraries.

A word about FPGAs and Soft Core CPUs

In the last few years, FPGAs have become commonplace, and the toolchains needed to develop applications on them, have become free to use. Several tech suppliers are offering low cost dev-boards based around a small FPGA, with sufficient hardware support, to allow programming via serial or JTAG, plus support chips - such as external SRAM, SDRAM and configuration flash.

So far my journey has taken me to the Xilinx Spartan 6 - as there are several hobby-boards based around this device.  Plus this part appears to have a lot of support from the emerging FPGA community.

Jack Gasset and his team at Gadget Factory have democratised the FPGA, in a similar way to how the Arduino Team democratised the ATmega and C++.

By porting an open source soft core 32bit CPU, plus a library of other cool hardware resource libraries - such as sound chips and music synthesisers, you can now make your own hardware designs relatively easily and control it all with the ZPUino softcore - executing Arduino sketches at 100MHz.

The great thing about the ZPUino FPGA soft core for projects, is that there is a hardware VGA generator plus the Adafruit graphics library available which can support 800x600 resolution VGA. You just plug in a VGA monitor, and you can draw graphics to your heart's content - all in a few lines of Arduino code.  This is a super-quick Arduino, with colourful grahic output that you are totally in control of.  Other libraries allow you to add a PS2 keyboard and mouse - you have the makings of a complete development environment on an FPGA.  It's the computing equivalent of an early 1990s workstation - but unconstrained by any operating system - effectively a blank canvas onto which you paint your computing dreams!

If you want to look further - this was built using a Papilio Duo FPGA board fitted with a Computing Shield.  If you want to go this route, make sure you buy the Papilio Duo with the 2MB SRAM - as the cheaper 512KB part will severely limit your graphics play.

So far, more interesting options - and no one solution. And also, the allure of FPGA soft core processors was becoming a great distraction.

J1 - A Forth CPU

Almost exactly 3 years ago to the week, I was in New York for the Open Hardware Summit.  One speaker was James Bowman, who introduced us to GameDuino - a bolt on video system for an Arduino. In th form of a shield, with VGA and audio connectors - it could handle the whole video graphics - based on a neat Forth processor, that James had designed - and known as the J1.  James had developed the J1 for a robotic video system based on a Xilinx Spartan 3E FPGA, which has more than enough grunt to handle the sprites, backgrounds and tone generators of a typical 1980s arcade video game.

The original J1, presented at EuroForth 2010 is descrbed here.
and further links to the J1 and GameDuino are here.

James has since ported it to the Spartan 6, made a few demon tweaks, and it can now run on the Papilio boards.  The J1 can be instantiated as either a 16 bit or a 32 bit processor.  Clock speeds approachin 100MHz are achievable.

In addition to developing the J1 hardware, James has created a version of Forth to run on it known as SwapForth, and has leveraged some open source FPGA tools to create an open core processor, running open source software - developed with open source tools. This video gives a quick demo.

I am still very much digesting the last 3 years on posts on Frank's blogsite.   The next post here will try to make sense of it all.

1 comment:

jose luis toscano said...

hi, maybe you can help me i'm using a 2 atmega328 one is a master reader and the other is the slave writter master reader has conected a ENC28j60, but i cant do the comunication whith the PC the atmega's are in standalone everithing's works fine, only the ethernet part doesn't conect i used a logic tester and the results was that the clock an the enable of the atmega master are not sichronized it's there a posibility that the Wire.h libray and the Uipethernet.h are not compatible ? the stand alone atmega's are unsing a external xtal 16mhz, but when i use a arduino replacing the master reader circuit it works!!! maybe the arduino has an coupler circuit ?