Adding delay between SPI transfers

Trinath
Hello,

I am trying to add delay to spi_ioc_trasnfer struct in my application code
like this below (.delay_usecs). I am testing this on DSO but the delay
between each transfer is always less than 25usec. (to be precise, 22us
delay after first transfer and 11us after then.) 


        struct spi_ioc_transfer tr = {
                .tx_buf = (unsigned long)txptr,
                .rx_buf = (unsigned long)rxptr,
                .len = noBytes,
                .delay_usecs = 1000,
                .speed_hz = speed,
                .bits_per_word = bits,
        };

struct spi_ioc_transfer is defined in /include/linux/spi/spidev.h.


Any suggestions please....

Trinath

Trinath
Also,

Why ioctl() trasfers need atleast 2 bytes to transfer? Got segmentation
fault when tried to send one byte.

Xristos
I have to write an application that sends 1 byte via SPI and receives one.
Is that impossible?

Cxxx
I'm guessing that when you tried to transfer a singe byte that you gave
.tx_buf and/or .rx_buf a number instead of a pointer, which when referenced
is very likely to cause a segfault.  makesure txptr and rxptr is a
pointer/array

Xristos
Now I send the byte as the first cell of a table, so it is a pointer and it
works.
I still do not understand why it receives the byte of the previous
question!
I just use a workaround.

Reply

Name
eMail (not visible)
Subject (no text only in upper case; no HELP, URGENT...)
Text
HTML tags are not supported and links are generated automatically if they start with http or ftp.
Please submit long source code or log files as attachment (only registered users).
Please enter the number without blanks: 2 3 4 5