Lepton 3 frame synch

Tagged: 

This topic contains 4 replies, has 3 voices, and was last updated by Profile photo of Robert Robert 2 months, 3 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)

  • Author

    Posts

  • #5322

    Profile photo of John
    John

    Participant

    Hello all,
    I am having major issues synchronizing a full frame on the Lepton 3. My current configuration uses the getting started package, https://github.com/groupgets/LeptonModule/tree/master/software/beagleboneblack_video, running on Debian Stretch. The unmodified, default behavior of the application when executed results in the initialized red square successfully displaying, but “LeptonThread” hangs in the while loop.

    I modified the code in LeptonThread.cpp to parse the 4-byte header of each packet just to verify valid packet IDs AND to verify the segment ID on packet #20. This transaction is performed 4 times (4 segments).

    SPI.cpp was modified to set the clock rate to 20MHz.

    Pseudo code for the data retrieval process in LeptonThread.cpp looks like this:
    **********************************************************************************************
    `headerData[240] //1 header per packet; 240 packets per frame
    //assume the size of a headerData element is 4 bytes to support entire header
    //LOOP THROUGH ALL 4 SEGMENTS (ONE FULL FRAME)
    FOR I=0; I<4; I++
    segment = getSegment(I) //grabs packets 0-59 of segment I over SPI interface
    IF I==0 //perform data verification on 1st segment
    IF containsDiscardPacket(segment) OR NOT hasValidSegmentID(segment) //segment ID must be 1!!!
    I– //invalid segment received; we are not in sync; try again
    sleep(0.2) //sleep for just over 185ms to reset VoSPI of Lepton
    continue
    FOREACH packet IN segment //if we’ve reached this point, it is safe to assume sync’d, valid packets
    header = getHeader(packet) //get the header– assume byte-swapping takes place too
    headerData.push(header)<br /><br />
    *********************************************************************************************
    Okay, at this point a full frame should have been received. But when the packet headers are dumped, here is the output (or some other output combination with discard packets randomly strewn in the data along with random segment IDs):
    PACKET_ID SEGMENT_ID
    ——— START SEGMENT 1 ——–
    0
    1

    20 1

    59
    ——— END SEGMENT 1 ———
    ——— START SEGMENT 2 ——-
    FF (discard)
    FF (discard)
    FF (discard)
    FF (discard)
    FF (discard)
    0
    1

    20 0

    54
    ———–END SEGMENT 2————–
    ———–START SEGMENT 3 ————-
    55

    59
    FF (discard)
    FF (discard)

    FF (discard)
    0
    1

    20 1
    ————-END SEGMENT 3 —————
    ————START SEGMENT 4————–
    21
    22

    59
    FF
    FF
    FF

    FF
    0 0

    13
    ————— END SEGMENT 4 —————–</p><br />
    The first segment is always received as expected, but the other 3 segments have strange things happening.

    Can someone please help me figure out why this Lepton 3 is not synchronizing properly? What am I doing wrong? Is it a SPI CLK issue? At first glance, I assumed that segments were not being polled quickly enough (Lepton documentation states that we must poll a full segment in under 1/106th seconds?) But I have the SPI CLK throttled to 20MHz which you would think would be fast enough. I’ve played around with 10MHz, 15MHz, and other combinations under 20MHz.

    Thank you for reading this very long post and for any help that can be offered!

    • This topic was modified 2 years, 11 months ago by Profile photo of John John. Reason: Formatting
    • This topic was modified 2 years, 11 months ago by Profile photo of John John. Reason: HTML cleanup

    #5325

    Profile photo of John
    John

    Participant

    I apologize for the formatting of pseudo code above. Hopefully this is more readable:

    headerData[240] //1 header per packet; 240 packets per frame
                    //assume the size of a headerData element is 4 bytes to support entire header
    //LOOP THROUGH ALL 4 SEGMENTS (ONE FULL FRAME)
    FOR I=0; I<4; I++
        segment = getSegment(I) //grabs packets 0-59 of segment I over SPI interface
        IF I==0 //perform data verification on 1st segment
            IF containsDiscardPacket(segment) OR NOT hasValidSegmentID(segment) //segment ID must be 1!!!
            I-- //invalid segment received; we are not in sync; try again
            sleep(0.2) //sleep for just over 185ms to reset VoSPI of Lepton
            continue
        FOREACH packet IN segment //if we've reached this point, it is safe to assume sync'd, valid packets
            header = getHeader(packet) //get the header-- assume byte-swapping takes place too
            headerData.push(header)

    #5326

    Profile photo of John
    John

    Participant

    Wow folks, I am ignorant… Here is the pseudo code again since the post won’t allow me to edit:

    headerData[240] //1 header per packet; 240 packets per frame
                    //assume the size of a headerData element is 4 bytes to support entire header
    //LOOP THROUGH ALL 4 SEGMENTS (ONE FULL FRAME)
    FOR I=0; I<4; I++
        segment = getSegment(I) //grabs packets 0-59 of segment I over SPI interface
        IF I==0 //perform data verification on 1st segment
            IF containsDiscardPacket(segment) OR NOT hasValidSegmentID(segment) //segment ID must be 1!!!
                I-- //invalid segment received; we are not in sync; try again
                sleep(0.2) //sleep for just over 185ms to reset VoSPI of Lepton
                continue
        FOREACH packet IN segment //if we've reached this point, it is safe to assume sync'd, valid packets
            header = getHeader(packet) //get the header-- assume byte-swapping takes place too
            headerData.push(header)
    • This reply was modified 2 years, 11 months ago by Profile photo of John John.
    • This reply was modified 2 years, 11 months ago by Profile photo of John John.

    #12550

    Profile photo of rober
    rober

    Participant

    Actually, that is technically good. Or if you not get any technical things properly then you will do one thing just get some tutorial and get it properly.

    I also have Canon printer error code 1660

    #18450

    Profile photo of Robert
    Robert

    Participant

    The posted was very informative and useful. You people are doing a great job. Keep going. It help me to resolve.

    But my printer always goes Canon support code 1660

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.