Comments (3)
Can you post the full code you are using to test this setup?
If you connect CLK to pin 14, you also need to issue startAltClockline() in addition to SPI.beginTransaction(SPISettings(20000000, MSBFIRST, SPI_MODE1)) and digitalWrite(pin_lepton_cs, LOW) to begin a transaction with the Lepton2.
What is the LeptonReadError retVal, when you try to read a package?
from diy-thermocam.
Hi Max, I'm using this code to test my Lepton module
I'm gonna use this fancy spoiler because the code is too long
#include "Wire.h"
#include "SPI.h"
#define USE_SPI1
/* Wiring
- SPI1
-- CS pin 6
-- MOSI pin 21
-- MISO pin 5
-- SCK pin 20
- SPI
-- CS pin 10
-- MOSI pin 11
-- MISO pin 12
-- SCK pin 13
*/
#ifdef USE_SPI1
#define pin_lepton_cs 6
#define pin_lepton_mosi (21)
#define pin_lepton_miso (5)
#define pin_lepton_sck (20)
#else
#define pin_lepton_cs (10)
#endif
void setup() {
// put your setup code here, to run once:
Wire.begin();
Serial.begin(115200);
Serial.println("Lepton module test");
#ifdef USE_SPI1
// Initiate lepton SPI
Serial.println("Init SPI1");
pinMode(pin_lepton_cs, OUTPUT);
digitalWriteFast(pin_lepton_cs, HIGH);
SPI1.setMISO(pin_lepton_miso);
SPI1.setMOSI(pin_lepton_mosi);
SPI1.setSCK(pin_lepton_sck);
SPI1.begin();
#else
// Initiate lepton SPI
Serial.println("Init SPI");
pinMode(pin_lepton_cs, OUTPUT);
digitalWriteFast(pin_lepton_cs, HIGH);
SPI.begin();
#endif
}
void loop() {
// put your main code here, to run repeatedly:
int line = 0;
byte leptonFrame[164];
byte imageFrame[60 * 164];
while (line != 60)
{
#ifdef USE_SPI1
// Start transaction
SPI1.beginTransaction(SPISettings(20000000, MSBFIRST, SPI_MODE1));
// Initiate CS pin
digitalWriteFast(pin_lepton_cs, LOW);
// Receive one frame over SPI
for (int i = 0; i < (164 / 2); i++){
// Read value via SPI
leptonFrame[2 * i] = SPI1.transfer(0x00);
leptonFrame[2 * i + 1] = SPI1.transfer(0x00);
}
// Disable CS pin
digitalWriteFast(pin_lepton_cs, HIGH);
// Stop transaction
SPI1.endTransaction();
#else
// Start transaction
SPI.beginTransaction(SPISettings(20000000, MSBFIRST, SPI_MODE1));
// Initiate CS pin
digitalWriteFast(pin_lepton_cs, LOW);
// Receive one frame over SPI
for (int i = 0; i < (164 / 2); i++){
// Read value via SPI
leptonFrame[2 * i] = SPI.transfer(0x00);
leptonFrame[2 * i + 1] = SPI.transfer(0x00);
}
// Disable CS pin
digitalWriteFast(pin_lepton_cs, HIGH);
// Stop transaction
SPI.endTransaction();
#endif
if ((leptonFrame[0] & 0x0F) != 0x0F){
if (leptonFrame[1] == line){
for (int i = 0; i < 164; i++){
// Save frame
imageFrame[(line * 164) + i] = leptonFrame[i];
}
line++;
}
}
}
// Print lepton frame ID
for (size_t i = 0; i < 60; i++)
{
Serial.printf("%02X\t", imageFrame[(164 * i) + 1]);
if (i % 10 == 9)
{
Serial.println();
}
}
Serial.println();
while (1);
}
The output should be like this
Lepton module test
Init SPI1
00 01 02 03 04 05 06 07 08 09
0A 0B 0C 0D 0E 0F 10 11 12 13
14 15 16 17 18 19 1A 1B 1C 1D
1E 1F 20 21 22 23 24 25 26 27
28 29 2A 2B 2C 2D 2E 2F 30 31
32 33 34 35 36 37 38 39 3A 3B
Somehow when I tried my code with CS at pin 15 and SCK at pin 14, it just hung up and never print any result (after init SPI) so I failed to replicate the same connection as DIY-Thermocam to make the lepton work.
the retVal value are 0,1, and sometimes 3
from diy-thermocam.
I am closing this issue now, as it's not directly related to the DIY-Thermocam.
from diy-thermocam.
Related Issues (20)
- DIYLepton_Connect()->Index was outside the bounds of the array HOT 1
- Building Instructions v3 Feedback: LED, Lipo Protector, Switch, Heatshrink, Slide Cover HOT 2
- Does the code described here work with DIY Thermocam V2 as well. I suspect the firmware is different. I hope all the other software is the same. Is there a link to the latest version of software for V2? HOT 1
- TP4057 Charging module no longer available HOT 8
- Lepton 3.1R Compatibility HOT 3
- About the FPS
- Raspberry Pi
- Help ! "firmware updater.exe" for DIY-thermocam V2 (Teensy 3.6) HOT 2
- VS Code is cool. What about others?
- Analysis of thermal images in FLIR TOOLS
- Incompatible with large storage micrSD cards (SDXC)
- DiyThermocam V2 Touch lcd HOT 2
- MTP device Windows 10 HOT 5
- Image transmission via wifi HOT 2
- finished my Themocam, a few remarks for the Enclosure HOT 5
- Having issues getting the firmware on Teensy HOT 4
- Step up converter overheating and powering down on battery HOT 2
- Can't find charging module HOT 3
- Lepton sensor diagnostic failed HOT 5
- Thermocam won't wake up
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diy-thermocam.