The Blackboard contains an LSM9DS1 inertial module from ST Microelectronics. The LSM9DS1 contains a 3D accelerometer to sense linear acceleration, a 3D gyroscope to sense angular rate of change, and a 3D magnetometer to sense magnetic field strength, all in the same small package. Inertial modules are used to sense orientation and position, movement, rates of change, and relative position in many applications like drones, robotics, gimbals, and other moving devices.
The LSM9DS1 module can communicate with ZYNQ using an SPI or I2C bus (both are connected, but they cannot be used simultaneously because they share pins). The device has two SPI ports, with seperate SS and MISO signals but shared SCLK and MOSI signals. One SPI port is used for the ACC/Gyro, and the second port for the magnetometer.
The SPI SCLK on the LSM9DS1 can operate at up to 10MHz, which allows an SPI data rate of about 1.5MBytes per second. The I2C bus uses a max clock rate of 400KHz, and can achieve a data rate of about 20KBytes per second (less than 2% of the SPI bandwidth).
The LSM9DS1 uses 75 control, status and data registers (23 for the magnetometer and 52 for the ACC/Gyro). Descriptions of the register functions and bit fields are available in the BBPR or in the LSM9DS1 data sheet. Each writeable register uses a 7-bit address and 8 data bits. The readable sensor data registers return 16 bits. To read or write any register, 16 bits must be shifted in to MOSI (and therefore out of MISO), using a clock with CPOL= 1 and CPHA = 1.
To do an ACC/Gyro write, the ACC/Gyro SS signal must be asserted, and 16 bits must be shifted out: bit0 = 0 to select a write operation; seven bits of address (see the register tables in the LSM9DS1 data sheet or in the BBPR); and eight bits of data to be written. To do an ACC/Gyro read, the 16 bits sent are: bit0 = 1 to select a read operation; seven bits of address; and eight bits of 0x00.
To do a magnetometer write, the magnetometer SS must be asserted, and the 16 shifted-out bits are: bit0 = 0 to select a write operation; bit1 = 1 to select address auto increment for multiple back-to-back writes (or =0 to not auto increment); six bits of address; and eight bits of data. For a read, the bits are: bit0 = 0 to select a read, 0/1 to select auto increment; five bits of address, and 0x00.