SPI bit-banging

Last post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I have to implement access to a 32bit SPI device.
The atmel_spi driver is only supporting 8 and 16bit devices.
I have to use the bit-banging SPI driver therefore :shock:

Does anybody have experience with this bit-banging driver?
How do I have to change board setup?
How do access the driver from userspace?

Thanks,
Gerhard

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi guy,

Upgrade your kernel to 2.6.29. In this version, spi-gpio driver has been added. It uses common gpio framework, which is harware independent.

Take a look at thread (mine :) ) " Example code to initialize new spi-gpio driver", dated 2nd of June.

I left default word-width (not sure, 8 bits). It is much slower than atmel_spi. I set clock to 500KHz and worked really well for writing to SPI flash in NGW100.

BR
Ricardo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Ricardo,

thanks for you hint! :D
500kHz bit frequency is OK for my application ...

Gerhard

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why doesent atmel fix a decent spi driver that can be accessed from user-space ?

or have they allready ?

I am confused how this can be a problem, why force customers into bit-banging instead of providing a decent driver ?

Or have I missunderstood all this.

I also need to drive a small lcd-display over spi.

/Nicholas

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just send two or three lots of 8-bit data, there shouldn't be any need for bit-banging. It usually works.

Leon

Leon Heller
G1HSM

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

the problem is, that some devices don't like it, if the SPI-CS line goes high (inactive) between multi-byte/multi-word transfers.

I have to read 32bit words from an ADC.
The atmel-spi driver definitely puts SPI-CS high during two 16bit transfers.

Since SPI-CS is controlled via GPIO in the atmel-spi driver, it shouldn't be that big problem to implement 32bit transfers ...

Gerhard

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think nobody will prevent you from adapting the atmel-spi-driver. find the line of code and add your adaption for 32-bit-words.

This should be easier than changing to the bit-banging-driver and it is more efficient.

greetings

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But RDR & TDR registers are 16 bits-wide...

Receiving 32 bits into RDR continously might be problematic? Who knows? I don't.

Ric