Epics@GSI Webhome

HadCon Multipurpose Controls Protocol Cmnd Spi

Introduction

Command descriptions of command SPI

 

SPI

    General Operation

    The SPI command set allows to operate the SPI interface of the HadCon's μController as a master.

    It sends data in atomic chunks of bytes via the MOSI pin to slave devices and receives via the MISO pin the responses. This happens in a buffered mode, so that multiple bytes can be send and received at once.
    The current limitation of the write-buffer is linked to the input string buffer of 140 characters, i.e. ≈ 60 bytes.

    Up to 8 Chip-Select output pin(s) can be manipulated either

    The received data is stored in a read buffer which is of the same size as the write buffer. The purging of the buffers depend on the mode of operation and the configuration settings.

      Basic Operation

        All necessary steps are taken automatically, optional behavior can be achieved by changing the configuration.

        Example task:
        SPI write dc 7f 8f8fb4 0123456789abcdef be
        equivalent to
        SPI dc 7f 8f8fb4 0123456789abcdef be

        NOTE: only even number of digits per argument are allowed

        This write command includes the following steps:
        1. optionally purging the read buffer
        2. purging the write buffer
        3. filling the write buffer by decomposing input byte by byte
          dc 7f 8f 8f b4 01 23 45 67 89 ab cd ef be
        4. set cs
          • setting the defined chip-select pin(s) to "active low"
            • optionally masked by an external mask
        5. transmit/receive byte by byte in the given byte-order
          • transmit write buffer content
          • attaching received bytes to the end of the read buffer
        6. release cs
          • release the defined chip-select pins(s) to "passive high"
            • optionally masked by an external mask
        7. optionally purge write buffer

        The read buffer content can be shown as follows:
        • last read element
          SPI read
        • last read 3 elements
          SPI show_read_buffer 3 1
        • first read 6 elements
          SPI show_read_buffer 6
        • the full content
SPI show_read_buffer

    Advanced Operation

      The user can prepare step by step the write buffer before sending it.

      Example:
      SPI write dc 7f 8f8fb4 0123456789abcdef be


    Expert Operation



    Main Commands

      SPI
        Format
        Format
        • SPI <list of data bytes|words|dwords|qwords>

      SPI w/write

        Task
        Format
        • SPI write <list of data bytes|words|dwords|qwords>
        • SPI w     <list of data bytes|words|dwords|qwords>
        Response
        • nothing
        • if DEBG > 0
          RECV SPI write OK
        Description
        Arguments
        • -
        Comments
        • -

      SPI a/add

        Task
        Format
        • SPI add <list of data bytes|words|dwords|qwords>
        • SPI a   <list of data bytes|words|dwords|qwords>
        Response
        • nothing
        • if DEBG > 0
          RECV SPI add OK
        Description
        • Arguments:
          • -
        Comments
        • -

      SPI wb/write_buffer

        Task
        Format
        • SPI write_buffer
        • SPI wb
        Response
        RECV SPI write_buffer
        Description
        Arguments
        • -
        Comments
        • -

      SPI t/transmit

        Task
        Format
        • SPI transmit
        • SPI t
        Response
        • nothing
        • if DEBG > 0
          RECV SPI transmit OK
        Description
        Arguments
        • -
        Comments
        • -

      SPI css/cs_set

        Task
        Format
        • SPI cs_set
        • SPI css
        Response
        RECV SPI cs_set
        Description
        Arguments
        • -
        Comments
        • -

      SPI csr/cs_release

        Task
        Format
        • SPI cs_release
        • SPI csr
        Response
        RECV SPI cs_release
        Description
        Arguments
        • -
        Comments
        • -

      SPI r/read

        Task
        Format
        • SPI read
        • SPI r
        Response
        RECV SPI read
        Description
        Arguments
        • -
        Comments
        • -

      SPI sw/show_write_buffer

        Task
        Format
        • SPI show_write_buffer
        • SPI sw
        Response
        RECV SPI show_write_buffer
        Description
        Arguments
        • -
        Comments
        • -

      SPI sr/show_read_buffer

        Task
        Format
        • SPI show_read_buffer
        • SPI sr
        Response
        RECV SPI show_read_buffer
        Description
        Arguments
        • -
        Comments
        • -


    Clean-up

      SPI p/purge

        Task
        Format
        • SPI purge
        • SPI p
        Response
        • nothing
        • if DEBG > 0
          RECV SPI purge OK
        Description
        Arguments
        • -
        Comments
        • -

      SPI pw/purge_write_buffer

        Task
        Format
        • SPI purge_write_buffer
        • SPI pw
        Response
        • nothing
        • if DEBG > 0
          RECV SPI purge_write_buffer OK
        Description
        Arguments
        • -
        Comments
        • -

      SPI pr/purge_read_buffer

        Task
        Format
        • SPI purge_read_buffer
        • SPI pr
        Response
        • nothing
        • if DEBG > 0
          RECV SPI purge_read_buffer OK
        Description
        Arguments
        • -
        Comments
        • -

      SPI reset

        Task
        Format
        • SPI reset
        Response
        • nothing
        • if DEBG > 0
          RECV SPI reset OK
        Description
        Arguments
        • -
        Comments
        • -


    Status

      SPI s/status

        Task
        Show status
        Format
        • SPI status
        • SPI s
        • SPI
        Response
        RECV SPI status
        RECV SPI cs 1:0 2:- 3:- 4:- 5:- 6:- 7:- 8:-
        RECV SPI cs_bar 1:1 2:- 3:- 4:- 5:- 6:- 7:- 8:-
        RECV SPI cs_pins 1:PORTB,0
        RECV SPI cs_select_mask FF
        RECV SPI control_bits 50
        RECV SPI spi_enable 1
        RECV SPI data_order 0
        RECV SPI master 1
        RECV SPI clock_polarity 0
        RECV SPI clock_phase 0
        RECV SPI speed 0
        RECV SPI double_speed 0
        RECV SPI speed_divider 4 (2500000Hz @ 10000000Hz)
        RECV SPI transmit_byte_order 0 (MSB/big endian)
        RECV SPI transmit_report FALSE
        RECV SPI auto_purge_read_buffer TRUE
        RECV SPI auto_purge_write_buffer FALSE
        RECV SPI show_write_buffer elements: 0xd (13)
        RECV SPI show_write_buffer (#1) AB BB AA BB CC EE FF 66 ...
        RECV SPI show_write_buffer (#2) 54 12 45 54 58
        RECV SPI show_read_buffer elements: 0 (0)
        Description
        • recursive call of all available status information
        Arguments
        • -
        Comments
        • -

      SPI cs

        Task
        Format
        • SPI cs
        Response
        RECV SPI cs
        Description
        Arguments
        • -
        Comments
        • -

      SPI csb/cs_bar

        Task
        Format
        • SPI cs_bar
        • SPI csb
        Response
        RECV SPI cs_bar
        Description
        Arguments
        • -
        Comments
        • -


    Chip Select Configuration

      SPI cs_select_mask

        Task
        Format
        • SPI cs_select_mask
        Response
        RECV SPI cs_select_mask
        Description
        Arguments
        • -
        Comments
        • -

      SPI cs_pins

        Task
        Format
        • SPI cs_pins
        Response
        RECV SPI cs_pins
        Description
        Arguments
        • -
        Comments
        • -

      SPI csap/cs_add_pin

        Task
        Format
        • SPI cs_add_pin
        • SPI csap
        Response
        RECV SPI cs_add_pin
        Description
        Arguments
        • -
        Comments
        • -

      SPI csrp/cs_remove_pin

        Task
        Format
        • SPI cs_remove_pin
        • SPI csrp
        Response
        RECV SPI cs_remove_pin
        Description
        Arguments
        • -
        Comments
        • -


    SPI Configuration

      SPI c/control_bits

        Task
        Format
        • SPI control_bits
        • SPI c
        Response
        RECV SPI control_bits
        Description
        Arguments
        • -
        Comments
        • -

      SPI spi_enable

        Task
        Format
        • SPI spi_enable
        Response
        RECV SPI spi_enable
        Description
        Arguments
        • -
        Comments
        • -

      SPI data_order

        Task
        Format
        • SPI data_order
        Response
        RECV SPI data_order
        Description
        Arguments
        • -
        Comments
        • -

      SPI master

        Task
        Format
        • SPI master
        Response
        RECV SPI master
        Description
        Arguments
        • -
        Comments
        • -

      SPI clock_polarity

        Task
        Format
        • SPI clock_polarity
        Response
        RECV SPI clock_polarity
        Description
        Arguments
        • -
        Comments
        • -

      SPI clock_phase

        Task
        Format
        • SPI clock_phase
        Response
        RECV SPI clock_phase
        Description
        Arguments
        • -
        Comments
        • -

      SPI speed

        Task
        Format
        • SPI speed
        Response
        RECV SPI speed
        Description
        Arguments
        • -
        Comments
        • -

      SPI speed_divider

        Task
        Format
        • SPI speed_divider
        Response
        RECV SPI speed_divider
        Description
        Arguments
        • -
        Comments
        • -

      SPI double_speed

        Task
        Format
        • SPI double_speed
        Response
        RECV SPI double_speed
        Description
        Arguments
        • -
        Comments
        • -


    API Configuration

      SPI transmit_byte_order

        Task
        Format
        • SPI transmit_byte_order
        Response
        RECV SPI transmit_byte_order
        Description
        Arguments
        • -
        Comments
        • -

      SPI transmit_report

        Task
        Format
        • SPI transmit_report
        Response
        RECV SPI transmit_report
        Description
        Arguments
        • -
        Comments
        • -

      SPI auto_purge_write_buffer

        Task
        Format
        • SPI auto_purge_write_buffer
        Response
        RECV SPI auto_purge_write_buffer
        Description
        Arguments
        • -
        Comments
        • -

      SPI auto_purge_read_buffer

        Task
        Format
        • SPI auto_purge_read_buffer
        Response
        RECV SPI auto_purge_read_buffer
        Description
        Arguments
        • -
        Comments
        • -


-- PeterZumbruch - 10 Jul 2013

This topic: Epics > WebHome > EpicsProjectsAndActivities > HardwarePlatforms > HadCon2 > HadCon2MultipurposeControlsApi > HadConMultipurposeControlsProtocol > HadConMultipurposeControlsProtocolCmndSpi
Topic revision: revision 4
 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding GSI Wiki? Send feedback
Imprint (in German)
Privacy Policy (in German)