Saturday, March 10, 2012

Propeller Floating Point Coprocessor

Today I am playing with a magic little I2C coprocessor from Micromega, the uM-FPU V3.1 32 bit IEEE 754 floating point and 32 bit integer coprocessor.  There are several support objects to be found in the Parallax Object Exchange for this co-processor.  This $20 part gives amazing functionality to embedded systems in need of floating point support.  It interfaces via either SPI or I2C to the propeller or other devices.

There is also a 64 bit version of this device at $25 that I have placed on order.  There are contributions in the Parallax Object Exchange for the 64 bit device as well.

Here is my current lash-up for testing:

 The schematic of this hookup is as follows.  This is straight out of the Parallax Object Exchange FPU32 objects.  The demo code included is useful to get one familiar with how to talk to the FPU.


P   │                                   10K    │
  P3├4─>───────────────────────────+──── R ────+  
R   │                              │           │
  P4├5─>───────────────────┐       │           │
O   │                      │       │           │
  P5├6─<>───+─────>─┐      │       │           │
P   │       │      12     16       1           │
            │    ┌──┴──────┴───────┴──┐        │
         1K R    │ SIN   SCLK   /MCLR │        │                 
            │    │                    │        │
            │    │                AVDD├18──────+
            └─<11┤SOUT             VDD├14──────┘
                 │                    │        
                 │     uM-FPU 3.1     │
            ┌───4┤CS                  │
            +───9┤SIN                 │
            +──17┤AVSS                │
            +──13┤VSS                 │        
            │    └────────────────────┘

The CS pin(4) of the FPU is tied to LOW to select SPI mode at Reset and
must remain LOW during operation. For this demo the 2-wire SPI connection
was used, where the SOUT and SIN pins were connected through a 1K resistor
and the DIO pin(6) of the Propeller was connected to the SIN pin(12) of
the FPU.

'            On Propeller                           On FPU
'-----------------------------------  ------------------------------------
'Sym.   A#/IO       Function            Sym.  P#/IO        Function
_MCLR = 3 'Out  FPU Master Clear   -->  MCLR  1  In   Master Clear
_FCLK = 4 'Out  FPU SPI Clock      -->  CLK  16  In   SPI Clock Input    
_FDIO = 5 ' Bi  FPU SPI In/Out     -->  SIN  12  In   SPI Data In
'       └─────────────────via 1K   <--  SOUT 11 Out   SPI Data Out

So thus far, I have been able to get the chip interfaced and able to run the demos for arithmetic, matrix, and FFT operations.  Next will be to write some useful code to exercise the chip a bit.  Ultimately I want to implement the SGP4 algorithms for satellite tracking.

Simplified perturbations models are a set of five mathematical models (SGP, SGP4, SDP4, SGP8 and SDP8) used to calculate orbital state vectors of satellites and space debris relative to the Earth-centered inertial coordinate system. This set of models is often referred to collectively as SGP4 due to the frequency of use of that model particularly with two-line element sets produced by NORAD and NASA.

More to come...

No comments:

Post a Comment