Pages: [1]   Go Down
Author Topic: 2 different SPIs on 1 Mega  (Read 1070 times)
0 Members and 1 Guest are viewing this topic.
Estonia
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

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?
Logged

Left Coast, USA
Offline Offline
Sr. Member
****
Karma: 5
Posts: 499
Sometimes I just can't help myself.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


Regards,

Dave
« Last Edit: October 02, 2010, 04:03:26 pm by davekw7x » Logged

Estonia
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Portugal
Offline Offline
God Member
*****
Karma: 6
Posts: 962
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Estonia
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: