Tuesday, March 15, 2016

The $5 FORTH Computer

The MSP430 makes an excellent choice for a Forth Computer.  It already has a 16 bit architecture, and the Von Neuman  unified memory space makes dealing with data and instructions somewhat simpler. It's choice of low power, non volatile FRAM memory makes it virtually unique in the microcontroller market.

FRAM has a fast write cycle - about 100 times the speed of Flash, and with a life of 10E +14 cycles - it will not wear out anytime soon.   EEprom is made redundant with FRAM, and the boundary between FRAM and SRAM can be moved - so that FRAM is used as RAM - allowing up to 8MHz operation.

The MSP430FR2433 is a new addition to the FRAM range of microcontrollers and at  $1.50 it is very affordable. Add to this an external SRAM or FRAM memory and you have the makings of a powerful little machine.  With volume production, it's possible to have a complete Forth system for around $5 - including the USB programming adaptor.

Performance wise, it's not in the ARM class, not even close, but at 16MHz full speed, it will run about 4 times the throughput of the Arduino R3.

One of it's strengths is that it has been blessed with 3 communications ports - allowing a rich mix of asynchronous UART and synchronous SPI hardware to be added.

The MSP430 may be programmed with a variety of Forths, including Mecrisp, Amforth and 4E4th - the latter having a special port of Camel Forth available specifically for FRAM operation.

Recently I came across Fast Forth by Jean-Michel Thoorens - this is Direct Threaded Code, and has support for SD card.  Programming is done making use of TeraTerm for file sending - at a full 921600 Baud.   It was designed specifically for MSP430 with FRAM - needing just  8K bytes of FRAM.

Forth was designed as a complete, self contained  tool-chain - including Editor, Compiler and Assembler - all the tools that you need to develop code,  at your fingertips - present on the target chip.   Now for the first time we can have all of this on a tiny, manageable 20 pin DIL module - complete with it's own USB programming interface.

The communications interfaces include UART, SPI and I2C.  There are up to 6 port pins available for use as GPIO,  peripheral selects or ADC inputs.

Need to add more I/O? No problem - can be done using simple shift registers clocked off one of the two available SPI ports.

Want to build a WiFi or Bluetooth robot - again no problem. Just drive the stepper motors using a shift register or high power driver  - such as the TPIC6B595 

The SPI port may be used to read a PS/2 keyboard, or I2C will interface nicely to a Wii Nunchuck controller.

ChipStick will accept an external static RAM (23K256 or 23LC1024) up to 128Kx8, or a SPI FRAM of up to 256Kx8.  In streaming mode the speed is about 3uS per byte (for long streams) allowing 32K to be transferred in 100mS.

It should even be possible to experiment with monochrome video output by clocking data out of the SRAM using SPI.

Erm  - Wrong Chipsticks!

ChipStick will be a fully functioning FRAM MSP430 Forth System!

It's nice to have a hobby in which something useful can be designed over a weekend. That's the case with ChipStick - conceived on Friday evening after work - and off to meet it's maker (my pcb board house) at the end of Sunday evening.

ChipStick is the solution to the modern problem that not enough microcontrollers are breadboard friendly - so I just sat down and designed what I needed - a neat 20 pin DIL module - based on the MSP430FR2433.

ChipStick is probably the smallest computer I have worked on, but despite it's small size I have managed to pack a lot in. The MSP430FR2433 has 15.5Kbytes of FRAM and 4Kbytes of SRAM. There are 3 communication ports UART &  SPI, an external memory  - either SRAM or FRAM and up to 4 x 10 bit ADC channels.

The external memory is either a 23K256 SRAM - and there's facility for battery or super-cap backup, or a non-volatile FRAM device.  Either way it extends the memory by a useful 32K to 256K bytes.

ChipStick comes with a detachable programmer section - which consists of the USB- serial converter IC and the 3V3 regulator.  Without the programmer section  ChipStick is just 27 x 11mm  - and that's small enough to fit inside a 2 x 4 LEGO block!

The programmer section is however fairly unobtrusive and can be kept in place - even when the device is plugged into a Launch Pad pcb.

No comments: