Home > OS >  Consult the SPI
Consult the SPI

Time:03-12

My application goes like this:
SPI after receiving the 1024 data, sent through the network,
My original application is such a (omitted) :
The static uint8_t flag;
Void * spi_proc (void) {
int i;
While (1) {
If (flag==0) {
for(i=0; i<32. I++) {
Ret=read (fd, rx_buf1, 32).//SPI a maximum transmission 32 bytes
Rx_buf1=rx_buf1 + 32;
}
Flag=1;
}
The else {
for(i=0; i<32. I++) {
Ret=read (fd, rx_buf2, 32).//SPI a maximum transmission 32 bytes
Rx_buf1=rx_buf1 + 32;
}
Flag=0;
}

If (flag==0) send (tcp_fd rx_buf2, 1024, the MSG_DONTWAIT);
The else send (tcp_fd rx_buf1, 1024, the MSG_DONTWAIT);
}
}
The problem is
1: SPI efficiency is low, the following waveform, two-thirds of time free
2: according to the received images caton, the specific reason unknown

I don't think so bad SPI work in blocking mode, with using the select in serial program, but the word of the SPI under the host must calls read first, otherwise there is no clock, select reading state monitoring is less than what has changed, how to use SPI under Linux from the machine? How to use the DMA? How to make under a non-blocking SPI work?
  • Related