LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 04-14-2010, 03:25 AM   #1
linux_pn
LQ Newbie
 
Registered: Feb 2010
Posts: 3

Rep: Reputation: 0
imx51 - SPI - receive problem


Hi All,

I am using the babbage imx51 EVK board connected with dsPIC33F micro controller (5 lines, SS, SCLK, MOSI, MISO, and SPI_RDY).

I am using the following portion of code in my driver.

static int __devinit dspic_probe(struct spi_device *spi)

{

...

spi->mode = SPI_MODE_1;
spi->bits_per_word = 8;
spi_setup(spi);

...

}

static int dspic_spi_transfer(struct spi_device *spi, struct
spi_transfer *t)
{
int ret, i;
struct spi_message m;

dev_dbg(&spi->dev, "%s: tx:\n", __FUNCTION__);
for(i = 0; i < t->len; i++) {
dev_dbg(&spi->dev, "0x%x \n", *(char *)&t->tx_buf[i]);
}
dev_dbg(&spi->dev, "\n");

mutex_lock(&spi_lock);

spi_message_init(&m);

if (enable_dma) {
t->tx_dma = can_priv.spi_tx_dma;
t->rx_dma = can_priv.spi_rx_dma;
m.is_dma_mapped = 1;
}

spi_message_add_tail(t, &m);

ret = spi_sync(spi, &m);
dev_dbg(&spi->dev, "ret = %d\n", ret);
dev_dbg(&spi->dev, "rx data: \n");
for(i = 0; i < 4; i++)
dev_dbg(&spi->dev, "%x\n", can_priv.spi_rx_buf[i]);

mdelay(10);
dev_dbg(&spi->dev, "rx data: \n");
for(i = 0; i < 4; i++)
dev_dbg(&spi->dev, "%x\n", can_priv.spi_rx_buf[i]);

dev_dbg(&spi->dev, "actual len: %x\n", m.actual_length);

mutex_unlock(&spi_lock);

return ret;

}

In the dspic side, we are running the code with CKE = 1 and CKP = 0(Serial output data changes on transition from High to low ).

Whenever I send the data, dspic has to send the data 0xD7b1 as response. When i send the data, dspic is sending the reponse correctly. I am able to probe the data (SCK, MOSI and MISO) using the CRO. I could see the data correctly in CRO.

But my driver reads the value as always zero.

Can you predict the cause of this?

Any help would be greatly appreciated.

Thanks in advance.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Communication with SPI driver Mactub Linux - Software 2 03-16-2010 02:17 AM
imx51 - babbage - spidev driver problem - SCLK not generated linux_pn Linux - Software 1 02-16-2010 12:09 PM
Not able to make node for SPI makphy Linux - Newbie 5 11-04-2009 04:38 PM
SPI interface with AT91SAM9261 sunr2007 Linux - Embedded & Single-board computer 0 08-03-2009 03:43 AM
Ipsec error: SPI piggyj Linux - Security 0 11-09-2006 10:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 01:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration