SAMD21 SERCOM SPI, which pin can one use for SS slave select?

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I want to use a SAMD21 as SPI master with software control of the SS slave select signal (CTRLB.MSSEN = 0)

One can configure which PADs of the SERCOM peripheral are used for the SCK, MISO and MOSI signals in the CTRLA register. Can one configure the pin for the remaining PAD so that it can be used for the SS signal?

The description of CTRLA.DOPO in the datasheet just says "System configuration" for the Master SS settings, but doesn't say if one can use a PAD belonging to the SERCOM for it. Some examples use an arbitary output pin for SS

Question: Can one configure the remaining PAD as an output in the pin PORT setup?

Thanks in advance for advice

Jerry

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

"if Master Slave Select Enable (CTRLB.MSSEN) is set to zero the _SS line can be located at any general purpose I/O pin, and must be configured as an output"

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

Thanks for the reply, then "any" also means the remaining SERCOM PAD can be the SS signal. The examples from other sources which used another pin confused me.

When my visitors let me  I'll try it out

Best wishes, Jerry

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

Yes, including the "the remaining SERCOM PAD".

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

Your confusion is in thinking that SS signal is also driven by SERCOM hardware. Not so. In all ARM MCUs only SCK, MOSI, MISO signals are handled by chip hardware, the SS enable signal is firmware driven in Master's code and hence any GPIO pin can be assigned to do that like regular output GPIO port and then configure GPIO driver appropriately to do that and turn that pin low whenever your Master wants to talk to the Slave.

* and remember to turn it high (Off) afterwards

 

Correction: In some ARM' implementations (apparently also in SAM ) there is option in the register to allow chip' hardware to control SS automatically without firmware... if this is chosen, then you can only use the chip' assigned pin as per datasheet, otherwise you can use any as described above (in all ARM's) .

Last Edited: Thu. Jul 18, 2019 - 04:06 PM