mangOH Yellow two devices on SPI?


We want to connect two devices on the SPI bus of the mangOH yellow, but documentation says there is only one chip select pin available and thus only one spidev1.0 is found in /dev directory.
However Qualcomm docs and linux spi driver say that SPI should support four chip selects.
Even more - Linux device tree documentation states that using “cs-gpios” should be possible to set virtually any gpio as an SPI chip select.

So the question is - how to enable additional SPI chip select (preferably hw or at least gpio) and add another /dev/spidev1.1 associated with the chip select in mangOH yellow, so we can connect another SPI device?

I already wasted 3 days trying lots of DTS configuration without success.


we are trying the same. We want to add two MCP2515 CAN controller to SPI1.
The next quiestion would be about the IRQ Pin…

SPI on IoT card interface only gives you one CS.
However, you can use the 15 pin expansion port for SPI with 2 CS.
You will need to make a hardware mod for that though. Remove R817 and add R818.

SPI2 is not a native SPI of the WP module it comes from the USBtoSPI CP converter - we do not want to put that on our product. So the question is still present.
Which pin of the WP module could we use as SPI1 CS, even if it is not routed to the IoT connector?

1 Like

WP doesnt provides only 1 SPI with 1 CS.
The second SPI is not available…

unfortunately i am not (yet) an expert in linux kernel drivers…

But do you think there is a way to implement the WP’s SPI driver that it uses a GPIO for CS2
and another GPIO for IRQ source?

I really need to know this before getting knowledge about it because i MUST finish PCB design now to hit project deadline.

Using the native SPI would save costs because we would not need to place a USB3503A and a CP2130. would be much less complex at all for our application.

I will need to discuss with the team as we havent done this before.

Both WP SPI drivers spi-qup.c and spi_qsd.c SUPPORT up to 4 hardware chip selects. But since I do not have the SoC’s PDF and the modules’s schematic I can not tell if the SoC’s SPI support more the one hw chip select and if YES is it exposed to a pad or the module.

The WP SPI driver named spi_qsd.c that seems to be used for the SPI1, seem supports GPIOs as functional pins as it tries to pars those parameters:

But so far I was not able to make it work even providing “qcom,gpio-cs1” a valid GPIO that I was able to drive high/low manually using sysfs.

So all signs that additional should be possible, but no one made it work so far.

1 Like

OK, I made it work!
I added this to the SPI configuration in the device tree:
num-cs = <2>;
cs-gpios = <0>, <&tlmm_pinmux 16 0>;

But before using the SPI I had to set the GPIO as output in the sysfs:
echo 7 > export
echo out > direction

I believe this can also be avoided, if device tree is further setup properly.

1 Like

Well done…this is great to see.

This is very cool to hear!
(unfortunately, im not yet deep enough into it, i"m coming from the microcontroller(bare-metal) world…)

Do you know if the GPIO-Pins can be mapped as IRQ Source as well?

As you said, there are not many informations how the WP Module is internally connected to the Qualcomm MDM9206… And i did not find a Datasheet of the Qualcomm MDM9206.
The Names of the Pins (WP7702 vs. MDM9206) are probably identical…

Pin names are mixed and not identical unfortunately, you have to check the device tree for the mapping, for example gpio7 of the module is actually gpio16 of the SoC!