SPRTBL Firmware


Introduction

This document describes the operation of the SPRTBL firmware. The SPRTBL firmware runs on a SPEAR3 Speech Processor and translates compressed tabluar data into output stimulus to its cochlear implant drivers. This firmware is intended for research work only. The SPEAR3 Speech Processor is from HearWorks Pty Ltd.

This document is intended as a guide to anyone needing to understand the SPRTBL firmware, presumably for "high level software" integration or modification of the firmware itself.

This HTML document itself is embedded in the SPRTBL firmware and is simply copied out of the comments in the firmware with a single line of Perl code. This means that there is only a single source of documentation. Any modifications to the document should be made as comments in the SPRTBL firmware and the HTML file should then be regenerated.

The SPRTBL firmware was written for the MRC-CBU under the direction of Dr. Christopher Long.


Contents

  1. Objectives
  2. Memory Map
  3. Driving SPRTBL
  4. SPRTBL internal operation

Objectives

Briefly, the objectives are:
  • Whatever else, maximize precision of all timing aspects of the output stimulus
  • Minimize the delay between High Level Sofware to output stimulus

    The name "SPRTBL" is derived from SPEAR3 TaBLe, and is intended to reflect the particular method applied to solve the particular problem(s) in using the SPEAR3 in psychoacoustic research, according to the objectives. Really, there are a great deal of other concerns, but the SPRTBL firmware can only address the two of them listed above.

    Attempts to reach the first objective are described in detail below, and center around using the DSP56300's Fast Interrupt Mode.

    Attempts to reach the second objective, also described below, amount to minimizing the volume of data to be transfered to the SPEAR3 device to get it to output new stimulus. This resulted in implementing a compression scheme for the data which must be preloaded, and moves many burdens to the High Level Software where memory and time constraints are not an issue.


  • Memory Map

    This is not a guide to the SPEAR3 hardware nor the Motorola DSP56309 which it contains. This Memory Map section will only cover what the High Level Software, henceforth HLS, needs to know.
    P-Memory (Program Memory)
    Once the firmware has been loaded there are NO
    locations in P-Memory accessible to the HLS.




    Address ranges in the tables below are colour coded.
    This colour means these locations are RESERVED.
    This colour means that the values here are fixed per "run" (more on that below).
    This colour means that these locations are expected to be accessed during a test run by the HLS. Note that there are only 3 such locations, 2 in Y-Memory and 1 in X-Memory.


    Y-Memory / Left Side Encoder Data
      
     Address(es)      Default value       Name                   Description
    -----------------------------------------------------------------------------------------------------
     $000000             000000           Y_RELOAD              Write a 1 to start.
    
     $000001                                                    Internal. Don't touch.
    
     $000002               2000           Y_STptr               Pointer to Y/Left  Stimuli Table
    
     $000003 - $000004                                          Internal. Don't touch.
    
     ------------------ Y-fixed beginning ----------------------------------
     This section sets Active El, Ref El, Amplitude of pulse N
     $000005                 20           Y_ActE                Active electrode
     $000006                 30           Y_RefE                Reference elec (MP1+2)
     $000007 - $000008      0,1                                 Phase 1 duration (25 us)
     $000009 - $00000A    188,0                                 Inter-phase gap (45us)
     $00000B                  0           Y_AmpAE               Amplitude (0)
     $00000C - $00000D      0,0                                 Phase 2 duration (25 us)
     $00000E - $00000F      5,0                                 Inter-frame gap (8 us)
    
     This second section Sets Phase and IPG of pulse N (sets Active, Ref, Amp of N+1)
     $000010                 24                                 Active electrode (MP1)
     $000011                 25                                 Reference elec (MP2)
     $000012 - $000013      0,0                                 Phase 1 duration (25 us)
     $000014 - $000015    188,0                                 Inter-phase gap (8 us)
     $000016                  0                                 Amplitude (0) -- THIS SHOULD ALWAYS BE ZERO
     $000017 - $000018      0,0                                 Phase 2 duration (25 us)
     $000019 - $00001A      5,0                                 Inter-frame gap (8 us)
     $00001B                $80                                 Encoder Halt bit, loaded in Active Elec location
    
     This section sets describes a null pulse, a Power pulses only
     $00001C                 20                                 Active electrode (electrode #20)
     $00001D                 30                                 Reference elec (MP1+2)
     $00001E - $00001F      0,0                                 Phase 1 duration (25 us)
     $000020 - $000021    188,0                                 Inter-phase gap (45 us)
     $000022                  0                                 Amplitude (0) -- THIS SHOULD ALWAYS BE ZERO
     $000023 - $000024      0,0                                 Phase 2 duration (25 us)
     $000025 - $000026      5,0                                 Inter-frame gap (8 us)
     $000027                $80                                 Encoder Halt bit, loaded in Active Elec location
     ------------------ Y-fixed end ----------------------------------
    
     $000028 - $00002B                                          Internal. Don't touch.
    
     ------------------ Y-table beginning ----------------------------------
     Beginning of the Y/Left side Stimuli Table
     $000034            $14C81E           Eword 0               |elect #A|  AMP    |elec #R |
     $000035            $011000           Tword 0               |TTNP (Time Till Next Pulse)|
     $0000bobobobo      $14B81E           Eword 1                  ...
     $00002F            $010000           Tword 1                  ...
     $000030            $14A81E           Eword 2                  ...
     $000031            $00f000           Tword 2
     $000032            $14981E           Eword 3                  ...
     $000033            $00e000           Tword 3
     $000034            $14881E           Eword 4                  ...
     $000035            $00d000           Tword 4
     $000036            $14781E           Eword 5                  ...
     $000037            $00c000           Tword 5
     $000038            $14681E           Eword 6                  ...
     $000039            $00b000           Tword 6
     $00003A            $14581E           Eword                    ...
     $00003B            $00a000           Tword
     $00003C            $14481E           Eword                    ...
     $00003D            $009000           Tword
     $00003E            $14581E           Eword                    ...
     $00003F            $008000           Tword
     $000040            $14681E           Eword                    ...
     $000041            $007000           Tword
     $000042            $14781E           Eword                    ...
     $000043            $006000           Tword
     $000044            $14881E           Eword                    ...
     $000045            $005000           Tword
     $000046            $14981E           Eword                    ...
     $000047            $004000           Tword
     $000048            $14A81E           Eword                    ...
     $000049            $003000           Tword
     $00004A            $14B81E           Eword                    ...
     $00004B            $002000           Tword
     $00004C            $14C81E           Eword                    ...
     $00004D            $001000           Tword
     $00004E            $ffffff           Eword N               electrode = FF means end of table.
     $00004F - $FEFFFF                                          Available for table data             
     ------------------ Y-table end ----------------------------------
    
     $FF0000 - $FFFFFF                                          Reserved. Don't touch.
    
    



    X-Memory / Right Side Encoder Data
      
     Address(es)      Default value       Name                   Description
    -----------------------------------------------------------------------------------------------------
    
     $000000 - $000001                                          Internal. Don't touch.
    
     $000002               2000           X_STptr               Pointer to X/Right Stimuli Table
    
     $000003 - $000004                                          Internal. Don't touch.
    
     ------------------ X-fixed beginning ----------------------------------
     This section sets Active El, Ref El, Amplitude of pulse N
     $000005                 20           X_ActE                Active electrode (electrode #20)
     $000006                 30           X_RefE                Reference elec (MP1+2)
     $000007 - $000008      0,0                                 Phase 1 duration (25 us)
     $000009 - $00000A    188,0                                 Inter-phase gap (45us)
     $00000B                  0           X_AmpAE               Amplitude (0)
     $00000C - $00000D      0,0                                 Phase 2 duration (25 us)
     $00000E - $00000F      5,0                                 Inter-frame gap (8 us)
    
     This second section Sets Phase and IPG of pulse N (sets Active, Ref, Amp of N+1)
     $000010                 24                                 Active electrode (MP1)
     $000011                 25                                 Reference elec (MP2)
     $000012 - $000013      0,0                                 Phase 1 duration (25 us)
     $000014 - $000015    188,0                                 Inter-phase gap (8 us)
     $000016                  0                                 Amplitude (0) -- THIS SHOULD ALWAYS BE ZERO
     $000017                0,0                                 Phase 2 duration (25 us)
     $000018 - $000019      5,0                                 Inter-frame gap (8 us)
     $00001A - $00001B      $80                                 Encoder Halt bit, loaded in Active Elec location
    
     This section sets describes a null pulse, a Power pulses only
     $00001C                 20                                 Active electrode (electrode #20)
     $00001D                 30                                 Reference elec (MP1+2)
     $00001E - $00001F      0,0                                 Phase 1 duration (25 us)
     $000020 - $000021    188,0                                 Inter-phase gap (45 us)
     $000022                  0                                 Amplitude (0) -- THIS SHOULD ALWAYS BE ZERO
     $000023 - $000024      0,0                                 Phase 2 duration (25 us)
     $000025 - $000026      5,0                                 Inter-frame gap (8 us)
     $000027                $80                                 Encoder Halt bit, loaded in
     ------------------ X-fixed end ----------------------------------
    
     $000028 - $00002B                                          Internal. Don't touch.
    
     ------------------ X-table beginning ----------------------------------
     Beginning of the Y/Right side Stimuli Table
     $000034            $14C81E           Eword 0               |elect #A|  AMP    |elec #R |
     $000035            $009000           Tword 0               |TTNP (Time Till Next Pulse)|
     $0000bobobobo      $14C81E           Eword 1                  ...
     $00002F            $009000           Tword 1                  ...
     $000030            $14C81E           Eword 2                  ...
     $000031            $009000           Tword 2
     $000032            $14C81E           Eword 3
     $000033            $009000           Tword 3
     $000034            $14C81E           Eword 4
     $000035            $009000           Tword 4
     $000036            $14C81E           Eword 5
     $000037            $009000           Tword 5
     $000038            $14C81E           Eword 6
     $000039            $009000           Tword 6
     $00003A            $ffffff           Eword N               electrode = FF means end of table.
     $00003B - $FEFFFF                                          Available for table data             
     ------------------ X-table end ----------------------------------
    
     $FF0000 - $FFFFFF                                          Reserved. Don't touch.
    
    
    

    Driving SPRTBL

    Basic Operation

    The process begins with the High Level Software (HLS) loading the SPRTBL "in the usual way" via the serial port interface with Womera or a similar program. Once loaded and started, SPRTBL is idle until given a command to start, which for historical reasons is called "Y_RELOAD", or "RELOAD". The "usual way" of downloading the program is not covered here.

    During the idle time, the HLS is expected to load stimulus data into the SPEAR3's internal X and Y Memories. There are four separate regions of memory, two for each side. The X-Fixed and Y-Fixed sections (see the tables above) are stimulus parameters which do not change during the course of a "run", while the X-table and Y-table sections are the stimulus parameters which vary (can vary) between output pulses, and these sections are compressed/encoded. Here is an example of a table entry, copied from the Y-Memory Memory Map above:

     $00002C            $14C81E           Eword 0               |elect #A|  AMP    |elec #R |
     $00002D            $011000           Tword 0               |TTNP (Time Till Next Pulse)|
    
    Which is decoded as:
    The active electrode will be 14 hex, or 20 decimal,
    The amplitude of the active electrode will be C8 hex, or 200 decimal,
    The reference electrode will be 1E hex, or 30 decimal, and
    The time this pulse will be output is 011000 hex, or 69632

    When the stimulus has been loaded, the RELOAD command can be issued. The RELOAD command is a "1" written to location 0x000000 of X-Memory. The other (highest) 23 bits of this location are reserved for future use and should be written as zeros.

    Following this RELOAD command SPRTBL reads data from tables in internal X and Y memories and converts them to stimuli (sends commands to the encoders). Data in the X-Memory area is for the Right side output and data in the Y-Memory is for the Left side output. SPRTBL reads the X-Memory/Right side data table from the address given in the X_STptr variable until a stop code is reached. Likewise, SPRTBL reads the Y-Memory/Left side data table from the address given in the Y_STptr variable until a stop code is reached.
    After both the sides have stopped, SPRTBL needs another "RELOAD" to begin again. In a way then, SPRTBL is ballistic. There are no provisions for stopping it until it is done reading/converting/outputing.
    In order the output a purst of pulses,

    Since there is only one simple command, all the complexity is in creating (and writing) the data tables. In order to understand the form of these tables it is important to understand the data which the encoders need.

    The Stimulus Parameters

    There are two encoders which drive the cochlear implants, one per side. Only one will be discussed here. The implants accept information to control the following parameters:

  • SPRTBL internal operation