LEPTON SDK and SPI functions

1,493 views
Skip to first unread message

Duc Nguyen

unread,
Oct 7, 2017, 9:19:57 AM10/7/17
to Flir Lepton
 Hi everyone,
 I'm using Lepton SDK_32bit. I'm using Nordic nrf52 to read/write data. But from the SDK what i see is only i2C related functions, no anything about SPI. 
 I don't know how and when i need to use the SPI to get the video/image from the camera. Does anyone have some experience in this ?
 Thanks alot.
LeptonSDKEmb32PUB.zipLeptonSDKEmb32PUB.zipLeptonSDKEmb32PUB.zip

Ben Kluwe

unread,
Oct 8, 2017, 3:17:56 AM10/8/17
to Flir Lepton
Hi Duc,

have you seen my previous post that details that you need to implement the SPI communication yourself (https://groups.google.com/forum/#!topic/flir-lepton/GokEIyHpdt4)?

The specifics for the communication are detailed in the specification (Section 9.2 @ http://www.flir.com/uploadedFiles/OEM/Products/LWIR-Cameras/Lepton/Lepton-3-Engineering-Datasheet.pdf).

Ben

Myzhar

unread,
Oct 9, 2017, 2:36:44 AM10/9/17
to Flir Lepton
Hi Duc,

as Ben told you in the SDK there are not functions to read the framebuffer and get the image from the Lepton3. The SDK is written only to communicate on I2C and so to control the parameters of the camera.
To better understand how the Lepton3 works you must read the Engineering Datasheet, it was the only document that was able to clarify me how that sensor works:

First of all the basis:
SPI -> VoSPI, image acquiring
I2C -> Parameters control

The VoSPI protocol is a bit tricky, you must pay a big attention to timing because if you lose one "segment" (read the datasheet to understand) you lose sync with the sensor and you must reset it.
Be carefull to the code you find related to previous Lepton sensors, VoSPI on Lepton3 is different from former sensors, mainly about sync losing.

I can help you with my code written for the BeagleBone/Lepton3 challenge: https://github.com/Myzhar/Lepton3_BBB
The VoSPI part is the same for every platforms, you must only change the "SPI" port, I think that the C/C++ code is well commented in the key parts, but do not hesitate to write me if something is not clear.

Walter

On Saturday, October 7, 2017 at 3:19:57 PM UTC+2, Duc Nguyen wrote:

Duc Nguyen

unread,
Oct 16, 2017, 10:40:04 PM10/16/17
to Flir Lepton
 Hi guys, how do you do?
 Thank you for your helps. and I need your helps again.
 
 For me, after spending days with Lep 2.5, here is my progress so far.
 Firstly, i still cannot control the I2C.
 Secondly, i compile "the sample code for the SPI/stm32nucleo_401re with mbed os " on nrf52DK and ThermalView). Source code is here: https://github.com/groupgets/LeptonModule/tree/master/software
- it shows one garbage image for every 4 minutes. So I think i lost the sync as Myzhar said but i don't know how to make it better currently.



 I do have some confusing:

 1. What is the default setting for Lepton(because i didn't send control through I2C but there is still data on SPI ?)
 2. What is the usage of LEP_GetSysFpaTemperatureKelvin ? Can i use this function to get the image overal temperature or something ?
 3. Can Lepton_Oem.h be used for Lepton 2.5 ? Why this oem header is not in the SKD released ? How to download it (or its release package) officially?
 4. What is the correct process for getting one frame? (for example: 1. Turn on Camera -> 2. Set Color profile -> 3. Set focus range/ AGC ..... -> 4. Read SPI video frame ???)
 5. I saw the shutter closing serveral times during the SPI tranfer. What does it means ? (Did the camera restart ?)

Myzhar

unread,
Oct 17, 2017, 2:35:20 AM10/17/17
to Flir Lepton
 1. What is the default setting for Lepton(because i didn't send control through I2C but there is still data on SPI ?)

You find them on the "Engineering datasheet", Lepton3 is "RAW 14", Telemetry Off, Radiometry ON, AGC OFF.
 
 2. What is the usage of LEP_GetSysFpaTemperatureKelvin ? Can i use this function to get the image overal temperature or something ?

It return the temperature of the sensor. Sometimes it is used as "room temperature" to convert RAW14 to real temperature
 
 3. Can Lepton_Oem.h be used for Lepton 2.5 ? Why this oem header is not in the SKD released ? How to download it (or its release package) officially?

Read the code, maybe it is a header made for the repository you are using and not by FLIR
 
 4. What is the correct process for getting one frame? (for example: 1. Turn on Camera -> 2. Set Color profile -> 3. Set focus range/ AGC ..... -> 4. Read SPI video frame ???)

Read the Engineering Datasheet... as far as you turn on the camera you get a video stream on VoSPI, I2C is not needed if you use default configuration
 
 5. I saw the shutter closing serveral times during the SPI tranfer. What does it means ? (Did the camera restart ?)

Radiometry cameras performs an FFC calibration each 5 minutes (if you read the Engineering Datasheet you can understand how).

Message has been deleted
Message has been deleted

Duc Nguyen

unread,
Oct 19, 2017, 11:04:32 PM10/19/17
to Flir Lepton
Hi,

I need your help again.

I have tried SPI these days, and still have no better result. My frame number is a like random number, not start from 0 -> 59. i use Lepton 2.5 and 3.0 also.

What i did like below: (Write 164bytes, one by one to SPI -> Receive a 164bytes packet.)
     -  I received alot of "Discard Packet" which has the ID (first 2byte = xFxx). After i remove these packets ( lepton_frame_packet[0]&0xf) != 0x0f) ), i still receive tons of packet frame = 0, and not from 0->59 as sequence.
     -  I also try to read a block of 164bytes at once, but the packet frame still the same.

And if i lower the frequency (to 2MHz), the number of received packet increase (as the 2 picture belows) (but also cannot meet 0->59).
Any suggestion for me ?





 



Many thanks.
Reply all
Reply to author
Forward
0 new messages