Go Down

Topic: 2 different SPIs on 1 Mega (Read 1 time) previous topic - next topic



I've a strange problem. I'm want to use 3 MLX90316 rotary position sensors and some other devices (like: MLX90609) over SPI. Rotary position sensors need to be connected with MISO & MOSI pins together over capacitor and transistor, but other devices use MISO and MOSI normally.

This puts me into position where I have to make some circuit changes to use SPI in 2 different modes or use 2 different SCLK/MISO/MOSI pins altogether. AFAIK Arduino normally has only 1 set of SPI pins.

What's your thoughts?


Oct 02, 2010, 09:59 pm Last Edit: Oct 02, 2010, 11:03 pm by davekw7x Reason: 1
For properly designed SPI slave devices, several can share SCLK, MOSI and MISO pins.  These signals are exercised "automatically" by the ATMega SPI port hardware when you perform any SPI port input or output operation.  Each slave device has its own "SS" signal that is controlled by software (in your sketch, or, maybe in a class object, depending on some library implementation).

Show us a sketch that would use one of these devices so that we can see what library (or other code) you are using.  Then, maybe, someone can help with expanding to more than one.




The part that was making me worry is on this picture:

There you can see how MOSI and MISO are connected on Arduino side over capacitor and resistor -- I can't use those two pins to interface normal SPI devices.

But my problems may be solved with this work here. There seems to be self-made SPI protocol to interface those rotary position sensors: http://interface.khm.de/index.php/lab/experiments/rotary-positionsensor-mlx90316/

I need to test it out though.

PS! Sorry about misleading 'transistor' -- it was late night and I'm not very good at electronic words in English.


Thats a fet, not a capacitor, its an transistor.
You can read the datasheet, and if it is like the atmega328p, you can configure one of your usart ports to act like an spi port.


Yep, thanks for clearing. What a mess:D Of course it's a transistor... Thanks for the hint, but I have Mega (older) which has ATmega1280. I dig it's manual, I think its usart can behave the same as Atmega328p.

Go Up