A121 Integration using STM32CubeIDE
2.8
SPI Configuration
To make the SPI interface work properly with the Acconeer software you might need to set the Prescaler (for Baud Rate)
and Data Size.
Press the SPI you are using and under the Configuration menu you can change parameters. Under “Basic Parameters” you
can find that “Data Size” is set to 4 Bits by default, change this to 8 Bits.
Under “Clock Parameters” you will find “Prescaler”, this controls the frequency of the SPI bus. The higher the prescaler
value is, the lower the frequency will be. Depending on your setup, you might have to use different prescaler values
to fit your project. The A121 sensor supports SPI frequencies up to 50 MHz. In experimental configurations where the
sensor and MCU are not mounted on the same PCB, the maximum SPI frequency is often significantly lower and typically
around 10 MHz.
It is recommended to use the highest prescaler to begin with in order to make sure the SPI-communication is stable. Once
the communication works properly you can start trying lower prescalers in order to increase the frequency.
You might have to save the project and restart the program in order to access these settings.
Figure 11: SPI Master Config
2.9
Code Generation
Select Project/Generate Code to generate the driver and configuration MCU.
© 2022 by Acconeer AB - All rights reserved
Page 12 of 23