SPI

SPI speicific utilities

SPI

Drive the switch’s SPI controller: initialise it, exchange bytes, or clean up. Sub-commands must be typed in full (any case); they cannot be abbreviated. An unknown sub-command prints Command NOT supported.

On some devices every form only prints spi command NOT supported here for this device, run it in the SDKLT diag shell instead. This may be the case on Trident 3.

Warning

Every form writes SPI controller registers, and the SPI bus may carry board devices. Do not use spi on a production switch.

SPI init [Mode=<0|1>] [FrameFormat=<0|1|2>] [CPOL=<0|1>] [CPHA=<0|1>] [Speed=<hz>] [Bitsperword=<n>] [LoopBack=<0|1>] [CsGpio=<n>]

Configure the SPI controller, then print Configure SPI: followed by mode, frame format, CPOL, CPHA, speed, word size and loop-back, and the CS GPIO if one is set. Options use the shell’s usual Key=<value> syntax and can be abbreviated (b=8 lb=1). Changes controller state.

Unvalidated

drivshell> spi init b=8 lb=1
SPI tx <data>

Send <data>, a byte string, and print the bytes sent under Send: and the bytes received under Receive:. Changes device state.

Unvalidated

drivshell> spi tx 12_3456789a
SPI clean

Release the SPI configuration. Changes controller state.

Unvalidated

drivshell> spi clean

Built-in help

Usages:
    Parameters: <sub_cmd> [sub cmd parameters]
    Initialize/cleanup SPI interface, or switch data between the master
    and the slave. The master should send 0s to receive remaining read
    data, if those can't be received in the write cycles. It will also
    receive 0s if no data is sent from the slave or the data is not ready
    for sending.
    Options:
       init - Initialize SPI interface
         Mode=<val> - 0: master, 1: slave
         FrameFormat=<val> - 0: Motorola SPI frame format.
                             1: TI synchronous serial frame format.
                             2: National Microwire frame format.
         CPOL=<val> - Clock polarity 0: low, 1: high
         CPHA=<val> - Clock phase:
              cpol=0, cpha=0: clock idle low, sample at raising edge
              cpol=0, cpha=1: clock idle low, sample at failing edge
              cpol=1, cpha=0: clock idle high, sample at failing edge
              cpol=1, cpha=1: clock idle high, sample at raising edge
         Speed=<val> - SPI interface speed (Hz)
         Bitsperword=<val> - SPI word sizen
         LoopBack=<val> - 0: disable, 1: enable
         CsGpio=<val>      - CS GPIO number, -1 means not use
              Example:
                spi init b=8 lb=1
       tx <data> - Send data
              Example:
                spi tx 12_3456789a
       clean - Cleanup SPI configuration