Atmel website | ARM Community | Touch Technologies | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Need help SPI full-duplex operation
PostPosted: Fri Jan 15, 2010 8:03 pm 
Offline

Joined: Thu Nov 26, 2009 6:52 am
Posts: 13
Hi everybody,

I plan to interface AT91SAM9260ek with MFRC531 RFID controller chip.
My problem is: The host SPI port should operate as full-duplex mode, but I couldn't find any doccument about using SPI full-duplex mode in the Linux's kernel space.

How to perform "write a byte and read a byte concurrently" operation with SPI port ?

Thank for helping.


Top
 Profile  
 
 Post subject: Re: Need help SPI full-duplex operation
PostPosted: Tue Jan 26, 2010 12:09 pm 
Offline

Joined: Thu Nov 26, 2009 6:52 am
Posts: 13
no reply,

Temporarily, I'm using "bitbanging" method, and my driver works fine.

Code:
static u8 spi_byte_transceive (u8 sendbyte)
{
  u8 i, temp = 0;

  for(i=0; i<8; i++)
  {
    CLK_LOW;
    if(sendbyte & 0x80) MOSI_HIGH; else MOSI_LOW;
    sendbyte <<= 1;
    CLK_HIGH;
    temp <<= 1;
    if (GET_MISO) temp |= 0x01;
  }
  CLK_LOW;
  MOSI_LOW;
  return (temp);
}


But, I'm wasting GPIOs for SPI purpose :(


Top
 Profile  
 
 Post subject: Re: Need help SPI full-duplex operation
PostPosted: Sat Mar 06, 2010 9:37 am 
Offline

Joined: Tue Nov 24, 2009 4:04 am
Posts: 3
meihou wrote:
Hi everybody,

I plan to interface AT91SAM9260ek with MFRC531 RFID controller chip.
My problem is: The host SPI port should operate as full-duplex mode, but I couldn't find any doccument about using SPI full-duplex mode in the Linux's kernel space.

How to perform "write a byte and read a byte concurrently" operation with SPI port ?

Thank for helping.


Is it acceptable to use it in user space instead? Since you mentioned specifically kernel space, I am guessing you have already seen the full duplex documentation, but figured I would mention it anyway, since I have been able to use it successfully... I just took a quick look at the atmel_spi.c driver file and did not see a system call for full duplex, but I don't know how spidev would be able to do full duplex but not a kernel space module/driver...

http://git.kernel.org/?p=linux/kernel/g ... 35;hb=HEAD


Top
 Profile  
 
 Post subject: Re: Need help SPI full-duplex operation
PostPosted: Mon Mar 15, 2010 8:06 am 
Offline

Joined: Thu Nov 26, 2009 6:52 am
Posts: 13
Thanks for your suggestion,

But I think we can't use the spidev because of the timming problem,
user space is really slow for controlling the MFRC531 chip (such as interrupt proccessing for each command...)

Does the AT91SAM9260 not support SPI with full duplex operation mode ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: