This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Pattern keeps repeating on Lightcrafter 4500 EVM

Other Parts Discussed in Thread: DLPC350

Hi,

we have trouble to make our Lightcrafter 4500 stop after completing the sequence. Currently our sequence consists of 24 patterns (mixed binary and gray scale), which are stored in 24 images (uploaded with the GUI, I know one could store them in less, but I thought it would be easier if every pattern is one image). We want the Lightcrafter to project the sequence once, but currently it keeps repeating the sequence three or four times and stops in the middle of the sequence. This is the pseudo code we use to setup the projector:

DLPC350_USB_Init();
DLPC350_USB_Open();
if not DLPC350_USB_IsConnected() then quit

DLPC350_SetPowerMode(false);
DLPC350_SetMode(false); //We need to set it to video mode after standby, otherwise it wouldn't do anything

DLPC350_SetMode(true);
DLPC350_PatternDisplay(0);
DLPC350_SetPatternDisplayMode(false);
DLPC350_ClearPatLut();
DLPC350_ClearExpLut();
DLPC350_SetPatternTriggerMode(1);
DLPC350_SetExposure_FramePeriod(166666, 166666);

for (i = 0 to 23) {
  imageIndices[i] = i;
  DLPC350_AddToPatLut(0, 0, 8, 7, false, false, true, false);
}

DLPC350_SendImageLut(imageIndices, 24);
DLPC350_SendPatLut();
DLPC350_SetPatternConfig(24, 0, 0, 24);
DLPC350_ValidatePatLutData(&status);

DLPC350_PatternDisplay(2);

wait for user pressing Return
DLPC350_PatternDisplay(0);
DLPC350_SetPowerMode(true);

SetPatternConfig repeat is set to false. I don't really see the reason why the pattern keeps repeating. Also after the sequence we go into standby. After the wakeup we need to switch to video mode and back to pattern mode. Is this expected or is there also an error? Any help would be highly appreciated. 

Cheers,
Jan

  • Hi Jan,

    Thanks for your question and welcome to the DLP Forums. Please give me a little time to take a look at this code and get back to you. The behavior you're seeing (repeating) isn't expected, I'll need to take a deeper look to see why that might be happening.

    Something for you to try - can you try your code with a smaller (~10) sequence of just binary images and see if anything changes?

    Best,
    Paul
  • Hi Jan,

    Would you be able to provide more detailed code? I'd like to see the actual I2C or USB commands that you're sending - the pseudo code is a bit too abstracted.

    Thanks,
    Paul
  • Hi Paul,

    thanks for looking into this. I tried it with 10 and 2 patterns in the PatLut (adjusted SendImageLut and SetPatternConfig of course), but I can see the same behavior. It keeps repeating the sequence until some point when it just stops.

    Actually it is the 'real' code, I only added some pseudo loops, ifs and the like. I am using the API (dlpc350_api.h) that came with the GUI source. Here is a real world example:

    #include "hidapi/hidapi.h"
    #include "dlpc350_common.h"
    #include "dlpc350_usb.h"
    #include "dlpc350_api.h"
    #include <chrono>
    #include <thread>
    #include <iostream>
    
    
    int main(int argc, char *argv[]) {
        DLPC350_USB_Init();
        DLPC350_USB_Open();
        if (!DLPC350_USB_IsConnected()) {
            return -1;
        }
    
        DLPC350_SetPowerMode(false);
        std::this_thread::sleep_for(std::chrono::seconds(2));
        DLPC350_SetMode(false); //We need to set it to video mode after standby, otherwise it wouldn't do anything
    
        DLPC350_SetMode(true);
        DLPC350_PatternDisplay(0);
        DLPC350_SetPatternDisplayMode(false);
        DLPC350_ClearPatLut();
        DLPC350_ClearExpLut();
        DLPC350_SetPatternTriggerMode(1);
        DLPC350_SetExposure_FramePeriod(166666, 166666);
    
        const int numberOfPatterns = 24;
        const int startIndex = 3;
        unsigned char imageIndices[numberOfPatterns];
        for (int i = 0; i < numberOfPatterns; i++) {
          imageIndices[i] = startIndex + i;
          DLPC350_AddToPatLut(0, 0, 8, 7, false, false, true, false);
        }
    
        DLPC350_SendImageLut(imageIndices, numberOfPatterns);
        DLPC350_SendPatLut();
        DLPC350_SetPatternConfig(numberOfPatterns, 0, 0, numberOfPatterns);
        unsigned int status;
        DLPC350_ValidatePatLutData(&status);
    
        DLPC350_PatternDisplay(2);
    
        std::cout << "press enter" << std::endl; std::string str; std::getline(std::cin, str);
        DLPC350_PatternDisplay(0);
        std::this_thread::sleep_for(std::chrono::seconds(1));
        DLPC350_SetPowerMode(true);
    }

    It is compiled on Ubuntu 16.04 with libhidapi-dev 0.8.0 installed using this gcc 5.4.0:

    gcc -std=c++11 -o demo dlpc350_api.cpp dlpc350_usb.cpp dlpc350_common.cpp main.cpp -lstdc++ -lusb-1.0 -ludev -lhidapi-hidraw
    ./demo

    Again thanks for your time. Let me know if you need anything else from me.

    Cheers,
    jan

    Edit for clarification: The code above goes into main.cpp. The API files dlpc350_api.* dlpc350_common.* dlpc350_usb.* and dlpc350_error.h are copied into the same folder as main.cpp. The pattern images were uploaded to the projector using the GUI into the slots 3 to 26. The projector is connected through USB.

  • I didn't realize you were using the API. Thanks! I'll take a look and let you know if I can find any reason why you would be seeing what you are.

    Paul
  • Hi Jan,

    Can you try the following and see what the results are?

    #include "hidapi/hidapi.h"
    #include "dlpc350_common.h"
    #include "dlpc350_usb.h"
    #include "dlpc350_api.h"
    #include <chrono>
    #include <thread>
    #include <iostream>
    
    
    int main(int argc, char *argv[]) {
        DLPC350_USB_Init();
        DLPC350_USB_Open();
        if (!DLPC350_USB_IsConnected()) {
            return -1;
        }
    
        DLPC350_SetPowerMode(false);
        std::this_thread::sleep_for(std::chrono::seconds(2));
        DLPC350_SetMode(false);
        DLPC350_SetMode(true);
        DLPC350_SetPatternDisplayMode(false); //first set the input source for the pattern display
        DLPC350_SetPatternTriggerMode(1); //set trigger mode
        DLPC350_SetExposure_FramePeriod(166666, 166666); //set exposure
    
        const int numberOfPatterns = 24;
        const int startIndex = 3;
        unsigned char imageIndices[numberOfPatterns];
        for (int i = 0; i < numberOfPatterns; i++) {
          imageIndices[i] = startIndex + i;
          DLPC350_AddToPatLut(0, 0, 8, 7, false, false, true, false);
        }
    
        DLPC350_SendImageLut(imageIndices, numberOfPatterns); //send data to LUT
        DLPC350_SendPatLut(); //send data to LUT
        DLPC350_SetPatternConfig(numberOfPatterns, 0, 0, numberOfPatterns);
        unsigned int status;
        bool ready;
        DLPC350_StartPatLutValidate(); //start validation
        DLPC350_CheckPatLutValidate(&ready,&status); //check validation
    //Add code here to error check if the check validation returns any errors.
    
        DLPC350_PatternDisplay(2); //start pattern
    
        std::cout << "press enter" << std::endl; std::string str; std::getline(std::cin, str);
        DLPC350_PatternDisplay(0);
        std::this_thread::sleep_for(std::chrono::seconds(1));
        DLPC350_SetPowerMode(true);
    }
    

    I think perhaps the issue was the order of some of the commands as well as some unnecessary commands.

    Thanks,

    Paul

  • Another question for you as well. Can you describe what happens when the sequence just stops in the middle? Will it run correctly a few times and then stop? Is it a consistent failure?

    Just for reference, take a look at the GUI source code for implementation examples of these functions.
  • Hi Paul,

    yes the failure is consistent. It runs 10 complete sequences and fails in the middle of the 11th run. Afterwards it goes to black. I started the GUI to see the state and it showed Init Done: Green, Buffer Freeze: Yellow and Seq Abort: Red. After 2 seconds Seq Abort switched to Gray. Several reruns of the code are showing the same behavior.

    As suggested I had a look at the GUI code and added some debug output. It turned out that the parameter numPatsForTrigOut2 of DLPC350_SetPatternConfig need to be set to the pattern number, too. From the comments in the API code I got the impression that this parameter is only necessary in repeat mode.

    For reference here is the working example:

    #include "hidapi/hidapi.h"
    #include "dlpc350_common.h"
    #include "dlpc350_usb.h"
    #include "dlpc350_api.h"
    #include <chrono>
    #include <thread>
    #include <iostream>
    
    
    int main(int argc, char *argv[]) {
        DLPC350_USB_Init();
        DLPC350_USB_Open();
        if (!DLPC350_USB_IsConnected()) {
            return -1;
        }
    
        DLPC350_SetPowerMode(false);
        std::this_thread::sleep_for(std::chrono::seconds(2));
        DLPC350_SetMode(false); //We need to set it to video mode after standby, otherwise it wouldn't do anything
    
        DLPC350_SetMode(true);
        DLPC350_PatternDisplay(0);
        DLPC350_SetPatternDisplayMode(false);
        DLPC350_ClearPatLut();
        DLPC350_ClearExpLut();
        DLPC350_SetPatternTriggerMode(1);
        DLPC350_SetExposure_FramePeriod(166666, 166666);
    
        const int numberOfPatterns = 24;
        const int startIndex = 3;
        unsigned char imageIndices[numberOfPatterns];
        for (int i = 0; i < numberOfPatterns; i++) {
          imageIndices[i] = startIndex + i;
          DLPC350_AddToPatLut(0, 0, 8, 7, false, false, true, false);
        }
    
        DLPC350_SendImageLut(imageIndices, numberOfPatterns);
        DLPC350_SendPatLut();
        DLPC350_SetPatternConfig(numberOfPatterns, 0, numberOfPatterns, numberOfPatterns);
        unsigned int status;
        DLPC350_ValidatePatLutData(&status);
    
        DLPC350_PatternDisplay(2);
    
        std::cout << "press enter" << std::endl; std::string str; std::getline(std::cin, str);
        DLPC350_PatternDisplay(0);
        std::this_thread::sleep_for(std::chrono::seconds(1));
        DLPC350_SetPowerMode(true);
    }
    

    Thanks for your support,
    Cheers,
    Jan

  • Great catch, glad it's working now for you!! I appreciate the example you provided.

    Paul