Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

Latest commit

 

History

History
209 lines (193 loc) · 7.55 KB

SPI.md

File metadata and controls

209 lines (193 loc) · 7.55 KB

SPI Bus

This version is outdated, better check the version here

Interface

The AC is the SPI master and the ESP8266 is the SPI slave. MHI uses the signals SCK, MOSI, MISO. A slave select signal is not supported.

Name Function input/output
SCK serial clock Clock output for AC, input for ESP8266
MOSI Master Out, Slave In Data output for MHI, input for ESP8266
MISO Master In, Slave Out Input for MHI, output for ESP8266

Protocol

Clock polarity: CPOL=1 => clock idles at 1, and each cycle consists of a pulse of 0 Clock timing: CPHA=1 => data is captures with the rising clock edge, data changes with the falling edge

Timing

A byte consists of 8 bits. SCK has a frequency of 32kHz. One bit takes 31.25µs, so one byte takes 8x31.25µs=250µs. There is a pause of 250µs between two bytes. A frame consists of 20 bytes. A frame consumes 20x2x250µs=10ms. Between 2 frames is a pause of 40ms. So 20 frames per second will be transmitted. The following oscilloscope screenshot shows 3 bytes: SPI timing

Yellow: SCK; Purple: MOSI

SPI Frame

A frame starts with three signature bytes, followed by 15 data bytes and 2 bytes for a checksum. The following table shows the content of a frame.

Signature

The MOSI signature bytes indicate the start of a frame with the 3 bytes 0x6c, 0x80, 0x04. For MISO seems to be more than one signature, usually it is 0xa9, 0x00, 0x07.

Data

The following clauses describe the MOSI decoding for power, mode, fan, vanes, temperature setpoint and the room temperature

Power

Power status is coded in MOSI data byte 0 (bit 0).

data byte 0 Function
Bit 0 Power
0 off
1 on

Mode

The mode is coded in MOSI data byte 0 (bit 4 ... 2).

data byte 0 Function
bit 4 bit 3 bit 2 Mode
0 0 0 Auto
0 0 1 Dry
0 1 0 Cool
0 1 1 Fan
1 0 0 Heat

Fan

The fan level is coded in MOSI data byte 1 bit [1:0] and in data byte 6 (bit 6).

data byte 1 data byte 6 Function
bit 1 bit 0 bit 6 Fan
0 0 0 1
0 1 0 2
1 0 0 3
x x 1 4

Vanes

The vanes up/down level is coded in MOSI data byte 1 bit [5:4] and in data byte 0 (bit 6).

data byte 1 data byte 0 Function
bit 5 bit 4 bit 6 Vanes (up/down)
0 0 0 1
0 1 0 2
1 0 0 3
1 1 0 4
x x 1 swing
Vanes status is not updated when using IR remote control!

Room temperature

The room temperature is coded in MOSI data byte 3, bit [7:0] according to the formula T[°C]=(db3[7:0]-61)/4 The resolution is 0.25°C. But for displaying the room temperature you shouldn't use this resolution to prevent displaying the toggling of the least significant bit.

Temperature setpoint

The temperature setpoint is coded in MOSI data byte 2, bit [6:0] according to the formula T[°C]=db2[6:0]/2 The resolution of 0.5°C is supported by the wired remote control RC-E5. The IR remote control supports a resolution of 1°C only.

Checksum

The checksum is calculated by the sum of the signature bytes plus the databytes. The low byte of the checksum is stored at byte position 18 and the low byte of the checksum is stored at byte position 19. Maximum value of the checksum is 0x0fe1. Therefore bit [7:4] of the checksum high byte is always 0.

Variants

The following chapter is in draft status! Different variants are possible when a remote control is connected via SPI. The MISO frame (data from RC to MHI-AC) requests data. The variant of the data is identified via MISO-db9. MHI-AC answers with the same value in MOSI-db9 (but only when bit2 of MISO-db14 is set).

The following screenshot shows some SPI traffic: MISO MOSI traffic

In the marked row MISO-db9=0x80 and bit2 of MISO-db14 is set, so variant 0 is selected. MOSI-db9=0x80 and MOSI-db11 represents the outdoor temperature

data byte 9 Variant description
0xff default default when no SPI RC is connected or no 'special' data are requested
0x80 0 db10=?, Outdoor temperature: T[°C]=(db11[7:0]-94)/4 (formula is not finally confirmed)
0x32 1 db10=?, db11=?
0xf1 2 db10=?, db11=?
0xd2 3 db10=?, db11=?, only seen once during heating

note: the numbering of the variants 0..2 is reused from rjdekker's code here