Showing posts with label FPU. Show all posts
Showing posts with label FPU. Show all posts

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.

                                              5V(REG)

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                 │        
            │    └────────────────────┘
           GND


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.


'--------------------------------Connections------------------------------
'            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...

Thursday, February 9, 2012

A very interesting chip

I have been poking around looking at floating point processors and have come across a very interesting chip that I have bookmarked for future investigation, the Micromega uM-FPU64.  So far I have not been able to find anyone with stock on this chip other than the earlier V3.1 32 bit version.  For USD25.00 in single unit quantities, this is quite the bargain.




Features




64-bit and 32-bit Floating Point
A comprehensive set of 64-bit and 32-bit floating point operations are provided.
See the uM-FPU64 datasheet for details.



64-bit and 32-bit Integer
A comprehensive set of 64-bit and 32-bit integer operations are provided.
See the uM-FPU64 datasheet for details.



User-defined Functions
User-defined functions can be stored in Flash memory. Flash functions are programmed through the SERIN/SEROUT pins using the uM-FPU64 IDE. A high level language is supported, including control statements and conditional execution.



Matrix Operations
A matrix can be defined as any set of sequential registers. The MOP instruction provides scalar operations, element-wise operations, matrix multiply, inverse, determinant, count, sum, average, min, max, copy and set operations.



FFT Instruction
Provides support for Fast Fourier Transforms. Used as a single instruction for data sets that fit in the available registers, or as a multi-pass instruction for working with larger data sets.



Serial Input / Output
When not required for debugging, the SERIN and SEROUT pins can be used for serial I/O. A second asynchronous serial port, with hardware flow control, is also available as a local device using the DEVIO instruction.



NMEA Sentence Parsing
The serial input can be set to scan for valid NMEA sentences with optional checksum. Multiple sentences can be buffered for further processing.



String Handling
String instructions are provided to insert and append substrings, search for fields and substrings, convert from floating point or long integer to a substring, or convert from a substring to floating point or long integer. For example, the string instructions could be used to parse a GPS NMEA sentence, or format multiple numbers in an output string.



Table Lookup Instructions
Instructions are provided to load 32-bit values from a table or find the index of a floating point or long integer table entry that matches a specified condition.



MAC Instructions
Instructions are provided to support multiply and accumulate and multiply and subtract operations.



A/D Conversion
Multiple 12-bit A/D channels are provided (six on 28-pin device, nine on 44-pin device). The A/D conversion can be triggered manually, through an external input, or from a built-in timer. The A/D values can be read as raw values or automatically scaled to a floating point value. Data rates of up to 10,000 samples per second are supported.



Real-Time Clock
A built-in real-time clock is provided, for scheduling events or creating date/time stamps.



Timers
Timers can be used to trigger the A/D conversion, or to track elapsed time. A microsecond and second timer are provided.



External Input
An external input can be used to trigger an A/D conversion, or to count external events.



Foreground/Background Processing
Event driven foreground/background processing can be used to provide independent monitoring of local peripherals. The microcontroller communicates with the foreground, while background processes can be used to monitor local device activity.



Local Device Support
Local peripheral device support includes: RAM, 1-Wire, I2C, SPI, UART, counter, servo controller, LCD, and VDrive2 devices. The uM-FPU64 can act as a complete subsystem controller for GPS, sensor networks, robotic subsystems, IMUs, and other applications. Local devices are assigned to digital I/O pins at run-time, and controlled with the DEVIO instruction.




Low Power Modes
When the uM-FPU64 chip is not busy it automatically enters a power saving mode. It can also be configured to enter a sleep mode which turns the device off while preserving register contents. In sleep mode the uM-FPU64 chip consumes negligible power.




Firmware Upgrades
When updates become available, the uM-FPU64 firmware can be upgraded in the field using the uM-FPU64 IDE software.