can anyone please explain hw to transfer data from slave to master in SPI communication and i know hw to transmit data from master to salve.
both salve and master devices are free scale mc13224v chip based boards.
The slave has to be read by the master if you want to transfer data between them. I do like this:
- Chip select the device
- Provide a register address (I manage internal "registers" with data) with the LSB telling the slave if it's write/read.
- If it's it's write, the slave gets the data on the next byte and writes it into the register. The data pushed by the slave in this case is ignored by the master- If it's read, the master will receive the byte contained in that address.
This is a particular case I work, but I think you got the idea: When you chip select the slave, the data in the buffer is shifted out to the master. It's as simple as that.
hi Anderson Felippe,
thaks for your replay.i had gone through your mail and i have doubt that
if salve has to transmit the data to master,is that it is required to
convert slave to master and master to salve for the duration of
On Thu, Apr 25, 2013 at 3:56 PM, Anderson Felippe <
No, there's no need and also no point in doing that. The slave has to be read by the master, only that.
I hope it helps!
This Forum is for Coldfire parts. The chip you're using is ARM-based, RF Zigbee chip, and discussion on those parts is being held in this forum:
Other NXP Products
As Anderson said you should not try to switch master and slave.
SPI allows sending 8 (or 16 or more) bits from the Master to the Slave. These bits are shifted out of a shift-register in the Master into another shift-register in the Slave. At the same time a shift register in the slave is shifted data back into the master.
That's it. The "meaning" of the bits in the data being transferred is up to you. Hardware chips that have SPI interfaces (like EEPROM, clocks and ADC converters) come with data sheets that detail how the hardware designer has decided to use SPI to get the job done.
I suggest you read the data sheets for various SPI-based chips, and then copy the registers and the use for one that most closely matches what you want to do. We use multiple SPI-connected CAN controllers on Coldfire parts. These CAN chips have 128 bytes of control registers. The master has to send a control byte (which means "read, write, reset, bit-modify" or other commands), then the address of the register, then the data to send, or (while sending "dummy data") read if it is reading data back.
The Master can send data whenever it wants to. The Slave can't start a transfer. If the Slave in your design has to request the master to communicate with it, then you need an separate connection from the Slave that interrupts the master. This is treated like any other peripheral interrupt.
hi Tom Evans,
Thanks for ur replay.i try now with ur information..
Retrieving data ...