# \[Solved\]SPI Slave Select with different PIN (spiService)

**URL:** <https://forum.legato.io/t/solved-spi-slave-select-with-different-pin-spiservice/2514>\
**Category:** Legato Application Framework\
**Created:** [June 22, 2017, 11:14am UTC](https://forum.legato.io/t/solved-spi-slave-select-with-different-pin-spiservice/2514 "2017-06-22T11:14:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![white\_fish](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@white\_fish](https://forum.legato.io/u/white_fish)\
**Post date:** [June 22, 2017, 11:14am UTC](https://forum.legato.io/t/solved-spi-slave-select-with-different-pin-spiservice/2514/1 "2017-06-22T11:14:11Z")

</div>

Hello,  
is it possible to use a different slave select pin with the spiservice? I have two use two different slave selects. The hardware mapping is GPIO1 (on the breakout board PIN 24) should be the slave select for one chip and GPIO 2 (on the breakout board PIN 25) should be the selection of the other chip. Both are on the same external board.

Thanks!

---

<div class="post-metadata">

**Author:** ![white\_fish](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@white\_fish](https://forum.legato.io/u/white_fish)\
**Post date:** [June 23, 2017, 8:41am UTC](https://forum.legato.io/t/solved-spi-slave-select-with-different-pin-spiservice/2514/2 "2017-06-23T08:41:03Z")

</div>

Okay,  
found a solution. Before I write something, I set the Pin to low active and after that to high again. That should be the same what the spiService does too.

```
le_result_t writeHD(le_spi_DeviceHandleRef_t handle, const uint8_t* writeDataPtr, size_t writeDataNumElements)
{
	le_result_t res;
	le_gpio_SetPushPullOutput(LE_GPIO_ACTIVE_LOW, false);
	le_gpio_ss_Activate();
	res = le_spi_WriteHD(handle, writeDataPtr, writeDataNumElements);
	le_gpio_ss_Deactivate();
	return res;
}

```

Have a nice day!
