Page 1 of 1

Second SPI device while using LCD shield?

Posted: Fri Dec 21, 2018 5:35 pm
by kwiley
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.

Re: Second SPI device while using LCD shield?

Posted: Sat Dec 22, 2018 6:36 pm
by iabdalkader
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.

Re: Second SPI device while using LCD shield?

Posted: Sat Dec 22, 2018 6:44 pm
by kwagyeman
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.

Re: Second SPI device while using LCD shield?

Posted: Sun Dec 23, 2018 1:42 am
by kwiley
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.

Re: Second SPI device while using LCD shield?

Posted: Sun Dec 23, 2018 1:50 am
by kwagyeman
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.

Re: Second SPI device while using LCD shield?

Posted: Sun Dec 23, 2018 12:03 pm
by kwiley
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!

Re: Second SPI device while using LCD shield?

Posted: Sun Dec 23, 2018 12:58 pm
by kwagyeman
We serious need community support to make that happen. Me an Ibrahim are stretched so thin.

Re: Second SPI device while using LCD shield?

Posted: Sun Dec 23, 2018 2:36 pm
by kwiley
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.

I need help in my project ..

Posted: Mon Dec 24, 2018 12:22 pm
by elight-spm
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.

Re: Second SPI device while using LCD shield?

Posted: Mon Dec 24, 2018 4:13 pm
by kwagyeman
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.

Re: Second SPI device while using LCD shield?

Posted: Fri Jan 11, 2019 3:02 am
by kwiley
kwagyeman wrote:
Sun Dec 23, 2018 1:50 am
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.

Re: Second SPI device while using LCD shield?

Posted: Fri Jan 11, 2019 3:17 am
by kwagyeman
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.

Re: Second SPI device while using LCD shield?

Posted: Fri Jan 11, 2019 3:33 am
by kwiley
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!