Interfacing a STM32 to a LSM6DSL through an optimized SPI DMA communication

Document created by fillon.nicolas Moderator on Aug 16, 2017Last modified by fillon.nicolas Moderator on Aug 16, 2017
Version 3Show Document
  • View in full screen mode

Interfacing a STM32 to a LSM6DSL through an optimized SPI DMA communication

 

About this project

For one of my project I had to write an optimized driver to interface a STM32 to a LSM6DSL through SPI. To optimize the communication I used DMA mode.

 

The configuration I was asked to do is the following for the LSM6DSL:

 

Gyro:

FS= +/- 2000 dps

ODR = 6.67 KHz

Filter Cut: no filter

 

Accelerometer:

ODR =6.67 KHz

+/- 2 g

 

INT1 pin used to indicate new data (from Gyro and XL are ready to be read).

 

 

Hardware connections Needed between the Nucleo and the STEVAL board:

 

Here are the connections from my STM32F303-Nucleo to the STEVAL-MKI178V1:

 

VDD to 3V3 of the Nucleo

VDDIO to 3V3 of the Nucleo

GND to GND of the Nucleo

CS to GND (SPI mode)

SDx to GND

SCx to GND

 

I will connect also the following to the STM32F303

 

INT1 to PG15 as external interrupt

SCL  to SPI1 CLK: PB3

SDA to SPI1 MISO: PB5

SDO to SPI1 MOSI: PB4

 

Set-up

 

 

Once you have the hardware connection done you will need to build the project and enter debug to execute the code.

 

To make sure your connection is ok you can for example read: who_am_i and check that you read 0x6A.

 

Then you will need to put data_buffer in the memory window to check that the data are being updated correctly as seen in the doc file.

 

Project info

Type : I used Keil uVision 5.2 to build the project. I used a STM32F303ZE Nucleo board. I then connected a

Progress : my project is complete

Difficulty : Intermediate 

License : No license needed

The Team :

Who made this ?

Nicolas Fillon

FW and HW

fillon.nicolas

Guillaume Legrain

FW

Guillaume Legrain

Dominique Barbier

LSM6DSL expertise

Dominique Barbier

Things used in this project

Hardware components :

NUCLEO-F303ZE1Comment
STEVAL-MKI178V11Comment

Hand tools and fabrication machines :

You will need jumper cables to connect the STM32F303 Nucleo to STEVAL-MKI178V1

Software Tools :

You will need Keil uVision 5.2 or higher to build the project.

 

Story

A long time ago in a far far galaxy....

 

Attachments

 

Code

  • Please see code  attached below

Schematics and circuit diagrams

  • Please see files of the Nucleo and the STEVAL on our website.

CAD - Enclosures and custom parts

  • Please see files of the Nucleo and the STEVAL on our website.

Outcomes