Closed amyers-novacoast closed 8 years ago
Thanks for the PR. Great to see code contributed for L3.
The clock change seems a bit dangerous to me, and I think unnecessary. The Lepton 3 datasheet (preliminary one that I have at least) calls out 20 MHz as the maximum SPI clock rate; has this changed? I think we should adhere to the published limit, or if it's higher now, at least make sure that the faster clock does not break Lepton 2 by providing a means for backward compatibility in this application.
That being said, I was able to correctly download frames in Python from the L3 (and stay in sync) with an 18 MHz clock. Rather than increasing the clock speed, I was able to lower overhead by batching a bunch of VOSPI transfers in a single read ioctl after initial sync was established. The default spidev bufsiz is 4096 bytes so that's 24 VOSPI frames (4096 / VOSPI_FRAME_SIZE_BYTES = 24.97... ) that can be downloaded in a single ioctl. This technique would be worth trying for this application.
Also, in this PR, you've broken the spi_device
switch for people who have the Lepton on a different SPI CS (see: software/raspberrypi_video/SPI.cpp:40)
Closing to track in #33
Edited LeptonThread to correctly assemble the four segments given by Lepton 3 into a single image. Increased SPI speed to 32 MHz. Works on Rasberry Pi 3, but SPI speed is too fast for Raspberry Pi 2 (a SPI speed of 24 MHz is best for RBPi 2, but is still jumpy). Skips entire frames when not synced, rather than rendering half the image and creating tears.
-Andrew Myers Novacoast, Inc.