MISO and MOSI short circuit with a diode. - MC9S08GB60

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MISO and MOSI short circuit with a diode. - MC9S08GB60

2,804 Views
covibryant81
Contributor I

I have to interface a MC9S08GB60 to a ADF7021. The ADF7021 has only one pin for the TxRxDATA and one pin for the TxRxClock that specify the data rate. I would like to use the SPI interface of the uC. Could I short circuit the MISO and MOSI pin of the uC and use it as a slave? When the ADF is in transmit mode TxRxData is an input while when it is in receive mode, the TxRxData is an output.
Analog Device suggest


uC ADF7020
| /|
MISO--->|/ |-------- TxRxData
|\ | |
| \| |
|
|
|
MOSI-----------

SCLOCK--------------TxRxClock

do you think it could be work?

thank you in advance

The paint is not clear due to formatting.
if you want, you could see on page 46 of http://www.analog.com/static/imported-files/data_sheets/ADF7021.pdf
don't see SPI mode because there are other problems with the datarata.

If I can't insert extern link, excuse me.



Update: could I use SISO?
Message Edited by covibryant81 on 2008-07-01 07:04 PM

Message Edited by covibryant81 on 2008-07-01 07:10 PM

 

 

Added p/n to subject.



Message Edited by NLFSJ on 2008-07-01 01:13 PM
Labels (1)
0 Kudos
3 Replies

871 Views
bigmac
Specialist III
Hello, and welcome to the forum.
 
The best method is to use the one-wire mode associated with the SPI module.  Shorting MOSI and MISO together will not work because data could not be returned from the external device - the MOSI pin at the MCU would dictate the bus state.  It might be feasible to use an isolating diode for MOSI, but it will be simpler to use the SISO connection.
 
Even with the SISO connection, I would recommend a series resistor in this line, to provide current limiting.  This would protect against excessive current flow in the event of a (short) timing conflict in the data direction change-over between the MCU and the device.
 
I am not familiar with the external device you are using (presumably an A/D converter).  I assume it is SPI compatible.  If it is, I would expect the datasheet to say so.  Remember that SPI communications are in multiples of 8 bits.
 
Regards,
Mac
 


Message Edited by bigmac on 2008-07-02 12:33 PM
0 Kudos

871 Views
covibryant81
Contributor I
thank you very much. Now I'm seeing how SISO works. My question is: could I use for example the SISO as output for ever? Because in the SPI protocol before starting a new trasmission, the Rx buffer has to be read.
0 Kudos

871 Views
bigmac
Specialist III
Hello,
 
Even when sending data using a single wire, the SPI data register needs to be read as part of the SPRF flag clearing process, to prevent an overrun condition, even though the returned data will be meaningless.  Similarly, the receiving of return data needs to be initiated by the sending of a dummy byte.  The data transfer direction will be determined by the BIDIROE control bit.
 
The procedure for the transfer of a byte in either direction can use a common function, similar to the following -
 
byte SPI_trans( byte val)
{
   (void)SPIS;         // Read status register
   SPID = val;
   while (!SPIS_SPRF); // Wait until transfer is complete
   return SPID;        // Also clears flag
}
 
Prior to each transfer, the setting of the BIDIROE bit will determine the desired data direction.
 
To send a command byte to the slave device -
SPIC2_BIDIROE = 1;
(void)SPI_trans( command);
 
To receive a response from the slave device -
SPIC2_BIDIROE = 0;
resp = SPI_trans( 0);  // Send dummy byte
 
The use of the void casts should eliminate compiler warnings.
 
Regards,
Mac
 


Message Edited by bigmac on 2008-07-02 10:30 PM
0 Kudos