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.

DLPLCR70EVM: Facing issue in loading image or bin file on DMD display.

Part Number: DLPLCR70EVM
Other Parts Discussed in Thread: DLP7000

Hi team, 

I have started automating it via MATLAB first but it seems impossible to me, now I am trying to automate it by directly loading *.dll and *.h files. 

I am not sure, where I am doing mistake. As, my code is running fine it's not showing any error, but it doesn't load image on DMD.

Any leads?

Code:

#include <iostream>
#include <fstream>
#include <vector>
#include "D4100_usb.h"
#include "CyAPI.h"
#include "RegisterDefines.h"
#include "8055.D4100_usb.h"
#include "windows.h"

#pragma comment(lib, "D4100_usb.lib")
#pragma comment(lib, "6562.D4100_usb.lib")
using namespace USB;
int main()
{

    short numDevices = GetNumDev();
    std::cout << "Number of Devices Connected: " << numDevices << std::endl;
    short DeviceNumber = numDevices - 1; // Only One device is connected.
    short dmdType = GetDMDTYPE(DeviceNumber); // should be 1(DLP7000)
    std::cout << "DMD Type 0.7XGA connected: (1 - Yes, 0 - No, -1 - No USB Connected) " << dmdType << std::endl;

    SetWDT(0, DeviceNumber); // Disable WDT
//x SetPWRFLOAT(0, deviceNumber); // Disable Power Float
    SetTPGEnable(1, DeviceNumber); // Disable TestPatternGenerator
    short usb_speed = GetUsbSpeed(DeviceNumber); // Get USB Speed (1 means high)
    SetBlkMd(0, DeviceNumber); // DMD Block Operations -- NOP
    LoadControl(DeviceNumber); // Load Control Register with the current settings of the DMD and execute the command.
   
    FILE *fp = fopen("test_smile.bin", "rb"); // load my own pattern
    unsigned char rowData[(1024 / 8) * 768];
    fread(rowData, sizeof(rowData), 1, fp); // prepare DMD pattern data from bin file.
    fclose(fp);

    SetBlkMd(0, DeviceNumber); // DMD Block Operations -- NOP
    LoadControl(DeviceNumber); // DMD Block Operations -- Execute!
    SetRowMd(3, DeviceNumber); // Set First row address
    SetNSFLIP(0, DeviceNumber);
    LoadControl(DeviceNumber); // Row Operations -- Execute!

    SetRowMd(1, DeviceNumber); // Increment internal row address by 1
    SetNSFLIP(0, DeviceNumber);
    LoadControl(DeviceNumber); // Row Operations -- Execute!

    ClearFifos(DeviceNumber); // Initialize the DMD fifo.
    LoadData(rowData, sizeof(rowData), dmdType, DeviceNumber);  // Load pattern into the DMD.

    SetBlkMd(3, DeviceNumber); // DMD Block Operations -- Global Reset Request
    SetBlkAd(30, DeviceNumber); // BLK_AD=4'b10xx
    LoadControl(DeviceNumber); // DMD Block Operations -- Execute!

    return 0;
}
Results shows
Number of Devices Connected: 1
DMD Type 0.7XGA connected: (1 - Yes, 0 - No, -1 - No USB Connected) 1

Build finished successfully.
* Terminal will be reused by tasks, press any key to close it.
  • Dear Aisha,

    I know that some have run into issues with the format of the DMD pattern data.  The data is formatted as data type char array.  This trips up quite a few people.  Let me know if this changes the issue.

    Fizix

  • If I am updating char* array to int array in .h files, it gives me error that char* array using in code is incompatible with int array. and when I am converting my bin file to char file it doesn't display any output on DMD. However, it shows the same built-in patterns of DMD everytime; when I am running my code.  

    Any suggestion??

  • Hi Aisha,

    I'm not familiar with this EVM's software, but could it be that this is tightly coupled to other functions that expect the parameter to be a char array still? That is my first thought unless that is what you meant by updating the include files. I would double-check anything that passes this as a parameter to make sure I have all instances. I am not sure if that is the most fool-proof way of doing it, however. It seems very error-prone to me if you must change many files without some tool that helps refactor this sort of thing.

    Regards,
    Michael Ly

  • Hi Michael,

    I am sure they are tightly coupled with other functions. 
    These two commands are in D4100_usb.h file 

    USB_DLL int program_FPGA(unsigned char* write_buffer, long write_size, short int DeviceNumber);
    
    USB_DLL int LoadData(unsigned char* RowData, long length, short DMDType, short int DeviceNumber);
    

    and similar to those are in 8055.D4100_usb.h file

    USB_DLL int program_FPGA(UCHAR *write_buffer, LONG write_size, short int DeviceNumber);
    
    USB_DLL int LoadData(UCHAR* RowData, long length, short DMDType, short DeviceNumber); 

    if I am converting them from UCHAR to Int - code below

    // D4100_usb.h - unsigned char* to int
    
    USB_DLL int program_FPGA(int write_buffer, long write_size, short int DeviceNumber);
    
    USB_DLL int LoadData(int RowData, long length, short DMDType, short int DeviceNumber);
    
    // 8055.D4100_usb.h
    
    USB_DLL int program_FPGA(int *write_buffer, LONG write_size, short int DeviceNumber);
    
    USB_DLL int LoadData(int* RowData, long length, short DMDType, short DeviceNumber); 

    they are displaying this error: 

    'int USB::LoadData(int,long,short,short)': cannot convert argument 1 from 'unsigned char [98304]' to 'int'

    argument of type "unsigned char *" is incompatible with parameter of type "int"

    I am still confuse how to sort out this. Any suggestion, please?


    Best wishes,

    Aisha

  • Hi Aisha,

    Please allow me some extra time to look into this. I'll be looking into the source doe provided by the GUI. I will also make a copy of your file on my local machine to double-check any errors and warnings that may have been missed.

    Are you also following the build instructions that make use of the makefile? I just want to make sure we do the same thing.

    Regards,
    Michael Ly

  • Hi Michael, 


    I am using VSCode for C++, for that i don't need a makefile. 
    Also, I found my mistake, I was updating char to int in header files but not updating my source code. So, Now it's working fine for me. I can now load a bin file to DMD - Successfully. 

    Thank you so much for your efforts and help, I really appreciate it. 

    Best wishes,
    Aisha