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 sequence not running using API

Other Parts Discussed in Thread: DLPC350

Hey,

Here is my code which I am using to structure my pattern sequence and send it to the DLC350. I am calling APIs in this block and then calling this block in the main.

I want to display 24 1-bit patterns in a sequence. I am using flash drive as the input source. My 24 bit image is stored at the index 3 of the flash drive.

I  have a good idea about the structure of my code, but when I am running it my code is not displaying the patterns and not showing sequence running in the status.

Can someone have a look at my code and tell me what I am doing wrong. I understand that it a bit of a work to read my code, however it will be a great help if someone can give me a feedback.

Thanks

Aamir

void LCr_StructuredLightMode()
{
    printf("LCr_StructuredLightMode\n");

    LCR_LoadSplash(3);

    LutEntry LutEntries[] = {
        {
            1,        // int TrigType
            0,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))
        },
        {
            3,        // int TrigType
            1,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))
        },
        {
            3,        // int TrigType
            2,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))
        },
        {
            3,        // int TrigType
            3,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))
        },
        {
            3,        // int TrigType
            4,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))
        },
        {
            3,        // int TrigType
            5,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))
        },
        {
            3,        // int TrigType
            6,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))
        },
        {
            3,        // int TrigType
            7,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))
        },
        {
            3,        // int TrigType
            8,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))
        },
        {
            3,        // int TrigType
            9,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))
        },
        {
            3,        // int TrigType
            10,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))
        },
        {
            3,        // int TrigType
            11,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))
        },
        {
            3,        // int TrigType
            12,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.RedOnly) ? 1 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))
        },
        {
            3,        // int TrigType
            13,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))
        },
        {
            3,        // int TrigType
            14,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))
        },
        {
            3,        // int TrigType
            15,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))
        },
        {
            3,        // int TrigType
            16,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))
        },
        {
            3,        // int TrigType
            17,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.BlueOnly) ? 4 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))

        },
        {
            3,        // int TrigType
            18,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.BlueOnly) ? 4 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))

        },
        {
            3,        // int TrigType
            19,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.BlueOnly) ? 4 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))

        },
        {
            3,        // int TrigType
            20,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.BlueOnly) ? 4 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))

        },
        {
            3,        // int TrigType
            21,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.BlueOnly) ? 4 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))

        },
        {
            3,        // int TrigType
            22,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.BlueOnly) ? 4 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))

        },
        {
            3,        // int TrigType
            23,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.BlueOnly) ? 4 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            false,    // bool InsertBlack
            true,    // bool BufSwap
            false    // bool trigOutPrev))

        }
/*        {
            3,        // int TrigType
            24,        // int PatNum
            1,        // int BitDepth
            (GlobalOptions.RGB || GlobalOptions.BlueOnly) ? 4 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
            false,    // bool InvertPat
            true,    // bool InsertBlack
            false,    // bool BufSwap
            false    // bool trigOutPrev))

        }*/
    };

    int NumberOfLutEntries = (sizeof(LutEntries) / sizeof(LutEntry));
    
    // Verify LUT entries by printing it
    for (int ii = 0; ii < 24; ii++)
    {
        printf("LutEntries: %d\n", LutEntries[ii].TrigType);
        printf("LutEntries: %d\n", LutEntries[ii].PatNum);
        printf("LutEntries: %d\n", LutEntries[ii].BitDepth);
        printf("LutEntries: %d\n", LutEntries[ii].InvertPat);
        printf("LutEntries: %d\n", LutEntries[ii].InsertBlack);
        printf("LutEntries: %d\n", LutEntries[ii].BufSwap);
        printf("LutEntries: %d\n", LutEntries[ii].trigOutPrev);
        printf("---------------------------\n");
    }
   
    if (LCR_SetMode(true) < 0)                     // Pattern display mode
    {
        printf("Error LCR_SetMode\n");
        return;
    }

    if (LCR_PatternDisplay(0) < 0)                // Stop Pattern Display
    {
        printf("Error LCR_PatternDisplay\n");
        return;
    }

    if (LCR_SetInputSource(2, 1) < 0)            // Flash, 24 bit
    {
        printf("Error LCR_SetInputSource\n");
        return;
    }

    if (LCR_SetPatternDisplayMode(false) < 0)    // Splash Memeory
    {
        printf("Error LCR_SetPatternDisplayMode\n");
        return;
    }

    LCR_ClearPatLut();

    for (int j = 0; j < NumberOfLutEntries; j++)
    {
        if (LCR_AddToPatLut(
            LutEntries[j].TrigType,
            LutEntries[j].PatNum,
            LutEntries[j].BitDepth,
            LutEntries[j].LEDSelect,
            LutEntries[j].InvertPat,
            LutEntries[j].InsertBlack,
            LutEntries[j].BufSwap,
            LutEntries[j].trigOutPrev
            ) < 0)
        {
            printf("Error LCR_AddToPatLut for index: %d\n", j);
            return;
        }
        printf("Pointer id: %d\n", &LutEntries[j]); // priniting memory addresses of member of  LUT table           
    }
    
    if (LCR_SetPatternConfig(
        NumberOfLutEntries /*numLutEntries*/,
        1 /*repeat*/,
        NumberOfLutEntries /*numPatsForTrigOut2*/,
        1 /*numSplashLutEntries*/) < 0)
    {
        printf("Error LCR_SetPatternConfig\n");
        return;
    }

    if (LCR_SetExposure_FramePeriod(EXPOSURE_PERIOD /*unsigned int exposurePeriod*/, FRAME_PERIOD /*unsigned int framePeriod*/) < 0)
    {
        printf("Error LCR_SetExposure_FramePeriod\n");
        return;
    }

    if (LCR_SetPatternTriggerMode(1) < 0)        // Internal triggers pattern
    {
        printf("Error Sending trigger Mode\n");
        return;
    }

    if (LCR_SendPatLut() < 0)
    {
        printf("Error LCR_SendPatLut\n");
        return;
    }

    unsigned char splashLut[1];
 
    printf("splashLut: %d\n", &splashLut[0]+45);        // Memory offset of 45 with the mem address of LutEntries[1]
    if (LCR_SendSplashLut(&splashLut[0]+45, 24) < 0)
    {
        printf("Error Sending Image LUT");
        return;
    }

    unsigned int status;
    if (LCR_ValidatePatLutData(&status) < 0)
    {
        printf("Error validating LUT data\n");
        return;
    }
    
    if (LCR_PatternDisplay(2) < 0) //Start pattern display
    {
        printf("Error starting pattern display\n");
        return;
    }

}

  • Hi Amir,

    There are couple of mistakes in the code; may be it is due to limited documentation around the APIs.

    You can do the below code changes -

    1. This API is not required LCR_LoadSplash(3); So you can delete this one.

    2. Always the 1st entry in the pattern LUT must be have buffer_swap flag set true, remaining can be kept as it is.

    LutEntry LutEntries[] =

    {
            {
                1,        // int TrigType
                0,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                true,    // bool BufSwap
                false    // bool trigOutPrev))
            },

    ...

    ...

    }

    Your Pattern LUT is size 24 1-bit pattern display.

    Since you wanted to display 24 1-bit patterns from Splash(3) and then second 24 1-bit patterns say from splash(4) so

    you have to change the setup the Splash LUT accordingly

    unsigned char splashLut[2];

    splashLut[0] = 3;

    splashLut[1] = 4;
      
    if (LCR_SendSplashLut(&splashLut[0], 2) < 0)
    {
         printf("Error Sending Image LUT");
         return;
     }

    This once you start the sequence, the 24 1-bit patterns would be displayed from splash #3 and the next 24 1-bit patterns from next splash #4.

    Regards,
    Sanjeev

  • Hey Sanjeev,

    I have tried this and its not working. It's just displaying the image stored at the index 0 in the flash drive for few microseconds and that it's. The status is not going to sequence running, It's always buffer frozen.

    I don't quite understand how this splashLut thing works. How does the DLC350 knows that it has to take the image stored at the index 3 of the flash. Also my LUT table is named LutEntries[ ] and in the API LCR_SendSplashLut(), i need to pass the index or pointer indicating the index of my LutEntries[1], right? At least this is what I understood. But when I print the pointer by printing &SplashLut[0] and &LUTEntries[0], I don't get the same value, there is a offset of 45. Why is that?

    Can you please explain this to me? Thank you

    Also, in the last entry to the pattern LUT should have buffer swap = true, no?

    Also, find below my modified code for your reference.


    Best,

    Aamir

    ------------------------------------------------------------------------------------------------------------------------------------------------------------------

    void LCr_StructuredLightMode()
    {
        printf("LCr_StructuredLightMode\n");

        LutEntry LutEntries[] = {
            {
                1,        // int TrigType
                0,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                true,    // bool BufSwap
                false    // bool trigOutPrev))
            },
            {
                3,        // int TrigType
                1,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                false,    // bool BufSwap
                false    // bool trigOutPrev))
            },
            {
                3,        // int TrigType
                2,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                false,    // bool BufSwap
                false    // bool trigOutPrev))
            },
            {
                3,        // int TrigType
                3,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                false,    // bool BufSwap
                false    // bool trigOutPrev))
            },
            {
                3,        // int TrigType
                4,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                false,    // bool BufSwap
                false    // bool trigOutPrev))
            },
            {
                3,        // int TrigType
                5,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                false,    // bool BufSwap
                false    // bool trigOutPrev))
            },
            {
                3,        // int TrigType
                6,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                false,    // bool BufSwap
                false    // bool trigOutPrev))
            },
            {
                3,        // int TrigType
                7,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                false,    // bool BufSwap
                false    // bool trigOutPrev))
            },
            {
                3,        // int TrigType
                8,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                false,    // bool BufSwap
                false    // bool trigOutPrev))
            },
            {
                3,        // int TrigType
                9,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                false,    // bool BufSwap
                false    // bool trigOutPrev))
            },
            {
                3,        // int TrigType
                10,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                false,    // bool BufSwap
                false    // bool trigOutPrev))
            },
            {
                3,        // int TrigType
                11,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                false,    // bool BufSwap
                false    // bool trigOutPrev))
            },
            {
                3,        // int TrigType
                12,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.RedOnly) ? 1 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                false,    // bool BufSwap
                false    // bool trigOutPrev))
            },
            {
                3,        // int TrigType
                13,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                false,    // bool BufSwap
                false    // bool trigOutPrev))
            },
            {
                3,        // int TrigType
                14,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                false,    // bool BufSwap
                false    // bool trigOutPrev))
            },
            {
                3,        // int TrigType
                15,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                false,    // bool BufSwap
                false    // bool trigOutPrev))
            },
            {
                3,        // int TrigType
                16,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.GreenOnly) ? 2 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                false,    // bool BufSwap
                false    // bool trigOutPrev))
            },
            {
                3,        // int TrigType
                17,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.BlueOnly) ? 4 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                false,    // bool BufSwap
                false    // bool trigOutPrev))

            },
            {
                3,        // int TrigType
                18,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.BlueOnly) ? 4 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                false,    // bool BufSwap
                false    // bool trigOutPrev))

            },
            {
                3,        // int TrigType
                19,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.BlueOnly) ? 4 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                false,    // bool BufSwap
                false    // bool trigOutPrev))

            },
            {
                3,        // int TrigType
                20,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.BlueOnly) ? 4 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                false,    // bool BufSwap
                false    // bool trigOutPrev))

            },
            {
                3,        // int TrigType
                21,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.BlueOnly) ? 4 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                false,    // bool BufSwap
                false    // bool trigOutPrev))

            },
            {
                3,        // int TrigType
                22,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.BlueOnly) ? 4 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                false,    // bool BufSwap
                false    // bool trigOutPrev))

            },
            {
                3,        // int TrigType
                23,        // int PatNum
                1,        // int BitDepth
                (GlobalOptions.RGB || GlobalOptions.BlueOnly) ? 4 : GlobalOptions.Grayscale ? 7 : 0,        // int LEDSelect
                false,    // bool InvertPat
                false,    // bool InsertBlack
                true,    // bool BufSwap
                false    // bool trigOutPrev))

            }
        };

        int NumberOfLutEntries = (sizeof(LutEntries) / sizeof(LutEntry));    

        if (LCR_SetMode(true) < 0)                     // Pattern display mode
        {
            printf("Error LCR_SetMode\n");
            return;
        }

        if (LCR_PatternDisplay(0) < 0)                // Stop Pattern Display
        {
            printf("Error LCR_PatternDisplay\n");
            return;
        }

        if (LCR_SetInputSource(2, 1) < 0)            // Flash, 24 bit
        {
            printf("Error LCR_SetInputSource\n");
            return;
        }

        if (LCR_SetPatternDisplayMode(false) < 0)    // Splash Memeory
        {
            printf("Error LCR_SetPatternDisplayMode\n");
            return;
        }

        LCR_ClearPatLut();

        for (int j = 0; j < NumberOfLutEntries; j++)
        {
            if (LCR_AddToPatLut(
                LutEntries[j].TrigType,
                LutEntries[j].PatNum,
                LutEntries[j].BitDepth,
                LutEntries[j].LEDSelect,
                LutEntries[j].InvertPat,
                LutEntries[j].InsertBlack,
                LutEntries[j].BufSwap,
                LutEntries[j].trigOutPrev
                ) < 0)
            {
                printf("Error LCR_AddToPatLut for index: %d\n", j);
                return;
            }    
        }
        
        if (LCR_SetPatternConfig(
            NumberOfLutEntries /*numLutEntries*/,
            1 /*repeat*/,
            NumberOfLutEntries /*numPatsForTrigOut2*/,
            1 /*numSplashLutEntries*/) < 0)
        {
            printf("Error LCR_SetPatternConfig\n");
            return;
        }

        if (LCR_SetExposure_FramePeriod(EXPOSURE_PERIOD /*unsigned int exposurePeriod*/, FRAME_PERIOD /*unsigned int framePeriod*/) < 0)
        {
            printf("Error LCR_SetExposure_FramePeriod\n");
            return;
        }

        if (LCR_SetPatternTriggerMode(1) < 0)        // Internal triggers pattern
        {
            printf("Error Sending trigger Mode\n");
            return;
        }

        if (LCR_SendPatLut() < 0)
        {
            printf("Error LCR_SendPatLut\n");
            return;
        }

        unsigned char splashLut[1];
        splashLut[0] = 3;
                                                
        if (LCR_SendSplashLut(&splashLut[0], 1) < 0)   
        {
            printf("Error Sending Image LUT");
            return;
        }
        unsigned int status;
        if (LCR_ValidatePatLutData(&status) < 0)
        {
            printf("Error validating LUT data\n");
            return;
        }
        
        if (LCR_PatternDisplay(2) < 0) //Start pattern display
        {
            printf("Error starting pattern display\n");
            return;
        }

    }

  • This is the screen shot of the command line showing the status I am getting when I run my program.

  • Print the Status;

        unsigned int status;
        if (LCR_ValidatePatLutData(&status) < 0)
        {
            printf("Error validating LUT data\n");
            return;
        }

    This should tell if the Status is not showing any error.

    Since the API you are using for older firmware build, I suggest to revert to v2.0.0 firmware or you can rebuild the exe using the APIs from the GUI v3.0 (note APIs name changed LCR_xxx to DLPC350_xxx ) onwards.

    Regards,
    Sanjeev

  • Hey Sanjeev,

    Thank you for your reply.

    Yes I am doing that, the print status code is there in my program. Maybe there is a firmware issue. What is the difference between v3.0 and v2.0, apart from the name of course?

    Best,
    Aamir
  • Hi Aamir,

    You can find the difference from the readme txt file bundled in the v3.0 installer.

    What is status reporting? Are you seeing it as 0x00?

    Regards,
    Sanjeev
  • Hey Sanjeev,

    No I am not seeing 0x00. In my command line window all I am seeing is the same as the screen shot I posted before.

    Now I am writing my main by calling APIs from firmware v3. Let's see if it works. Because I have uploaded a new firmware in to the DLP with my image stored at the index 3 of the flash. However, the version of the firmware is 3.0. So may be that is the problem.

    Best,
    Aamir
  • Hey Sanjeev,

    I tried downgrading my firmware but now my PC is not recognizing the DLP anymore. How to solve this issue? Is there a way to erase the flash drive without connecting to the computer.

    Thanks