Reply by James Newton September 19, 20072007-09-19
--- In m..., amyle wrote:

> I'm quite confused about that dummy write variable, can anyone help me on
> that one? Thanks.

The dummy writes are there only to generate clock pulses so the
incomming data can be clocked in. In an interrupt driven environment,
you need something that you can set of in the background to generate
clock pulses for the input data and the write function was already
there so...

Since the slave device is in transmit mode, the bits being written are
going to be ignored.

I wish I had some good sample code to share but mine is all under NDA.
Does anyone have some nice sample code that we can share?

Beginning Microcontrollers with the MSP430

Reply by p_murayama September 14, 20072007-09-14
Hello!

About the dummy byte:
SPI is a very simple transmission engine. You can see it as a
cable car: 2 cars tied by a rope with a pulley on top of the
hill. If you don't let the bottom one go up, the top one will
never come down.
Now for real stuff: SPI is symmetric. It allows to send bytes
while receiving other bytes. The master sends one byte at a rate
defined by the SPI engine, and for every bit of this byte, it
receives a bit from the slave. So on a real SPI engine you HAVE
to send a byte to receive one. This is not required by the slave
(which does not care), this is required by the SPI engine.

Pascal
Reply by amyle September 14, 20072007-09-14
Hey Lukasz,

Did you ever get your SPI working? I'm trying to interface my SPI with an
external ADC and are having problem to receiving and sending data as well.

I'm quite confused about that dummy write variable, can anyone help me on
that one? Thanks.
Reply by lukasz_krysiewicz May 1, 20072007-05-01
Thanks a lot for informations. So if I can receive byte from my slave use hardware Spi (in my usage software Spi is imposimble to use) at first I must transmit byte to my slave. It is right ???

Yes, on the MSP430 you will have to make a DUMMY write to activate the clock and receive data from you slave.
This is just the way the SPI module is implemented in hardware.

If your SPI slave device is not happy with receiving dummy data, you can implement your own bit-banging SPI port...(this would be a rare case)
Reply by Candemir Orsan April 28, 20072007-04-28
Yes, on the MSP430 you will have to make a DUMMY write to activate the clock and receive data from you slave.
This is just the way the SPI module is implemented in hardware.

If your SPI slave device is not happy with receiving dummy data, you can implement your own bit-banging SPI port...(this would be a rare case)
Reply by old_cow_yellow April 27, 20072007-04-27
It seems that you did not configue the GPIO pins to be used for SPI.
You need to set both DIR and SEL bits for UCLK and also the SEL bit
for SOMI.
Reply by Joe Radomski April 27, 20072007-04-27
For an SPI read (at least on every device I have ever used) a DUMMY write is needed, so you HAVE to send data to your slave..
Reply by lukasz_krysiewicz April 27, 20072007-04-27
Hi all. I can't have a experiance with Msp430 SPI module, and I have a one simple question.

So, I have a procesor in Master mode, my SPI should only recived data from slave (only SOMI is used, SIMO is unused), and I set UCLK to slave clocking.

This is my SPI initialization porcedure:



It is 3 pin mode, But I can't recived data, and UCLK is not working (I check that using osciloscope). Only when I transmit data when UCLK is working and data in recived. But I don't nead transmit data to my slave !!!
IS ANOTHER WAY TO CONFIGURE SPI ??? (Mayby in 4 pin mode). Please help my.

Thanks for any advices.