Skip to main content
SKvan.1
Associate
June 27, 2022
Question

How to read SPI_MISO from sensor (A111) to STM32G071CBx MCU? (XE132/XM132 from aconeer)

  • June 27, 2022
  • 3 replies
  • 2400 views

Have tried using hal_spi_transmit and receive but cant figure it out, any suggestions?

This topic has been closed for replies.

3 replies

waclawek.jan
Super User
June 27, 2022

Try to bit-bang it first, through pins set as GPIO Output (SCK) and Input (MISO).

Observe the pins using oscilloscope, compare waveforms to what's in the datasheet.

JW

Andrew Neil
Super User
June 27, 2022

@SKvan.1​  "Have tried using hal_spi_transmit and receive but cant figure it out"

What, exactly, can you not figure out?

  • Do you understand how the XE132/XM132 works? See the manufacturer's documentation for help on this.

  • Is it just how to use the hal_spi_transmit() function that you're stuck on?
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
SKvan.1
SKvan.1Author
Associate
June 27, 2022

I want to use the digital value from the A111, into the DAC (MCU). Thought first about gpio read but its only high/low.(?) I think i know how XE132/XM132 works, and the value should come from SPI_MISO, which goes into MCU (17, PA6). I cant figure out how to get that specific digital value.

Andrew Neil
Super User
June 28, 2022

@SKvan.1​ "I cant figure out how to get that specific digital value"

So, again, where are you stuck on that?

The XE132/XM132 documentation will tell you how to read stuff from it over its SPI interface.

The XE132/XM132 SPI interface neither knows nor cares what microcontroller you use - its operation will be the same whatever Master you use.

Similarly, the STM32's SPI controller neither knows nor cares what slave you are using; its operation will be the same irrespective - in Master mode, it clocks stuff out on MOSI, and in on MISO.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Tesla DeLorean
Guru
June 27, 2022

Surely Aconeer provides examples for their own HW combo A111+STM32F071CBU6 device?

Work with them directly, and with whatever SDK / DDK they provide.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..