SPI1_SS controlling manually

I am curious if I were to use SPI3, when I set it up using SPI.begin(); and then use SPI.transfer(val); I am assuming it takes care of the SPI1_SS signaling. Yet I need to control this manually. If I were to set this as a GPIO pin and control it manually as my CS line, when I do a SPI.transfer would it interfere or still take control over this line ?

@mikemoy, ALL SPI chip select lines are controlled manually and not by hardware. SPI.begin () conveniently sets the pinMode for SS (A2) by default or the specified pin. The user code does the rest.

Thank you. however this is a bit confusing because the Particle Documents for SPI say this. I am also curious how to also use SPI3, there is not a whole lot in the docs about SPI.

begin()
Initializes the SPI bus by setting SCK, MOSI, and SS to outputs, pulling SCK and MOSI low, and SS high.
Note that once the pin is configured, you can't use it anymore as a
general I/O, unless you call the SPI.end() method on the same pin.

https://docs.particle.io/reference/firmware/core/#begin-

Hi @mikemoy

One thing I was told recently in another thread was that the SPI api, contrary to the current documentation, also allows you to set up the SS pin. There’s the:

SPI.begin(uint16);

variant which frees up the A2 pin. If you look at the source code of that routine you’ll see it does as peekay123 said, setting it as output, but nothing more.

Here’s the related thread: Is using the HAL directly encouraged

Here’s another ping for @peekay123 to please update that documentation :smile:

Sauce

1 Like

@Sauce, Thank you I will give it a look.