spi data transfer

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

spi data transfer

6,844 次查看
lssuer
Contributor I
im trying to send data between two HS12 Microcontrollers which are both set up to be a master and this cannot be changed. Does someone know how to send data from a master to a master. Thanks
标签 (1)
0 项奖励
回复
7 回复数

1,146 次查看
rocco
Senior Contributor II
Hi, lssuer:

You can't. Really.

If they are both master, they will both want to provide the clock and ignore the other's clock.

The only thing that I can suggest is to set up a shift register as an intermediate slave, and allow it to be selected by either master. Than one master can write to it, and the other can read from it. Getting them synchronized so that they don't try to access the slave at the same time, and getting them to know when data is available in the shift register, would be the trick.

hope that helps, at least a little.
0 项奖励
回复

1,146 次查看
peg
Senior Contributor IV

Hi,

You can't do this, once you select master this makes it output the clock (and the slave(s) should sync to this). If youv'e only got two masters who is going to sync to what?

Regards Peg

 

Message Edited by peg on 05-07-200610:14 AM

0 项奖励
回复

1,146 次查看
lssuer
Contributor I
i was afraid of this, my circuit board was made with the MOSI and MISO pins crossed. Do you know of any way to transmit sata even though the pins are not ran correctly. Thanks
0 项奖励
回复

1,146 次查看
rocco
Senior Contributor II
Ahh . . . I see . . .

You can program around this problem with an X-acto knife (actually, I use a dremmel). I think a little board re-work is your only solution.
0 项奖励
回复

1,146 次查看
peg
Senior Contributor IV

Hi,

Before you get start hacking up the PCB, just another thought.

Your device doesn't have bi directional mode like on an S08QG. I am not even sure how this works and whether it will get you out of the #!@$% but maybe worth a look at first.

Regards Peg

 

0 项奖励
回复

1,146 次查看
rocco
Senior Contributor II
ooh, yes, Peg. Excellent idea!

I don't know which variant of the HC12 or S12 you are using, but if you have an SPI with bi-directional mode, then you are saved! Bi-directional mode shifts in/out using MOSI (called MOMI, in this mode) on the master, and shifts in/out using MISO (called SISO, in this mode) on the slave.

You could only move data in one direction at a time, and both microcontrollers would need to set her respective DDRS bit to be in agreement as to what that direction was, but those problems are manageable.

Good call, Peg!
0 项奖励
回复

1,146 次查看
lssuer
Contributor I
I tried the bidirectional idea and it works great. thanks for all the help
0 项奖励
回复