Intel Edison & Flir Lepton

1,207 views
Skip to first unread message

Alejandro Bancalari

unread,
Dec 2, 2014, 10:47:17 AM12/2/14
to flir-...@googlegroups.com
Has anyone had any luck interfacing the Intel Edison with the Lepton breakout board? I tried compiling the raspberry_pi_capture.c, wiring up to what I thought was all the correct SPI ports (it's a bit convoluted in all the documentation), and running ./a.out but runs into the "Error opening file"

Armando Mont

unread,
Jan 5, 2015, 8:59:32 AM1/5/15
to flir-...@googlegroups.com
very interesting... 

Armando Mont

unread,
Jan 12, 2015, 3:24:48 AM1/12/15
to flir-...@googlegroups.com

Cyrill

unread,
Jan 20, 2015, 11:45:48 AM1/20/15
to flir-...@googlegroups.com
Did anyone succeed with accessing the FLIR Lepton?

My experience so far:

I tried to access the lepton using the Edison Arduino breakout board with the Pure Engineering lepton breakout board, using pins 10 - 13 for CS, MOSI, MISO and CLK. I'm powering the lepton via its backside pins for VIN and GND with 3.3 volts.

I tried to access it with Arduino, node.js, python and C but was not successful with any of these.

Accessing the lepton on my RaspberryPi is completely straight forward. I did code my own program there as well, strictly considering the data sheet of the lepton:
  • SPI_MODE3, a clock rate between 2.2 to 20 MHz, MSB mode, 8 bits per word
  • Synchronizing with the device with CS high, >=185ms pause, CS low
  • Continuously reading 164 bytes, interpreting the first 2 bytes to check for “discard” packets or packet number respectively
This works like a charm on the RaspberryPi but implementing this with the Edison leads me to desperation.

When interpreting the first 2 bytes of the 164 byte packets, I’m only getting discard packets. But I’m quite sure that even the information about this “discard” is unreliable as analyzing the whole packets (164 bytes) let me doubt. Sometimes something like a “structure” is recognizable with the first 20 bytes set to anything > 0, then 8 bytes set to 0 and again 10 bytes set to anything > 0 with the remaining 126 bytes set to 0. At least when cutting power from the lepton while streaming on the SPI changes the pattern a little as packets then can either contain more 0 bytes or sometimes only 0 bytes. Other times the output seems completely random. Anyhow, compared to the output on the Pi, this is completely faulty information.

MRAA lib is up to date, Edison firmware as well.

I have attached my C program. When running it unaltered like attached, it should print packet numbers of received valid (non-discarded) packets. This print never occurs.
Just as a side note: Changing the SPI bus from 5 to 0 does not help as well (one finds various information on which bus to use on edison with its two breakout boards...).

Any help is appreciated!

lepton.c

Cyrill

unread,
Jan 22, 2015, 4:44:46 PM1/22/15
to flir-...@googlegroups.com
I finally succeeded with the lepton on the edison!

I had a painful small error in my code: When testing for discard packets, I missed the parenthesis around bitwise-AND (&) which lead to the precedence of the NOT_EQUAL (!=). So the correct check looks like this

if((recv[0] & 0x0f) != 0x0f)

I misguided myself here by the Pure Engineering Arduino sample code (https://github.com/PureEngineering/LeptonModule/blob/master/arduino_i2c/Lepton.ino) which shows the same error.

The attached code now successfully captures a still image from the lepton (using pins 10 - 13 for CS, MOSI, MISO and CLK), storing it as a PGM file under image.pgm.

Compile with:
gcc -lmraa -o lepton_capture lepton_capture.c
and have fun!

lepton_capture.c

Cyrill

unread,
Jan 22, 2015, 6:04:17 PM1/22/15
to flir-...@googlegroups.com
Sample code now listed on PureEngineering/LeptonModule GitHub: https://github.com/PureEngineering/LeptonModule/tree/master/edison_capture

bradatech

unread,
Jan 22, 2015, 11:33:59 PM1/22/15
to flir-...@googlegroups.com
wow, great find Cyrill and thanks for sharing your findings/contributions.

Yves

bradatech

unread,
Jan 22, 2015, 11:48:51 PM1/22/15
to flir-...@googlegroups.com
Just one question about connections to the Edison.  All is 1.8V, not 3.3V at the back of the Edison breakout from Sparkfun.  We've purchased the GPIO block from Sparkfun for the level shifting.

Is this what you're using as well?

thanks in advance.

Yves
Message has been deleted
Message has been deleted

Charles Allen

unread,
Mar 7, 2016, 1:35:21 PM3/7/16
to Flir Lepton
After a bit of hacking around I finally got the Edison working with the Lepton reliably.

https://communities.intel.com/thread/76768 sums up a lot of the issues I was having pretty well. I took https://github.com/primiano 's patch set and made a bitbake recipe out of it.

With that patch set and a custom module (not yet public... code needs some cleanup and a few minor bug fixes) against 1.6.1 (edison image 2.1 / kernel 3.10.17 - modified with the above recipe), I am able to get pretty-reliable reads from the Lepton.

Note that the Lepton seems HIGHLY sensitive to timings, so doing things like per-line CRC checking tends to make things get out of sync pretty regularly. A good asynchronous DMA implementation could potentially fix this, allowing per-line CRC validation.

Charles Allen

unread,
Mar 8, 2016, 2:40:09 AM3/8/16
to Flir Lepton
The Primiano patch set works well enough to take video:

Charles Allen

unread,
Mar 10, 2016, 12:55:56 AM3/10/16
to Flir Lepton

ninomu...@gmail.com

unread,
Mar 11, 2016, 1:42:44 PM3/11/16
to Flir Lepton
Hi, thanks a lot for your contribution! I am working in a project with Cyrills code, and i have a question, sorry if it is a bit stupid, but im a beginner. Can I use your meta-primiano-dma patch to get SPI working fine with Cyrills code (Lepton_capture)? What does this patch fix exactly?

ninomu...@gmail.com

unread,
Mar 17, 2016, 3:07:35 PM3/17/16
to Flir Lepton
I couldnt wait an answer and Ive tried DrAllen´s patch with my projects code (based on Cyrills) and it works great now, i got no fails!! So thanks a lot for your help, My project can advance now!!
Message has been deleted
Message has been deleted

Charles Allen

unread,
Mar 17, 2016, 9:16:03 PM3/17/16
to Flir Lepton
Awesome!

For clarification, the patchset I put up in https://github.com/drcrallen/meta-primiano-dma is not my code, but just a yocto friendly setup for https://github.com/primiano/edison-kernel

Glad it works.

For me I keep loosing the last 2 pixels per line. But at least the lines consistently make it through without loosing sync very often.
Reply all
Reply to author
Forward
0 new messages