Epics@GSI Webhome

HadCon2 - Protocol

 

Protocol

General

    CPU → μController
    The communication consists of short command keywords, e.g. HELP, SEND, SPI, etc, followed by (optional) arguments or sub commands

    Structure
    <Keyword, 3-5 letters, (capital letters)> <Message>

    • NOTE: from version 4.6.1 on all command keywords are case insensitive
    • string termination (automatically) by <LF> or <CR>

    μController → CPU

    The following answers can occur
    • RECV followed by the sent command keyword and the 'result'
    • nothing, usually send actions
      • can be made more verbose by increasing the debug level via DEBG <debug level>, <debug level> > 0
        • RECV <literal acknowledge>*
    • ERRx in case of an error
      • ERRx <Error number> <Error description>
      • ERRx <Error number> <Error description> *** "<Additional Information>"
      • ERRx "<Command>" <Error number> <Error description>
      • ERRx "<Command>" <Error number> <Error description> *** "<Additional Information>"
      • where 'x' can be
        • G : global errors
        • A : api errors, e.g. typos, wrong arguments, inputs, syntax, out of limits, etc.
        • C : CAN related global errors
        • M : CAN related message box errors
        • T : I²C errors, Two-Wire-Interface
        • U : undefined

HELP



    $ HELP : will give an overview list of available commands, e.g. :
        RECV HELP --- available commands are:
        RECV HELP --- SEND : send can message
        RECV HELP ---           SEND CAN-ID ID-Range [RTR <nBytes> D0 .. D7]
        RECV HELP --- SUBS : unsubscribe can id/mask
        RECV HELP ---           SUBS CAN-ID ID-Range
        RECV HELP --- USUB : unsubscribe can id/mask
        RECV HELP ---           USUB CAN-ID ID-Range
        RECV HELP --- RGWR : write register
        RECV HELP ---           RGWR <Register> <Value>
        RECV HELP --- RGRE : read register
        RECV HELP ---           RGRE <Register>
        RECV HELP --- RADC : AVR ADCs
        RECV HELP ---           RADC [<ADC Channel>]
        RECV HELP --- OWAD : 1-wire ADC
        RECV HELP ---           OWAD [ID [flag_conv [flag_init]]]
        RECV HELP --- OWDS : 1-wire double switch
        RECV HELP ---           OWDS [ID]
        RECV HELP --- INIT : (re)init of system
        RECV HELP --- OWLS : 1-wire list devices
        RECV HELP ---           OWLS [<Family Code>]
        RECV HELP --- OWSS : 1-wire single switch ([ID] not implemented)
        RECV HELP ---           OWSS [ID]
        RECV HELP --- RSET : reset via watchdog
        RECV HELP --- PING : 
        RECV HELP --- OWTP : 1-wire temperature
        RECV HELP ---           OWTP [ID [flag_conv [flag_init]]
        RECV HELP ---           OWTP <command_keyword> [arguments]]
        RECV HELP --- OWSP : one-wire set active pins/bus mask
        RECV HELP ---           OWSP <bus mask>
        RECV HELP --- CANT : CAN send message
        RECV HELP ---           CANT CAN-ID ID-Range [RTR <nBytes> D0 .. D7]
        RECV HELP --- CANS : CAN subscribe
        RECV HELP ---           CANS CAN-ID ID-Range
        RECV HELP --- CANU : CAN unsubscribe
        RECV HELP ---           CANU CAN-ID ID-Range
        RECV HELP --- DBGL : set/get debug level
        RECV HELP ---           DBGL [level]
        RECV HELP --- DBGM : set/get debug system mask
        RECV HELP ---           DBGM [mask]
        RECV HELP --- JTAG : set/get JTAG availability, switch off/enable 4 more ADC channels
        RECV HELP ---           JTAG [0|1]
        RECV HELP --- HELP : help
        RECV HELP ---           HELP [CMND]
        RECV HELP ---           HELP <mode>
        RECV HELP --- OWRP : 1-wire read active pins/bus mask
        RECV HELP --- DEBG : set/get debug level and mask
        RECV HELP ---           DEBG [level [mask]]
        RECV HELP --- PARA : parasitic device presence test
        RECV HELP --- SHOW : show (internal) settings
        RECV HELP ---           SHOW [key_word]
        RECV HELP --- OWSA : 1-wire API settings
        RECV HELP ---           OWSA <command_key_word> [arguments] 
        RECV HELP --- TWIS : I2C access
        RECV HELP ---           TWIS <0|1> <I2C address> <data length> <byte1 ... byte8>
        RECV HELP --- I2C  : I2C access
        RECV HELP ---           I2C <0|1> <I2C address> <data length> <byte1 ... byte8>
        RECV HELP --- RLTH : relay threshold
        RECV HELP ---           RLTH [command_key_word] <value>
        RECV HELP --- SPI  : experimental SPI master (slave)
        RECV HELP ---           SPI [data]
        RECV HELP ---           SPI <cmd> <arguments>
        RECV HELP --- GNWR : waveform generator write data
        RECV HELP ---           GNWR <address> <data>
        RECV HELP --- GNRE : waveform generator read data
        RECV HELP ---           GNRE <address>
        RECV HELP --- OW8S : 1-wire octal switches
        RECV HELP ---           OW8S [ID [value]]
        RECV HELP --- VERS : code version
    

    A more detailed command description you'll get by using the command:
    HELP <command>

-- PeterZumbruch - 2020-11-09 - 12:09

CAN



      Keyword Action Format Description Comments
      SEND
      CANT
      Send CAN Message SEND <CAN Message-ID> <ID-Range> [<RTR> <Length> <Data0 ... Data7>]
      CANT <CAN Message-ID> <ID-Range> [<RTR> <Length> <Data0 ... Data7>]

      response:
      RECV <MOB-number> <CAN Message-ID> <ID-Range> [<RTR> <Length> <Data0 ... Data7>]

      future response:
      RECV <CAN Message-ID> <ID-Range> [<RTR> <Length> <Data0 ... Data7>]
      Message-ID: CAN Message Identifier (hex)
      ID-Range: used as mask on Message IDs (hex)
      RTR: sets Remote Transmission Request Mode
      Length: number of data bytes to send (max: 8)
      Data 0...7: 0 to 8 data bytes (hex) MOB-number: index of receiving MOB (Message Object Blocks) in CAN controller
       
      SUBS
      CANS
      Subscribe to Message-IDs SUBS <CAN Message-ID> <ID-Range>
      CANS <CAN Message-ID> <ID-Range>

      response:
      nothing
      Subscribe to react on (a range of) CAN Messages
      Message-ID: CAN Message Identifier (hex)
      ID-Range: used as mask on Message IDs (hex)
      TODO: look to code, has to be clarified
      USUB
      CANU
      Unsubscribe from Message-IDs USUB <CAN Message-ID> <ID-Range>
      CANU <CAN Message-ID> <ID-Range>

      response:
      nothing
      Unsubscribe from reacting on (a range of) CAN Messages
      Message-ID: CAN Message Identifier (hex)
      ID-Range: used as mask on Message IDs (hex)
      TODO: look to code, has to be clarified
      CAN CAN commands CAN <sub command> [ <arguments>> ... ]

      response:
      ...
      Replacing above commands by sub commoands TODO:

-- PeterZumbruch - 2020-11-09 - 12:08

SPI

-- PeterZumbruch - 2020-11-09 - 12:15

DAC



      Availablity
      available since version: 4.6.3
      Channel numbers
      The Channel numbers 0..7 follow the signal naming (DACOUTx, q.v. HadCon2/DAC) and are therefore shifted by -1 compared to the connector pin numeration from pin 1 to pin 8. The remaining pin 9 and 10 are ground. (q.v. connector assignment)
      Commands

      1. DAC : return all DACs value
      2. DAC <CHANNEL> : return current DAC value
        • <CHANNEL>: 0 - 7
      3. DAC: <CHANNEL> <VALUE_mV> : set current DAC output to (approx.) wanted voltage
        • <CHANNEL>: 0 - 7
        • <VALUE_mV> - 0 - 3300 mV
          • alert: The actual resulting value might differ, due to the 8bit conversion binning of 3300mV / 255 ≈ 12,94 mV


      Output
        The output is the same for all commands:
        RECV DAC <CHANNEL> <VALUE_mV> <VALUE_HEX> [undefined]
        with
        • <CHANNEL> : 0 - 7
        • <VALUE_mV> : 0 - 3300 mV, undefined → -1
        • <VALUE_HEX> : 0x00 - 0xFF, undefined → 0x100
        • undefined: since there is no readback, values are undefined until a value is set,
          • exception: after a power up, channels are set to 0V.
        In case you are using the command DAC , you will get the above for each channel from 0 to 7 in a separate line.



-- PeterZumbruch - 2020-11-09 - 12:16

RGRE

-- PeterZumbruch - 2020-11-09 - 12:05

RGWR



    Form:

    RGWR <Register> <Value>

    <Register> : the register address has to be written in hexadecimal

    <Value> : here has to be written the new register value in hexadecimal


    Example command:
    ( toggling LEDs, by writing 1 to the PING0-PING5 registers while DDRG are set to outputs )
    send: RGRE 32
    (e.g.:)
    receive: RECV RGRE 32 1c (11100)
    send: RGWR 32 7
    receive: RECV RGWR 7: value 1b has been written and readback does not match (1b)
    (since PINs are outputs)
    send: RGRE 32
    receinve: RECV RGRE 32 1b

-- PeterZumbruch - 2020-11-09 - 12:06

I2C



    Form:
    I2C <0|1> <I2C address> <data length> <byte1 ... byte8>

    <0|1> : used to execute write or read operation. This is the Least Significant Bit (LSB) from the I2C address byte.

    <I2C address> : Here has to be written the hexadecimal value on the address byte, which is shifted to right with one bit. The reason for the right shift is because, the lsb bit ist already used in the first field, where the working operation is choosen.

    <data length> : data length

    <byte1 ... byte8> : data

    Example command:
    send: I2C 0 70 1 08
    receive: RECV I2C 0 70 01 08 -OK-

-- PeterZumbruch - 2021-03-15 - 17:49



APFEL

-- PeterZumbruch - 2015-07-09

-- PeterZumbruch - 2013-07-17


-- PeterZumbruch - 19 Feb 2016
Topic revision: r5 - 2016-02-19, PeterZumbruch - This page was cached on 2024-11-01 - 01:35.

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 | Legal notice | Privacy Policy (german)