Author Topic: Using the SPI interface with the LM3Sxxxx Chips  (Read 7913 times)

Offline mhoneywill

  • Full Member
  • ***
  • Posts: 173
    • View Profile
Using the SPI interface with the LM3Sxxxx Chips
« on: November 02, 2010, 03:01:06 PM »
Hi Mark,

Due to my ongoing problems with the I2C interface in these chips http://www.utasker.com/forum/index.php?topic=990.0 I have decided to use the SSI interface on my next board, I'm stuck with the luminary chips at the moment as I've no time to change.

I notice that you don't use a driver interface as such to the SSI port in uTasker, would you suggest that I just modify the functions in the spi_sc16IS7xx.h file you sent me to provide SPI access to the second SSI port on this chip.

Cheers

Martin


Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Using the SPI interface with the LM3Sxxxx Chips
« Reply #1 on: November 02, 2010, 08:22:51 PM »
Hi Martin

Originally there was an SPI interface following the serial pattern (interrupt driven with input and output buffers). V1.2 probably still has this.

However the problem is that SPI rarely falls into this category. Often there are special requirements for the CS control, Tx and Rx can only take place together and many chips require certain formats (like addressing, command and then data, etc.). Therefore a generic SPI interface like UART didn't make that much sense.

Essentially I take an existing interface (SPI FLASH driver or the spi_sc16IS7xx.h as you suggest) and use the same tx and rx methods from it. SPI is usually fast and code will simply send an read a few bytes as fast as possible and using an interrupt driver wouldn't result in any improvement in efficiency. It is also simple code to write (just make sure you wait for complete Tx and Rx, depending on whether Rx is important [using the right flags])].

Regards

Mark