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.

CCS/DLPNIRNANOEVM: Questions about pattern generation

Part Number: DLPNIRNANOEVM
Other Parts Discussed in Thread: DLPC150

Tool/software: Code Composer Studio

The DLPNIRscanNano works and now we want to send self-generated patterns to the DMD so that we can compare several NIRscanNanos with each other.
We know that the actual pattern generation takes place in the dlpspececlib. To understand how to generate a pattern we have looked at the column generation. Especially at the moment the file "dlpspec_scan_col.c" with the function "dlpspec_scan_col_genPatterns". Now we have some questions:

  1. Where is the value for numPatterns generated? Is it the Digital Resolution from the GUI?
  2. Are the patterns merged to buffers (16 or 24) for better handling or what does patterns_per_image mean?
  3. Is it possible (is there already) to store patterns on the SD card and use them?
  4. And we have one last question for now. Did we understand the procedure correctly? First the patterns are generated, then they are bent. Then x measurements are carried out and then the patterns are applied?

Best regards

Michael

int32_t dlpspec_scan_col_genPatterns(const patDefCol *patDefCol,
	   	const FrameBufferDescriptor *pFB, uint32_t startPattern)
/**
 * @brief Function to generate patterns for a column scan.
 *
 * This function takes the column pattern definition an writes the described
 * patterns to the frame buffer described in the frame buffer descriptor.
 *
 * @param[in]   patDefCol		Pointer to column pattern definition
 * @param[in]	pFB				Pointer to frame buffer descriptor where the 
 *								patterns will be stored
 * @param[in]   startPattern	Pattern number at which to start drawing
 *
 * @return  >0  Number of binary patterns generated from the pattern definition
 * @return  ≤0  Error code as #DLPSPEC_ERR_CODE
 */
{
	int i;
	RectangleDescriptor rect;
	int curPattern;
	int patterns_per_image;
    uint32_t curBuffer=0;
	int frameBufferSz = (pFB->width * pFB->height * (pFB->bpp/8));
	FrameBufferDescriptor frameBuffer;
    
	if ((patDefCol == NULL) || (pFB == NULL))
		return (ERR_DLPSPEC_NULL_POINTER);

	memcpy(&frameBuffer, pFB, sizeof(FrameBufferDescriptor));

	if(frameBuffer.bpp == 16)
		patterns_per_image=16;
	else
		patterns_per_image=24;

	/* Depending on startPattern, skip N buffers */
	curBuffer = startPattern/patterns_per_image;
	frameBuffer.frameBuffer += ((frameBufferSz/4)*curBuffer);
	curPattern = startPattern - curBuffer*patterns_per_image;

	for(i=0; i < patDefCol->numPatterns; i++)
	{
		if(curPattern % patterns_per_image == 0)
		{
			//First clear the area of interest
			rect.startX = 0;
			rect.startY = 0;
			rect.height = frameBuffer.height;
			rect.width = frameBuffer.width;
			rect.pixelVal = 0;
			DrawRectangle(&rect, &frameBuffer, true);
		}
        
        //Guard against rectangles drawn out of the left bound of the frame
        if((patDefCol->colMidPix[i] - patDefCol->colWidth/2) < 0)
            rect.startX = 0;
        else
            rect.startX = patDefCol->colMidPix[i] - patDefCol->colWidth/2;

		rect.startY = 0;
		rect.height = frameBuffer.height;
        
        //Guard against rectangles drawn out of the right bound of the frame
        if((rect.startX + patDefCol->colWidth) > pFB->width)
            rect.width = pFB->width - rect.startX;
        else
		    rect.width = patDefCol->colWidth;
        
		rect.pixelVal = 1 << (curPattern%patterns_per_image);

		DrawRectangle(&rect, &frameBuffer, false);
		curPattern++;
		if(curPattern % patterns_per_image == 0)
		{
			//Advance frame buffer pointer
			frameBuffer.frameBuffer += frameBufferSz/4;
			curBuffer++;
			if(curBuffer == frameBuffer.numFBs)
				break;
		}
	}
	
	return (patDefCol->numPatterns);
}

  • Michael,

    Thanks for your inquiry. What version of the NIRscan Nano EVM support code are you working with?

    Regards,

    Philippe Dollo

  • Dear Philippe,

    thank you for your answer. I work with following versions:

    • NIRscan Nano Reference Software: 2.1.0
    • DLP Spectrum Library: 2.0.3
    • DLPC150 Configuration and Support Firmware: 2.0.0

    Best regards,

    Michael

  • Hi Micheal, 

    kindly find the answer to your questions below:

    1. Where is the value for numPatterns generated? Is it the Digital Resolution from the GUI?

    A> Yes, you are correct. This is the digital resolution from the GUI.

    2. Are the patterns merged to buffers (16 or 24) for better handling or what does patterns_per_image mean?

    A> As the patterns used are all 1 bit patterns, we can club 24/16 of them in one picture. This is what this means. These generated frames combining the 1 bit patterns are then sent from TIVA MCU to DLPC150 controller.

    3. Is it possible (is there already) to store patterns on the SD card and use them?

    A> Sorry, this functionality is not yet available. 

    4. Did we understand the procedure correctly? First the patterns are generated, then they are bent. Then x measurements are carried out and then the patterns are applied?

    A> Kindly wait for sometime, we'll investigate more and get back soon!


    Thanks & Regards,

    Hirak.

  • Hi Hirak,

    thank you so much for the answers. Now I have a more detailed knowledge of the function of the NIRscanNano. I hope that you also write an answer for the fourth question.

    Best regards,

    Michael

  • Hi Michael, 

    This is taking a bit more time. Kindly stay tuned, we will reply with an answer soon. Thanks for your patience. 

    Regards,

    Hirak.

  • Hi Michael, 
    Kindly find the answer to your question below:

    4. Did we understand the procedure correctly? First the patterns are generated, then they are bent. Then x measurements are carried out and then the patterns are applied?

    A>Kindly find the outline of the scan process below:

    1. First the patterns are created, and then they are bent. This step is done when APPLYING a particular scan configuration.

    2. When SCAN command is received, scan procedure is kicked off. At the beginning of the scan, we take ADC measurements and fix the required PGA gain for the ADC. This is done in Scan_SetupGeneralScan() function. 

    3. Then we run the patterns, taking ADC value from the detector for every pattern using ADC interrupt. We also need to skip certain number of samples the beginning of each pattern that account for the transition between previous pattern voltage level and current pattern voltage level. 

    4. Accumulate and average out the readings for a single scan. 

    5. repeat step 3 and 4 depending on scan_num_repeats.

    Hope this helps.

    Thanks & Regards,

    Hirak.

  • Hi Hirak,

    Thank you very much for the detailed answer. Now the understanding of the scanning process is clearer.

    Best regards
    Michael

  • Hi Michael, 

    Glad to know I could help. Thanks for your interest in TI DLP Technology, have a great day!

    Thanks & Regards,

    Hirak.