Project:HUGnet Packet Commands

From HUG Wiki

Jump to: navigation, search

Contents

Commands are one byte in length, with the top bit being reserved. Not all endpoints will respond to all commands, depending on their type.

Note: Not all commands are implemented in all devices.


Required Commands

These commands must be in every endpoint. If the command doesn't apply (i.e. Write Flash in a device that either doesn't have flash, or physically can't write to flash) then the endpoint must ignore the command or return a packet with a 'Bad Command' command.

0x01 Acknowledge

  • Required
  • Constant used: PACKET_REPLY_COMMAND
  • This is a reply packet.
  • The data sent will depend on the original command received.

0x02 Echo Request

  • Required
  • Constant used: PACKET_PING_COMMAND
  • This is a request for a node just to send a reply packet
  • The reply packet should be an Acknowledge with the same data as was sent

0x03 Echo Request

  • Required
  • Constant used: PACKET_FINDPING_COMMAND
  • This is a request for a node just to send a reply packet
  • The reply packet should be an Acknowledge with the same data as was sent

0x0A Read E2

  • Constant used: PACKET_READE2_COMMAND
  • Read the E2
  • Takes 3 Arguments in the form 0xALAHLE
    • 1 Byte AddressLow (AL)
    • 1 Byte AddressHigh (AH)
    • 1 Byte Length (LE)

0x0B Read SRAM

  • Constant used: PACKET_READSRAM_COMMAND
  • Read the SRAM
  • Takes 3 Arguments in the form 0xALAHLE
    • 1 Byte AddressLow (AL)
    • 1 Byte AddressHigh (AH)
    • 1 Byte Length (LE)

0x0C Read Flash

  • Constant used: PACKET_READFLASH_COMMAND
  • Read the SRAM
  • Takes 3 Arguments in the form 0xALAHLE
    • 1 Byte AddressLow (AL)
    • 1 Byte AddressHigh (AH)
    • 1 Byte Length (LE)

0x1A Write E2

  • Required on devices that have E2 to read
  • Constant used: PACKET_WRITEE2_COMMAND
  • Read the E2
  • Takes 3 Arguments in the form 0xALAHDDDDDDDD...
    • 1 Byte AddressLow (AL)
    • 1 Byte AddressHigh (AH)
    • n Bytes Data (DD)

0x1B Write SRAM

  • Constant used: PACKET_WRITESRAM_COMMAND
  • Read the SRAM
  • Takes 3 Arguments in the form 0xALAHDDDDDDDD...
    • 1 Byte AddressLow (AL)
    • 1 Byte AddressHigh (AH)
    • n Bytes Data (DD)

0x1C Write Flash

  • Constant used: PACKET_WRITEFLASH_COMMAND
  • Read the SRAM
  • Takes 3 Arguments in the form 0xALAHDDDDDDDD...
    • 1 Byte AddressLow (AL)
    • 1 Byte AddressHigh (AH)
    • n Bytes Data (DD)

0x4B Set Calibration

  • Constant used: PACKET_SETCALIBRATION_COMMAND
  • Required
  • Takes 2 arguments
    • 1 Byte: Input (0x00 being the start of the writable config)
    • n Bytes: Calibration to write. The size *MUST* match the configuration size.

0x4C Read Calibration

  • Constant used: PACKET_READCALIBRATION_COMMAND
  • Required
  • Returns the configuration. Calibration sizes vary, depending on the endpoint.

0x55 Read Sensors

  • Constant used: PACKET_READSENSORS_COMMAND
  • Read the sensors
  • No arguments

0x5B Set Config

  • Constant used: PACKET_SETCONFIG_COMMAND
  • Required
  • Takes 2 arguments
    • 1 Byte: Address (0x00 being the start of the writable config)
    • n Bytes: Configuration to write

0x5C Read Config

  • Constant used: PACKET_READCONFIG_COMMAND
  • Required
  • Returns the configuration. Config sizes vary, depending on the endpoint.

0x5D Reconfig

  • Constant used: PACKET_RECONFIG_COMMAND
  • Required
  • Sent when an endpoints configuration changes

Note: Always sent to address 000000


0x5E Powerup

  • Constant used: PACKET_POWERUP_COMMAND
  • Required
  • Sent when an endpoint first powers up.

Note: Always sent to address 000000


Optional Commands

0x5F Bored

  • Constant used: PACKET_BORED_COMMAND
  • Sent when an endpoint hasn't been talked to in too long. Always sent to address 000000

0xFF Bad Command

  • Constant used: PACKET_BAD_COMMAND
  • Sent when an endpoint gets a command it doesn't understand.

Device Specific Commands

0039-20-01-C

This is the application firmware for the Controller Board

0x09 Run Bootloader

  • Constant used: PACKET_RUNBOOTLOADER_COMMAND
  • Boot the bootloader

0x56 Read Downstream Endpoints

  • Constant used: PACKET_READDOWNSTREAMSN_COMMAND
  • Reads the downstream unit serial numbers

0x57 Read Packet Statistics

  • Constant used: PACKET_READPACKETSTATS_COMMAND
  • Reads the downstream unit serial numbers

0x60 HUGnet Power

  • Constant used: PACKET_HUGNETPOWER_COMMAND
  • No data sent
    • Reads the current power status
  • Data sent
    • First byte: HUGnet 0 power set
    • Second byte: HUGnet 1 power set

0039-20-06-C

This is the bootloader firmware for the Controller Board

0x06 Get CRC

  • Constant used: PACKET_GETCRC_COMMAND
  • Read the CRC for the application program.

0x07 Set CRC

  • Constant used: PACKET_SETCRC_COMMAND
  • Set the CRC for the application program

0x08 Boot Application Program

  • Constant used: PACKET_BOOT_COMMAND
  • Boot the application program

See Also