Page 1 of 1

SPI API slave select functionality

Posted: Wed May 11, 2016 4:29 am
by awygle
I've been working with the SPI API for a while now and I had a couple of questions about slave select functionality.

First, it seems inefficient to reload all driver configuration just to select a new device. In my experience it's not at all uncommon to have multiple SPI devices on the same bus all using identical data rates, CPOL/CPHA, etc., with different slave selects. Calling spiStart works fine, but seems like overkill - is there another way?

Second, different devices expect different kinds of slave select framing - some expect it to be toggled per frame (which works fine with the current architecture) but some expect it to be toggled per byte. I can't see a way to achieve that behavior with the current API, short of calling spiPolledExchange over and over, which is pretty inefficient. Is there a way to make that happen?

Thanks!

Re: SPI API slave select functionality

Posted: Wed May 11, 2016 8:10 am
by Giovanni
Hi,

spiStart() has a short path internally when called in the SPI_READY state, so it is not overkill, it just makes few basic initializations, not the full initialization.

Per-frame toggling can only effectively done using an HW slave select, if the underlying SPI unit supports it.

Giovanni