SPI Communications
Atlas® Digital Amplifier Complete Technical Reference
91
5
5.6.2
Error Processing
If the command checksum shown in
received by Atlas does not evaluate to 0xFF Atlas will return an SPI
Checksum Error and set the instruction error bit of the Event Status register.
In addition to such checksum errors the instruction error bit is set when an otherwise valid instruction or instruction
sequence is sent when the Atlas unit’s current operating state makes the instructions invalid, when an invalid opcode
is sent, or when the arguments to a command are invalid.
5.6.3
Sending Commands that Query Information
Figure 5-6:
Query
Command
Format
shows the overall return packet format for an Atlas command sent by the external controller that requests
information from Atlas.
Atlas returns a series of result words. The first such word contains a checksum byte such that the ones-complement
sum of 0xAA, the checksum itself, and all the data bytes returned by Atlas evaluates to 0xff. This checksum is correct
when the ones-complement sum of these bytes is 0xFF. This first result word also contains a signed 8-bit number
containing the number of result words to follow. If this number is negative, an error has occurred, and the instruction
error bit of the Event Status register is set.
Subsequent result words hold the actual data being returned by Atlas. For example if the command
GetOperatingMode
is sent, the first result word will contain an 8-bit checksum in the high byte and the number 1 in
the low byte indicating 1 data word to follow. The next result word will contain the actual 16-bit value of the operating
mode register.
During a read command, while the external controller is loading data from Atlas, it should write zeroes to the SPI
bus. Similarly, during a write command by the external controller Atlas loads zeroes in the return word. Therefore
it is recommended that the external processor check that these words have a zero. If not, this indicates that the
external controller has become out of synch with Atlas indicating a communication problem.
Controller word 0
0
Atlas word 0
checksum
result status
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Controller word 1
0
Atlas word 1
result word 0
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Controller word 2
0
Atlas word 2
result word 1
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Controller word 3
0
Atlas word 3
result word 2
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0