# Second SPI device while using LCD shield?

**URL:** <https://forums.openmv.io/t/second-spi-device-while-using-lcd-shield/1053>\
**Category:** OpenMV Boards\
**Created:** [December 21, 2018, 10:35pm UTC](https://forums.openmv.io/t/second-spi-device-while-using-lcd-shield/1053 "2018-12-21T22:35:45Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![kwiley](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwiley/32/42_2.png) [@kwiley](https://forums.openmv.io/u/kwiley)\
**Post date:** [December 21, 2018, 10:35pm UTC](https://forums.openmv.io/t/second-spi-device-while-using-lcd-shield/1053/1 "2018-12-21T22:35:45Z")

</div>

I presume the LCD shield is driven from the SPI bus, correct? The docs for the lcd MicroPython module don’t specifically describe the comms (the string “SPI” doesn’t even appear on that doc page), but it does say it utilizes pins P0, P2, P3, P6, P7, and P8, which looks very much like SPI access. As such, does this preclude using SPI with any other device? I believe a single SPI bus should be able to drive multiple SPI devices with careful use of the select lines, but some SPI devices don’t actually use the select lines very effectively, they just sort of assume the SPI comm channel is theirs alone.

Will a second SPI device work, and if so, which available free pin would make a good choice for the second selection line? P9 perhaps (assuming an M7 as opposed to an M4, on which I don’t think P9 is available)?

All of my MicroPython experience so far has been with PyBoard, which provides two separate SPI buses, so select line management has been less crucial in my other projects.

Thanks.

---

<div class="post-metadata">

**Author:** ![iabdalkader](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/iabdalkader/32/1169_2.png) [@iabdalkader](https://forums.openmv.io/u/iabdalkader)\
**Post date:** [December 22, 2018, 11:36pm UTC](https://forums.openmv.io/t/second-spi-device-while-using-lcd-shield/1053/2 "2018-12-22T23:36:09Z")

</div>

> I presume the LCD shield is driven from the SPI bus, correct?

Yes the LCD uses the only SPI bus available, you could either use two chip selects (any free pin will work, see the pinout) or bitbang SPI.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [December 22, 2018, 11:44pm UTC](https://forums.openmv.io/t/second-spi-device-while-using-lcd-shield/1053/3 "2018-12-22T23:44:55Z")

</div>

We really didn’t build our stack to allow two SPI devices at the same time. If you want to use the LCD shield with another SPI device we reconmend not using our LCD module but instead using the python sample code under examples and adding the second SPI device yourself.

---

<div class="post-metadata">

**Author:** ![kwiley](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwiley/32/42_2.png) [@kwiley](https://forums.openmv.io/u/kwiley)\
**Post date:** [December 23, 2018, 6:42am UTC](https://forums.openmv.io/t/second-spi-device-while-using-lcd-shield/1053/4 "2018-12-23T06:42:51Z")

</div>

Thanks for the input. Aside from driving a second SPI device, I would also be amenable to joining an M7 or H7 to a PyBoard and letting the PyBoard talk to further peripherals with its own SPI buses – but of course I would still have to connect the camera and the PyBoard. That could be done over UART perhaps, if it turned out that SPI was problematic with the LCD. I’ll think about it.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [December 23, 2018, 6:50am UTC](https://forums.openmv.io/t/second-spi-device-while-using-lcd-shield/1053/5 "2018-12-23T06:50:38Z")

</div>

Hi, I’m going to be updating the LCD driver this week with better code after the next IDE release. I can make the driver deinit the SPI bus after using it per image write call. You won’t see a performance impact but it will make things work such that our SPI bus use looks transparent.

---

<div class="post-metadata">

**Author:** ![kwiley](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwiley/32/42_2.png) [@kwiley](https://forums.openmv.io/u/kwiley)\
**Post date:** [December 23, 2018, 5:03pm UTC](https://forums.openmv.io/t/second-spi-device-while-using-lcd-shield/1053/6 "2018-12-23T17:03:31Z")

</div>

Cool. My M7 and LCD are still in the mail. I’m brand new to OpenMV. I had misunderstood the whole thing to be a “camera module” to some otherwise external central controller (a PyBoard), but I’m discovering that that line of reasoning doesn’t quite follow. For one thing, the M7 and H7 are actually more powerful than the PyBoard (there is a next-gen PyBoard in the works). Consequently, the PyBoard’s main appeal is its connectivity. Anyway, it’ll be nice to see what I can do with all the pieces at the same time.

BTW, another thing that would be really nice is a touchscreen. On Arduino, there is the Arducam shield, which is both an LCD and a user input interface (a touch screen) at the same time. That’s a much nicer approach to user control and input than sticking switches and pots all over a breadboard. While it might be possible to hack these other peripherals into the MicroPython world through I2C reverse engineering of some sort, a native shield or skin would be great too.

Cheers!

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [December 23, 2018, 5:58pm UTC](https://forums.openmv.io/t/second-spi-device-while-using-lcd-shield/1053/7 "2018-12-23T17:58:17Z")

</div>

We serious need community support to make that happen. Me an Ibrahim are stretched so thin.

---

<div class="post-metadata">

**Author:** ![kwiley](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwiley/32/42_2.png) [@kwiley](https://forums.openmv.io/u/kwiley)\
**Post date:** [December 23, 2018, 7:36pm UTC](https://forums.openmv.io/t/second-spi-device-while-using-lcd-shield/1053/8 "2018-12-23T19:36:36Z")

</div>

Yeah, I get that. No disrespect. I’m coming in pretty new here. I’ve been tinkering with PyBoard since the spring (late to that party too, I admit), but I’m not even foot in the door with OpenMV. I don’t have it in my possession yet. 🙂

Keep up the good work.

---

<div class="post-metadata">

**Author:** ![elight-spm](https://avatars.discourse-cdn.com/v4/letter/e/b2d939/32.png) [@elight-spm](https://forums.openmv.io/u/elight-spm)\
**Post date:** [December 24, 2018, 5:22pm UTC](https://forums.openmv.io/t/second-spi-device-while-using-lcd-shield/1053/9 "2018-12-24T17:22:15Z")

</div>

hello, i am working on a project of face detection along with wifi streaming. Is it possible to transmit face detection over wifi? i mean ,i want to see the detected face over wifi. Is that possible,i am facing problems in the coding part while doing that.Please help. I need to complete it as soon as possible.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [December 24, 2018, 9:13pm UTC](https://forums.openmv.io/t/second-spi-device-while-using-lcd-shield/1053/10 "2018-12-24T21:13:44Z")

</div>

Hi, please start a new forum thread. Note that you’re question is so… general. If you want to transmit data over WiFi it’s a socket interface so you need to provide some infrastructure on the receiving end of the data transfer.

---

<div class="post-metadata">

**Author:** ![kwiley](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwiley/32/42_2.png) [@kwiley](https://forums.openmv.io/u/kwiley)\
**Post date:** [January 11, 2019, 8:02am UTC](https://forums.openmv.io/t/second-spi-device-while-using-lcd-shield/1053/11 "2019-01-11T08:02:54Z")

</div>

> [@](#):
>
> Hi, I’m going to be updating the LCD driver this week with better code after the next IDE release. I can make the driver deinit the SPI bus after using it per image write call. You won’t see a performance impact but it will make things work such that our SPI bus use looks transparent.

Out of curiosity, and no pressure intended, did you code up the changes you mentioned above with regard to LCD control? Now that I actually have an M7 and an LCD module in hand, I’m all in on my initial projects, and one of the first things I’ll attempt is attaching a second SPI device to the board.

_EDIT: Actually, I see you suggestion earlier to simply work directly from the spi\_control\_1.py example. That seems like a good jumping off point for me, regardless of the status of the lcd module. No worries._

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [January 11, 2019, 8:17am UTC](https://forums.openmv.io/t/second-spi-device-while-using-lcd-shield/1053/12 "2019-01-11T08:17:27Z")

</div>

It’s on my todo list. I’m doing imglib expansion right now. Currently working on adding a lot of features to find\_blobs() so it’s at rough and exceeding parity with OpenCV.

---

<div class="post-metadata">

**Author:** ![kwiley](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwiley/32/42_2.png) [@kwiley](https://forums.openmv.io/u/kwiley)\
**Post date:** [January 11, 2019, 8:33am UTC](https://forums.openmv.io/t/second-spi-device-while-using-lcd-shield/1053/13 "2019-01-11T08:33:47Z")

</div>

Assuming the LCD shield correctly ignores SPI commands when its hardwired CS pin 3 is high, I should be able to move forward on my own. I’ll just use pin 9 for the CS to my other device and should be off and running. I’ll see how it goes.

Cheers!
