# Write Register of SPI sensor MA730

**URL:** https://community.simplefoc.com/t/write-register-of-spi-sensor-ma730/2588
**Category:** Uncategorized
**Tags:** ma730
**Created:** [November 2, 2022, 5:24pm UTC](https://community.simplefoc.com/t/write-register-of-spi-sensor-ma730/2588 "2022-11-02T17:24:00Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![David\_Leitner](https://community.simplefoc.com/user_avatar/community.simplefoc.com/david_leitner/32/1386_2.png) [@David\_Leitner](https://community.simplefoc.com/u/David_Leitner)
#### Post date: [November 2, 2022, 5:24pm UTC](https://community.simplefoc.com/t/write-register-of-spi-sensor-ma730/2588/1 "2022-11-02T17:24:00Z")

</div>

Hi,  
i want to use a MA730 sensor in off axis setup.  
Therefore i have to write the register of the sensor, to compensate the mag field shift.  
It needs 2 x 16bit SPI frames, but with 20ms delay in between.  
But i have no clue how to do it.  
Is something like this already included in simplefoc? I didnt find anything.  
Greetings, David

---

<div class="post-metadata">

### Author: ![runger](https://community.simplefoc.com/user_avatar/community.simplefoc.com/runger/32/395_2.png) [@runger](https://community.simplefoc.com/u/runger)
#### Post date: [November 3, 2022, 12:03am UTC](https://community.simplefoc.com/t/write-register-of-spi-sensor-ma730/2588/2 "2022-11-03T00:03:34Z")

</div>

Hi David!

Have you seen our dedicated driver for the MA730 here?

> **[Arduino-FOC-drivers/src/encoders/ma730 at master · simplefoc/Arduino-FOC-drivers](https://github.com/simplefoc/Arduino-FOC-drivers/tree/master/src/encoders/ma730)**
>
> Drivers and support code for SimpleFOC. Contribute to simplefoc/Arduino-FOC-drivers development by creating an account on GitHub.

I’m not sure I implemented the registers you need, but it should be fairly easy to extend it…

Let me know if this makes sense to you, or if you have further questions feel free to ask!

---

<div class="post-metadata">

### Author: ![David\_Leitner](https://community.simplefoc.com/user_avatar/community.simplefoc.com/david_leitner/32/1386_2.png) [@David\_Leitner](https://community.simplefoc.com/u/David_Leitner)
#### Post date: [November 3, 2022, 2:12pm UTC](https://community.simplefoc.com/t/write-register-of-spi-sensor-ma730/2588/3 "2022-11-03T14:12:57Z")

</div>

Thank you very much, stupid me wasnt looking under the foc-drivers directory.  
I found everything i needed for adjusting the bias current.  
It works now.

Here is the next problem, when using a magnet off axis, the mag field changes 2 times/rev.  
When using AB signals its no problem, i just can double the resolution.  
But can i do that somehow when using SPI to get the angle?  
Greetings,  
David

---

<div class="post-metadata">

### Author: ![runger](https://community.simplefoc.com/user_avatar/community.simplefoc.com/runger/32/395_2.png) [@runger](https://community.simplefoc.com/u/runger)
#### Post date: [November 3, 2022, 4:13pm UTC](https://community.simplefoc.com/t/write-register-of-spi-sensor-ma730/2588/4 "2022-11-03T16:13:55Z")

</div>

Hey,

I think you’re the first to use the sensor in this way - we’ll be really interested to hear your experiences!

SPI also uses a CPR value, which is hard-coded in the MA730 class…  
See the #define MA730\_CPR

Perhaps the best thing to do is just create a subclass of the MA730 driver class, and fix it to suit your needs. Or even just copy the classes from the ma730 folder to your own project and adjust them as needed.

Once you confirm it is working, I would be very happy to make a modification to this driver to accommodate edge-on mounting.
