Second magnetometer over spi? #8
-
|
from @ecburns33 in #2:
You're setting the SPI bus up twice (which is why it's telling you SCK is in use). from pycubed import cubesat
spi_bus = cubesat.spiThen proceed with initializing your external magnetometer from there. Oh and don't forget to set up your chip select pin. any of the remaining GPIO pins on the payload header will work. There's also another example of of this scenario on code examples page: spi.py where I show how it initialize and use the SPI bus with and without the pycubed.py helper library. Does this answer your question? Report back with how it goes! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Thank you so much for the help! I've heeded your advice and am still working to connect to the magnetometer. Based upon the hardware we're using (which I admittedly now understand to be overcomplicated), I have to make several connections in addition to the CS pin; the magnetometer also needs a RESET and DRDY pin to be used in order to make the connection. Here is an example wiring and C++ Arduino code provided by the manufacturer for reference: I know I can translate most of the code to python for use on the Pycubed board, particularly the math. However, I am still struggling to make some of the connections to the pins as done by the pinMode() and digitalWrite() methods normally used in Arduino. |
Beta Was this translation helpful? Give feedback.
-
|
@ecburns33 Fear not! 😄 There are PyCubed examples for this
Now let's break this down.
Whew! Ok well I ended up writing pretty much a full library and example. Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
|
@ecburns33 hmm here's somethings to try: OH! What micromag version is your sensor? I see there are some examples that are powered with 5V. So that likely means that's what the digital VDD is expecting as well. Double check this. 5V is rarely used for these types of things these days, but if that's the case, the PyCubed's 3.3V logic wont be enough.
Troubleshooting tips I was writing when I stumbled upon the 5V thing:
|
Beta Was this translation helpful? Give feedback.

@ecburns33 Fear not! 😄 There are PyCubed examples for this
RESETandDRDY. Can do!busiofor these pins,busiois for serial bus communication (like SPI or I2C). We just need general control of the digital pin. CircuitPython calls thisdigitalio.digitalioexample here for a taste of how this is done.Now let's break this down.
Here's what the arduino code you linked says for the pins assignments and configuration.
arduino code