Help talking to a RM3100 compass via SPI

I have a RM3100 module I need to talk to via SPI (before giving up and reworking the board I got from amazon to use i2c).

Taking inspiration from other hwdefs, I added this to my board’s (matek h743):

SPIDEV rm3100 SPI3 DEVID1 EXT_CS1 MODE3 1*MHZ 1*MHZ
COMPASS RM3100 SPI:rm3100 true ROTATION_NONE
DMA_NOSHARE SPI1* SPI4* added => SPI3*

And… It apparently works? Mission planner shows the RM3100 (so I’m guessing the driver is initialising successfully performing a handshake with the sensor, as it’s marked as “not missing”).

However, I can’t make sense of the data, and neither can ardupilot as I keep getting a faulty/inconsistent compass error.

Here is a sample I would get out of the device:

MagX: -247; MagY: 1308; MagZ: 2

Somehow MagX is the one that makes sense the most of the time (it changes as you change the compass orientation), while MagY and MagZ are stuck at zero, jumping around (like from +20 to -200 in a second), or going to crazy numbers like 10k+.

I’ve looked for signal integrity issues (via a scope and by lowering the speed to 50kHz), and couldn’t find anything (cable is ~30cm, but signal looks great).

Any ideas? My best guess at the moment is that maybe my hwdef file is wrong, and for example I’m not using the correct hardware resources to pool the sensor, and it’s not keeping up with the incoming data.

Did you ever get the RM3100 SPI working? I have been trying for a few days and get the same result – (3 bytes of X and 0’s for Y and Z)

Thanks
Noel Petit