Protocol Definition between IHU and MPU ======================================= Introduction ------------ The two controllers use RS-232 with TTL-Levels to communicate with each other. In addition to the 2 Lines needed for RS-232 there are 2 extra connections between IHU and MPU. One is for the IHU to control the power of the MPU. Holding this pin low prevents the MPU from running and therefore keeps power consumption at a minimum also the whole payload electronic connected to the MPU has to be in powerdown when this PIN goes low. The second line is for reset. After a high to low transition the MPU has to perform a hardware reset. This also resets any payload hardware. Frames ------ The following chart shows a single frame which is used for communication Field-length: 1 1 1 LEN 1 +------+------+------+--------------+------+ Name | 0xAA | MSG | LEN | DATA | CS | +------+------+------+--------------+------+ Every message frame starts with 0xAA followed by a message code and the length of the following DATA field. The length field might be zero if the message doesn't need any additional data. The last byte of every frame contains a checksum. It is calculated by XORing every variable byte of the message. In a message N bytes long, where Byte 1 is the first and Byte N the last Byte, CS is calculated starting with Byte 1 (0xAA) and ending with Byte N-1 (last DATA Byte) The minimum frame length is 4 Bytes and the maximum is 260 Bytes. The bytes have to be sent LSB first. Multi-byte fields have to be sent in Little-Endian format. Messages -------- Messages are separated in request and responses. Requests use upper case letters and replies use lower case. 'A' - Activate Payload receiver (IHU -> IHU) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This command tells the MPU to activate the payload receiver and listen for incoming commands from ground stations. Expected response: 'a' 'C' - Cancel active and all pending commands (IHU -> IHU) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This command cancels all downlinḱ commands in terms of communication between the satellite and an ground station. Expected response: 'c' 'F' - Finish up (IHU -> MPU) ~~~~~~~~~~~~~~~ Sent by the IHU. This command tells the MPU that the IHU is planning to shut down the MPU after ?? ms. The MPU has to write pending flash pages and put payload hardware into deep sleep. After finishing everything up the MPU has to go into power down. This command doesn't send any data. Expected response: 'f' 'P' - Ping, Time and Power Budget (IHU -> MPU) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This command is sent by the IHU every minute (??) and contains the following data: 2Bytes Power Budget (see Power Management for details) 4Bytes Timestamp (seconds since EPOCH) Expected response: 'p' 'T' - Get Time (MPU -> IHU) ~~~~~~~~~~~~~~ This command requests the current time. Expected response: 't' 'V' - Config Value update (MPU -IHU) ~~~~~~~~~~~~~~~~~~~~~~~~~ Tell the IHU that the configuration values have been updated by a ground station. Config Values: - Beacon Interval in seconds (1 Byte) 'a' - Ack to activate receiver (MPU -> IHU) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Sent as an acknowledge to a received 'A' when the receiver is enabled. 'c' - Ack to cancel commands (MPU -> IHU) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Sent as an acknowledge to a received 'C' when all commands are canceled. 'f' - Ack to finish up (MPU -> IHU) ~~~~~~~~~~~~~~~~~~~~~~ Sent as an acknowledge to a received 'F'. 'p' - Ack to finish up (MPU -> IHU) ~~~~~~~~~~~~~~~~~~~~~~ Sent as an acknowledge to a received 'P'. 't' - Get Time (IHU -> MPU) ~~~~~~~~~~~~~~ Sends the current Timestamp after receiving a 'T' request. This message sends the 4 Byte Timestamp (seconds since EPOCH) as data. 'v' - Ack to config value change (IHU -> MPU) ~~~~~~~~~~~~~~~~~~~~~~~~~ Sent as an acknowledge to a received 'V' when the new configuraion is in place. Example Communication --------------------- IHU sends a Ping to MPU, telling it that the current power budget is 2424 units of power and the current time is 1305501574 seconds since epoch. The MPU acknowledges the message. IHU->MPU: 0xAA 'P' 0x06 0x09 0x78 0x4d 0xd0 0x5f 0x86 0xc9 MPU->IHU: 0xAA 'p' 0x00 0xda Power Management ---------------- FIXME Notes ----- EPOCH is the arbitrary point in time where Timestamp is 0x00000000. (depending on choice of RTC, probably 1970-01-01 00:00)