Accessing the raw bus
As for the USB and I2C buses, the SPI bus supports the raw access in order to directly send and receive messages from the SPI slaves, so it's time to show you an example on how we can do it on our BeagleBone Black.
We are going to manage a really simple device: the thermocouple to digital converter, as shown in the following image:
Note
The device can be purchased at (or by surfing the Internet) http://www.cosino.io/product/thermocouple-max31855.
By looking at the chip's datasheet at the URL http://datasheets.maximintegrated.com/en/ds/MAX31855.pdf, we can see that its functioning is very simple: it has one 32-bit register, where we can read the temperature information. The register has the following format:
14-bit thermocouple data |
Res |
Fault |
12-bit internal temperature |
Res |
SCV |
SCG |
OC | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
D31 |
D30 |
... |
D18 |
D17 |
D16 |
D15 |
D14 |
... |
D4 |
D3 |
D2 |
D1 |
D0 |
Sign |
MSB |
X |
LSB |
- |
X |
X |
MSB |
X |
LSB |
- |
X |
X |
X |
So, in order to read the temperature data, we have to...