Protocol

Master-Slave Communication Protocol Explanation for the STHC, 40-bit wide (refer to FSM chart for bit to bit analysis)

Master to Slave:

Bits / Description / Values
B0-B1 / Start indicator / B0 and B1 must both be zero in order for the transmission to begin.
B2 / Tx/Rx bit / Must be 0 to indicate that the master is transmitting
B3-B10 / Slave ID number / Master gives an 8 bit number to the slaves to indicate which one is being contacted.
B11 / Error bit / 0=error has occurred, 1=no error. This bit reads ‘1’ if and only if the master did not appropriately receive the response of the slave. A request is made to resend the message.
B12 / Zone/type of error / No error: ‘1’: Zone 1 of HHC is initiated; ‘0’: Zone 2 is initiated
With error: ‘0’:chksum error ‘1’: last bit not received. In both cases the slave resends the message. (the rest of the bits serve as don’t cares if the error has occurred)
B13 / Read/Set / Read=’0’ Set=’1’
B14 / Temp/Heater State / ’1’= Read or set temp based upon b13; ‘0’= Read telemetry or set the heater state depending on b13.
B15 / Read what? / ‘1’=Read telemetry only (on/off state of 5 telemetry pins); ‘0’=Read both the telemetry state and the value of the temperature)
B16 / Vdd state(telemetry(tlm) pin) / Don’t cares
B17 / Bus voltage(tlm pin) / Don’t cares
B18 / Heater state (tlm pin) / Don’t cares
B19 / Thermistor (tlm pin) / Don’t cares
B20 / Transistor gate(telemetry pin) / Don’t cares
B21-B32 / Temp Value / -40C to 55C res=0.0232C. For a master’s transmission, these bits are only valid when the user wants to set the heater to a specific temperature. If the user wants to read the temp, these 12 bits serve as don’t cares.
B33-B38 / Checksum / Contains the number of ‘1’s that should be in the msg. This value is compared with a counter which counts the number of 1’s in the msg. If they are equal then the message is correct, otherwise the msg is discarded.
B39 / Stop bit / Must be ‘1’ or the message will be discarded.

Communication Protocol

Slave to Master

Bits / Description / Values
B0-B1 / Start indicator / B0 and B1 must both be zero in order for the transmission to begin.
B2 / Tx/Rx bit / Must be 1 when slave is transmitting
B3-B10 / Slave ID number / 00000000 to 11111111 (256) (The master receives the Slave ID number to indicate which slave is contacting it).
B11 / Error bit / 0=error has occurred, 1=no error. This bit reads ‘1’ if and only if the slave did not appropriately receive the request of the master. A request is made to resend the message.
B12 / Zone/type of error / No error: ‘1’: Zone 1 of HHC is initiated; ‘0’: Zone 2 is initiated
With error: ‘0’:chksum error ‘1’: last bit not received. In both cases the master resends the message. (the rest of the bits serve as don’t cares if the error has occurred)
B13 / Read/Set / 0: read was successful and the appropriate values can be found in the rest of the message.’1’: successful ‘set’ of desired things has been implemented. If bit 13=1; the rest of the message is don’t cares.
B14 / Temp/Heater State / Don’t cares
B15 / Read what? / Don’t cares
B16 / Vdd state(telemetry(tlm) pin) / ’1’= on; ’0’= off (slave is reporting back the state of the Vdd)
B17 / Bus voltage(tlm pin) / ’1’= on; ’0’= off (slave is reporting back the state of the bus voltage)
B18 / Heater state (tlm pin) / ’1’= on; ’0’= off (slave is reporting back the state of the heater)
B19 / Thermistor (tlm pin) / ’1’= on; ’0’= off (slave is reporting back the state of the thermistor)
B20 / Transistor gate(telemetry pin) / ’1’= on; ’0’= off (slave is reporting back the state of the gate voltage of the transistor) Note: bit 18 and bit 20 serve only as debugging issues. If bit 18 is ‘high’, than bit bit20 should also be high but if they are different than the user will know that the circuitry for the HHC is malfunctioning.
B21-B32 / Temp Value / -40C to 55C res=0.0232C (slave is reporting the temperature value if ‘read’ is initiated and giving the ‘set’ value inputted by the user)
B33-B38 / Checksum / Contains the number of ‘1’s that should be in the msg. This value is compared with a counter which counts the number of 1’s in the msg. If they are equal then the message is correct, otherwise the msg is discarded.
B39 / Stop bit / Must be ‘1’ or the message will be discarded.

Communication is bidirectional, but only the master or slave can communicate at any time (half-duplex). The master sends out requests to a slave and then waits for a response for 2ms. If it does not receive a response from the slave in the response time window that probably means there was an error so it resends the message to the slave and waits another 2ms for a response. The slave never sends to the master unless asked first. The master will continue to send messages out to the slave until it gets a response. However, if the master sends five consecutive messages to the slave and does not get a response than it assumes that the slave is not working.

In order to send a message, the master or slave first waits for a start indicator of 00. When the master or slave receive a start indicator than the master or slave store the next 38 bits into some registers. B39 is checked to make sure that it is set to ‘1’ which indicates a complete message was received. B2 indicates whether the Master is transmitting on the line or the slave. B3-B10 are checked to see if the message is intended for the slave of that ID number in the case of a transmit, or indicates the slave number that sent the message in the case of a receive.Next the checksum is checked. The numbers of ones in B2-B39 are added up and the integer value of the sum is compared against the integer value of the checksum. If the sums match then the signal is valid.

PC-to Master communication via SCI (4-12 bit transmissions)

The protocol from the PC interface to the Master DSP will be done over serial RS-232. It will consist of 4 transmissions of 12 bits each. Each transmission consists of a start bit, 8 bits of data, parity, and a stop bit. The GUI interface only sends out data in the ASCII format and Labview automatically converts the ASCII before it gets sent. The DSP recognizes it as CHAR and converts to values accordingly.

LabView to Master:

1st transmission

Bits / Description / Values
B0 / Start bit / Standard value for SCI protocol
B2-B9 / Data bits / Slave ID
B10 / Parity bit / Optional odd/even/no parity bit
B11 / Stop bit / Standard values for SCI protocol applied

2nd transmission

Bits / Description / Values
B0 / Start bit / Standard value for SCI protocol
B1 / Zone / ‘1’: Zone 1 of HHC is initiated; ‘0’: Zone 2 is initiated
B2 / Read/Set / Read=’0’ Set=’1’
B3 / Temp/Heater State / ’1’= Read or set temp based upon b2; ‘0’= Read telemetry or set the heater state depending on b2.
B4 / Read what? / ‘1’=Read telemetry only (on/off state of 5 telemetry pins); ‘0’=Read both the telemetry state and the value of the temperature)
B5-B9 / Temp bits / First 5 bits of temperature (note: the telemetry pins are don’t cares)
B10 / Parity bit / Optional odd/even/no parity bit
B11 / Stop bit / Standard values for SCI protocol applied

3rd transmission

Bits / Description / Values
B0 / Start bit / Standard value for SCI protocol
B2-B9 / Data bits / Last 7 bits of temperature (B9 is don’t care)
B10 / Parity bit / Optional odd/even/no parity bit
B11 / Stop bit / Standard values for SCI protocol applied

Note: there is no need to transmit the 6 Check sum bits because the SCI has a parity bit that ensures proper error checking. These bits will be added by the DSPs when they communicate with each other.

Master to LabView:

1st transmission

Bits / Description / Values
B0 / Start bit / Standard value for SCI protocol
B2-B9 / Data bits / Slave ID
B10 / Parity bit / Optional odd/even/no parity bit
B11 / Stop bit / Standard values for SCI protocol applied

2nd transmission

Bits / Description / Values
B0 / Start bit / Standard value for SCI protocol
B1 / Zone / ‘1’: Zone 1 of HHC is initiated; ‘0’: Zone 2 is initiated (which zone is being reported)
B2 / Read/Set / Read=’0’ Set=’1’ (If this bit is set, it means that the command to ‘set’ something by the user has been fulfilled and the rest of the message is ignored)
B3 / Temp/Heater State / ’1’= Read/set Temp;’0’= Read telemetry* (is the value of temp being read back or the state of the heater?)
B4 / Read what? / ‘1’=Read telemetry; ‘0’=Read both (telemetry/ temp) (what exactly is being sent back to the LabView, both the temp and telemetry or just the telemetry)
B5 / Vdd state(telemetry(tlm) pin) / ’1’= on; ’0’= off (slave is reporting back the state of the Vdd)
B6 / Bus voltage(tlm pin) / ’1’= on; ’0’= off (slave is reporting back the state of the bus voltage)
B7 / Heater state (tlm pin) / ’1’= on; ’0’= off (slave is reporting back the state of the heater)
B8 / Thermister (tlm pin) / ’1’= on; ’0’= off (slave is reporting back the state of the thermistor)
B9 / Transistor gate(telemetry pin) / ’1’= on; ’0’= off (slave is reporting back the state of the gate voltage of the transistor) Note: bit 18 and bit 20 serve only as debugging issues. If bit 18 is ‘high’, than bit bit20 should also be high but if they are different than the user will know that the circuitry for the HHC is malfunctioning.
B10 / Parity bit / Optional odd/even/no parity bit
B11 / Stop bit / Standard values for SCI protocol applied

3rd transmission

Bits / Description / Values
B0 / Start bit / Standard value for SCI protocol
B2-B9 / Data bits / First 8 bits of temperature
B10 / Parity bit / Optional odd/even/no parity bit
B11 / Stop bit / Standard values for SCI protocol applied

4th transmission

Bits / Description / Values
B0 / Start bit / Standard value for SCI protocol
B2-B9 / Data bits / Last 4 bits of temp; b6-b9= ‘don’t cares’
B10 / Parity bit / Optional odd/even/no parity bit
B11 / Stop bit / Standard values for SCI protocol applied

SCI programming for the DSP to receive and transmit to Labview.

The master DSP will be programmed to accept the data from the LabView interface. The protocol that is stated above will be implemented in the process. The output of this section will be a 40 bit protocol that will be transmitted to the PWM for transmitting to the slave over the power line. The flowchart for the programming structure is given below. Please note that after proper transmission of the message (from LabView to DSP), it will be decoded to interpret what the user is demanding. In order to do this, the code will follow the FSM flowchart that is attached with this package. The procedure to transmit back to the LabView interface will follow the same circular buffer logic. It will be in reverse order so the receive buffer will become the transmit and the transmit buffer will become receive. The new receive buffer will receive its data from the slaves through the power bus. After the ADC conversion back into ‘1’s and 0’s, the decode program will convert the 40 bit string into the standard 12 bit SCI protocol stated above in the “master to Labview” bit by bit configuration. The data that is sent back from the master will be outputted to an excel table that is programmed via labview. The user will have to ask each slave individually of what it requires from it. The user cannot contact multiple slaves at once because this would take a very large amount of computer power if using labview for the GUI to process and loop all the functions and power is very limited in space.

Figure 1 –Flow chart of the code

Figure 2-circular buffer diagram

Figure 2 above shows the circular buffer that will be used to store the data. It will have two pointers pointing to the index. PTR_IN is used for inputting data into the buffer and PTR_OUT is used for pushing or ‘popping’ data off the buffer. Another use for these pointers is that they can help prevent two errors from occuring. One is that the data is overwritten befor it is used. In order to prevent this, an error flag occurs everytime ptr_in equals ptr_out after the first increment of ptr_in. The second thing that has to be monitored is the size of prt_in and ptr_out to make sure that they do not exceed the BUF_SIZE. Once the PTR_OUT has ‘popped’ the data ptr_in can write to that index in the buffer, otherwise it cannot.

Figure3-Serial Communications Interface (SCI) Module Block Diagram

Figure 3 shows the register layout for the SCI module. The bottom half shows the Receive section and the top shows the transmit. For the receive function, an interrupt is detected on the SCIRXD pin and the data is transferred into SCIRXBUF register by setting pin 0 in the SCICTL 1 register. For transmitting, the data is read into the SCITXBUF and outputted to the SCITXD pin via the enabling of bit 1 in the SCICTL1 register.