beautypg.com

Spi code examples, Rm3100 eval board cycle count register read, 2 spi code examples – PNI CommBoard User Manual

Page 16

background image

PNI Sensor Corporation

DOC#1018122 r02

PNI CommBoard User Manual

Page 14

Z or z

– Clock Rate

At power-up the SPI clock rate is set to 100 kHz. Sending “Z” changes the clock rate
to 1 MHz, while sending “z” changes it to 50 kHz. Rebooting the system will reset
the clock rate to 100 kHz.

T or t

– Terminal Mode

“T” turns on verbose terminal mode. “t” turns off terminal mode. The default is “t”.

In terminal mode “T” all characters sent to the CommBoard will be echoed back to
the host and sending the “?” command will return explanatory text.

5.2 SPI Code Examples

Some additional SPI code examples are given below. The examples are with the
CommBoard operating in hexadecimal (“X”) and non-terminal (“t”) modes, which are the
defaults at power-up. There are multiple ways to perform the same function and, for

illustration purposes, two RM3100 Eval Board alternative read examples are given next.

5.2.1

RM3100 Eval Board Cycle Count Register Read

The following two examples demonstrate slightly different methods to read the cycle

count register of the 3100 Evaluation Board. The examples provide the same

information: the purpose is to show alternative ways to construct the sentence to format.

For both cases, activity on the SPI lines is shown below in Figure 5-1.

Notes:

1. The value 0x00 is automatically produced on the MISO line on the first 8 clock cycles after

SSN is taken low. This acknowledges the RM3100 Eval Board is operational.

2. Because CPHA = 0 is assumed (default), the first bit of the next register in the series is

present at this time and is shown here for completeness.

Figure 5-1: SPI Activity for RM3100 Cycle Count Register Read