# WP7702 using SPI

**URL:** <https://mangoh.discourse.group/t/wp7702-using-spi/1188>\
**Category:** mangOH Red\
**Created:** [February 21, 2018, 7:09am UTC](https://mangoh.discourse.group/t/wp7702-using-spi/1188 "2018-02-21T07:09:04Z")\
**Posts on this page:** 1\
**Showing post:** 41

<div class="post-metadata">

**Author:** ![Madan](https://avatars.discourse-cdn.com/v4/letter/m/6a8cbe/32.png) [@Madan](https://mangoh.discourse.group/u/Madan)\
**Post date:** [October 22, 2018, 12:23pm UTC](https://mangoh.discourse.group/t/wp7702-using-spi/1188/41 "2018-10-22T12:23:18Z")

</div>

Hello @davidc,

Thanks for the suggestion and it is inline with what I tried.

I did develop a Leato App to initiate some of the dependencies of our application. One of them is running the **spidev32766.1** initialization command as given by @dfrey.  
Initially, I tried keeping all the commands in a shell script. However, as it was lacking control on the results/returns, I made them as individual commands and executing from the Legato app. This app runs only once on a reboot.

The steps around this are as below…

1. execute the command for `spi32766.1` (channel\_config setup)
2. Start the `spiService`
3. Check for the spi devices (/dev/spi\*). Here I expect 2 devices (/dev/spidev.0 and /dev/spidev32766.1)
4. But for me, at this moment, spiService is failing because it’s not able to create /dev/spidev.0
5. So, restart the spiService and check again. (Steps 3 and 5 are executed for 5 times before the result is achieved). Mostly for the second or third time, the result is achieved.

Not sure why spiService is failing for the first executed though. (the error is - Failed to set the permissions for spidev.0, as the device is not created).

Though this is not a robust solution, it is working most of the times.

One question is - when a client application fails/terminates, the service also terminates.  
Is this by design? How can this be controlled i.e. not to terminate the service?  
Idea is to set a fault action to the client application to restart. In this case, the client fails because Service is not running.  
Let me know if any suggestions.

@asyal & @Bobby, this is one of the items on the Auto Start Issues that we are trying along with WiFi Configuration at Boot time.

> [@mangOH Red lost 192.168.2.2 IP & MT7697 Setup](https://mangoh.discourse.group/t/mangoh-red-lost-192-168-2-2-ip-mt7697-setup/1774/46):
>
> Hi All, I am running a script file through an application to bring up the wlan1 automatically. I have inserted the below command in /etc/init.d/mtwifi(at the end of start function) wpa\_supplicant -D wext \_b -i wlan1 -c your\_ssid.wpa\_supplicant.conf Modified the /etc/network/interfaces auto wlan1 iface wlan1 inet dhcp pre-up /etc/init.d/mtwifi start uart 1 post-down /etc/init.d/mtwifi stop 1 I have tested this from command, it works. Based on this above, created a script with a command i…

---

_[View the full topic](https://mangoh.discourse.group/t/wp7702-using-spi/1188)._
