Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
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.


  Search this Thread
Old 04-14-2010, 03:25 AM   #1
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;



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");



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]);

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);


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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 11:39 AM.

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