© Quantum Research Group Ltd.
In Master mode the sensor asserts control over this line, to Commands that return data do not send back a command
make the host a slave and to frame the data. This line
must idle high; the part includes an internal pullup resistor
and should be floated during idle times.
echo. If desired, the command can be verified via the 'l'
(lowercase L) echo function; see page 28.
The host should not transmit a new command until the
Internal pullup resistor note: The internal pullup resistor on last command has been processed and responded to
SS’ can range from 35k to 120k ohms. If RC filtering is used
on the SPI lines per Figure 4-5, this pullup resistance may not
be low enough to ensure adequate signal risetime and may
need to be augmented with external 10k pullups.
completion, plus 1ms.
Commands that are not recognized are ignored, and the host
should monitor for timeouts to detect these conditions. If this
occurs a new command should not be sent until the specified
timeout duration has expired.
A command may consist of one or two bytes with a m50µs
delay between bytes. At the end of a full command, the host
must go into Slave mode to await a response.
The maximum timings shown in Table 4-1 and Section 7-5
are guaranteed provided that the part is operating within the
timing limitations of Section 5.7. If burst timing is in violation,
the response time to a command may be longer.
The sensor may take some time to process the command
and respond. When it does, it asserts SS’ low and begins
clocking data out. For multi-byte responses, bytes will be sent
at intervals which may be irregular depending on the request
and the processing load of the sensor. The host must be
prepared to accept the sensor data as it comes or there can
be a data overrun in the host. If the data returns too quickly
for the host to accept it, lower the SPI clock rate.
4.6 Eeprom Corruption
The device stores its Setup data in an internal eeprom which
can be readily altered via Put mode commands. Sometimes
noise on Vdd, the SPI lines or Reset pin can cause eeprom
corruption which can be difficult or inconvenient to correct.
A typical Master-Slave function sequence is as follows:
The device should always be left in Get mode to prevent
spurious commands from corrupting the eeprom. The Get
command should ideally be repeated every second or so to
ensure that if noise on the SPI lines causes a false Put mode
command that it does not last long. Preferably, the ‘l’
command (lowercase ‘L’) should be used to verify that the Put
command has succeeded.
1) Host enters Master mode. The sensor is already in Slave
mode.
2) The host pulls SS’ low, then transfers one byte of
command to the sensor via MOSI, then releases SS’ to
float high again.
3) For 2-byte functions, (2) is repeated with m50µs spacings
between bytes.
Flash backup: The part backs up the entire eeprom array
into onboard Flash rom after one or more Setup write
4) The host immediately places its SPI port into Slave mode, commands have been issued and the part is then reset.
floating SCK and MOSI’; SS’ stays floating.
During normal operation the part constantly compares the
Flash area with the eeprom array to ensure the two sections
match. If an eeprom error is detected, the device sets an
error flag (bit 4) in the general device status byte (Command
‘7’, page 22) which can be read by the host device. The LED
output also becomes active. If the bit 4 error flag is set, the
host should immediately induce a device reset.
5) When the sensor has a command echo or data to send
back, it puts its SPI register in Master mode, taking control
over MOSI and SCK. SS' remains floating.
6) The sensor pulls SS’ low, then clocks out its response
byte to the host, then floats SS’ high again.
7) The sensor repeats (6) as necessary for multiple byte
responses.
Bit 4 is also set if an intentional write has been made to
eeprom, but not yet copied into Flash via the reset process. It
is perfectly acceptable to continue altering any number of
Setup parameters prior to doing the reset, ignoring this bit.
8) The sensor returns to slave mode.
After the transmission sequence, the SPI lines float high or
are left to float in an indeterminate state (MOSI) until the next
transmission sequence is initiated by the host. The host
should wait for m1ms after a sequence before initiating
another transmission sequence.
During power up or after a reset, the device compares the
Flash area with eeprom, and if there is a discrepancy the
eeprom is refreshed from Flash, unless an intentional write
was detected in which case the Flash is updated from the
eeprom. As intentional writes in Put mode should only occur
during manufacture, it is normally safe to assume that
eeprom changes during normal run mode are errors.
See Section 3.18, page 15, for a description of the Alert pin
which can be used to reduce communication traffic.
The host can also periodically test the checksum of the
eeprom as a backup mechanism to the bit 4 error flag.
4.5 Sensor Echo and Data Response
The devices respond to each and every valid command from
the host with at least one return byte. In the case of functions
that do not send data back to the host, the part returns the
command itself as an echo, but only after the function has
been completed; this also holds for 2-byte functions where
the second byte is an operand: in these cases the return byte
is an echo of the command, not the operand.
The uppercase ‘L’ command, Lock Reference Levels, also
writes data to eeprom, and this data also has the potential to
become corrupted. This data is also backed up in Flash so
that it can be recovered, and an error in this data will also set
bit 4 and also alter the checksum. Also, the ‘L’ command only
operates if the device is in Put mode as a further protection.
Flash rom has a limit of 1,000 write cycles, so copy-to-Flash
should not be used routinely.
Exception: The recalibration command ‘b’ returns an
acknowledgement immediately rather than just before the
actual recalibration.
lQ
19
www.qprox.com QT60xx5B / R1.06