DLPC3479: Software reset through API

Part Number: DLPC3479
Other Parts Discussed in Thread: DLP4710EVM-LC

Tool/software:

Hello, 

When we use the API to control the DLPC3479, we observe that running our program a second time results in failure to connect to the I2C bus even though it connected fine the first time the application ran. We tried resetting the I2C through the cyusbserial.dll with the commands CyI2cReset (which resets the I2C module) and CyResetDevice (resets the serial bus) but the application still fails on the second run. Interestingly, if we power cycle the projector, our application can be re-run a second time without error. Do you have any ideas of why communication to the I2C bus fails the second time we try to run our application or ideas on how we can address this issue?

  • Hi Joshua,

    This is interesting, do you mind sharing a snippet of your code, especially how it terminates? Can you also run your code once with a logic analyzer to see if the I2C lines get hung at any point?

    Best,

    Maximus

  • Hi Joshua, 

    Are you still seeing this issue? I will close the thread for now, please feel free to respond and reopen if you have updated information.

    Best,

    Maximus

  • Hello Maximus,

    Sorry, I didn't receive a notification that someone responded to this thread and I got distracted by other projects. I've attached the code below:

    InitConnectionAndCommandLayer()
    
    bool Status = CYPRESS_I2C_RequestI2CBusAccess();
     if (Status != true)
     {
      printf("Error Request I2C Bus ACCESS!!!");
      return;
     }
    
    // Reading projector status to look for any errors
    DLPC34XX_DUAL_ReadShortStatus(&shortStat);
    DLPC34XX_DUAL_ReadSystemStatus(&systemStat);
    
    // Read DMD Device ID
    uint32_t dmdDeviceId = 0;
    DLPC34XX_DUAL_ReadDmdDeviceId(DLPC34XX_DUAL_DDS_DMD_DEVICE_ID,
                                            &dmdDeviceId);
    
    // Read COntroller Device ID
    DLPC34XX_DUAL_ControllerDeviceId_e ControllerDevID;
    DLPC34XX_DUAL_ReadControllerDeviceId(&ControllerDevID);
    
    
    uint16_t PatchVersion = 0;
    uint8_t MinorVersion = 0;
    uint8_t MajorVersion = 0;
    DLPC34XX_DUAL_ReadSystemSoftwareVersion(&PatchVersion, &MinorVersion,
                                                      &MajorVersion);
    
    DLPC34XX_DUAL_ReadFirmwareBuildVersion(&PatchVersion, &MinorVersion,
                                                     &MajorVersion);
    
    double SystemTemp = 0.0;
    DLPC34XX_DUAL_ReadSystemTemperature(&SystemTemp);
    
    //Enable Red LED
    DLPC34XX_DUAL_WriteRgbLedEnable(true, false, false);
    
    //Set Current to Red LED
    DLPC34XX_DUAL_WriteRgbLedCurrent(setRedLedCurrent, 0u, 0u);
    
    //Read back the value of LED current to verify that the write was successful
    bool RedLedEnable, GreenLedEnable, BlueLedEnable
    DLPC34XX_DUAL_ReadRgbLedEnable(&RedLedEnable, &GreenLedEnable,
                                                 &BlueLedEnable);
    
    //Set Trigger-In Polarity
    DLPC34XX_DUAL_WriteTriggerInConfiguration(DLPC34XX_DUAL_TE_ENABLE,
                                                        DLPC34XX_DUAL_TP_ACTIVE_HI);
    
    // Read back the polarity to verify
    DLPC34XX_DUAL_ReadTriggerInConfiguration(&TriggerEnabled, &TriggerInPolarity);
    
    //Display Patterns
    DLPC34XX_DUAL_PatternOrderTableEntry_s PatternOrderTableEntry;
    DLPC34XX_DUAL_WritePatternOrderTableEntry(DLPC34XX_DUAL_WC_RELOAD_FROM_FLASH, &PatternOrderTableEntry);
    
    DLPC34XX_DUAL_WriteOperatingModeSelect(DLPC34XX_DUAL_OM_SENS_INTERNAL_PATTERN);
    
    DLPC34XX_DUAL_WriteInternalPatternControl(DLPC34XX_DUAL_PC_START, 0xFF);
    printf("Pattern display started.\n");
    
    Sleep(3000);
    
    DLPC34XX_DUAL_WriteInternalPatternControl(DLPC34XX_DUAL_PC_STOP, 0);
    printf("Pattern display stopped.\n");
    
    //Close I2C Bus
    CYPRESS_I2C_RelinquishI2CBusAccess();

  • I'll update this thread once I get results from the Logic Analyzer.

  • Hi Joshua,

    Please update with the logic analyzer results and  I will take a closer look. 

    Best,

    Maximus

  • Hello Maximus,

    After studying the bus with the logic analyzer, the bus does not seem to be hung. Below is what we see:

    When we just look at the I2C bus before running our application, we see that the bus is active. Once we start our application, we see the bus communicating with our application (we see data getting transferred over the bus when we request it and pause when it's waiting for us to input information). Once we close the application, the bus returns to the state we observed before starting our application. Once we rerun our application, we successfully connect to the I2C bus (I mistakenly said earlier that we were not successfully connecting to the bus) but we get the following error:

    I2C Communcation Error; Invalid Command Detected; Invalid op-code ox%x. Our program seems to fail when we request the system status.

    However, when we try running the application a third time, our program runs successfully.

    Thanks in advance for your help and sorry for the delay!

  • Hello User,

    Thanks for the information. Please give our team some time to look into this issue further and we will get back to you as soon as possible. 

    Regards,

    Alex Chan

  • Hi Joshua,

    Thanks for updating me on this. Would you mind sending screenshots of the I2c transactions before, during, and after this issue? Please let me know if my understanding of the issue is correct:

    • At first I2C bus comes up as normal and your application runs successfully
    • I2C bus returns to normal (SDA/SCL both high)
    • Application is restarted and fails (invalid opcode?)
    • I2C bus returns normal (SDA/SCL both high)
    • 3rd iteration successful. 

    In this case does it always fail the second time? what is the delay between the first program iteration and second? What commands are you sending and have you verified they are sent as expected each time?

    Best,

    Maximus

  • Hello Maximus,

    Below is a picture of the output from the code I pasted above. The ****EVis Projector App**** denotes the start of the application. You can see that, in the first run, everything runs smoothly, but the second run, an error appears. In the third run, the system status is reported as good and the application again runs smoothly.

    Yes the application always fails the second time. The delay varies. We see it fail even after long delays between running the application. The commands we send are pasted in the post above and we verify that they were sent correctly based on the response we get from the function (which we print to the command line).

    Thanks for your help!

  • Hello Joshua,

    What is the delay between running each of these? If you run it a 4th time in a row does it fail? Can you share the code where "Invalid op-code: 0x%x" is reported? 

    If you are able to send the d3h command after getting the error this likely means either when the communication failure happens the DLPC is not ready or it is not receiving the data properly. I would suggest the following:

    • Make sure the command that fails and ultimately leads your code to read d3h is sent properly. 
    • Try adding some more delay between these two or checking that Host_IRQ has is not high before sending additional commands. 
    • Make sure the I2C communication is not violating any setup/hold times during the failed command.

    Best,

    Maximus

  • Hello Maximus,

    The timing between each successive run varies but it is around 10-15 seconds. If I run it a 4th time it does fail. I have attached the code where "Invalid op-code is output:

    ret = DLPC34XX_DUAL_ReadShortStatus(&shortStat);
        if (ret == 0)
        {
            if (shortStat.FlashError == DLPC34XX_DUAL_E_ERROR)
            {
                printf("Flash Error Detected\n");
                return false;
            }
            else if (shortStat.CommunicationError == DLPC34XX_DUAL_E_ERROR)
            {
                printf("I2C Communication Error Detected\n");
                ret = DLPC34XX_DUAL_ReadCommunicationStatus(&commStat);
                if (ret == 0)
                {
                    if (commStat.InvalidCommandError)
                    {
                        printf("Invalid Command Detected\n");
                        printf("Invalid op-code: %u\n", commStat.AbortedOpCode);


    I'll run the tests that you suggested and get back to you on the results.

    Thanks!

  • Hi Joshua,

    Please check with a logic analyzer your communication on the second attempt and share with your results from previous message.

    Best,

    Maximus

  • Hello Maximus,

    1. I'm not really sure how to test if the read_short_status command is sent properly.

    2. We used a logic analyzer to check the Host_IRQ and it is low when we send the commands. 

    3. We are using a board developed by another company that uses TI's chip so we don't have control over the timing of the I2C commands.

    Things we noticed after further testing:

    If we read the short status after using the projector to successfully display our patterns, we see the I2C Communication error. This makes us think that the I2C bus is in a bad state after displaying the patterns. Based on the code that was posted on July 1st, are we stopping the display of the projector properly? Also,is there a way to reset the I2C bus through the API? 

  • Hi Joshua,

    Does your logic analyzer have the ability to decode I2C? If so we would just like to see you connect the logic analyzer to the I2C bus so that we may see exactly what bits are sent, especially during your second attempt. You mention you are using a board from another company, is this an MCU board or something else? 

    If you are using the DLP4710EVM-LC (or a custom board which mirrors it) you should be able to use the CYPRESS_I2C_RelinquishI2CBusAccess(); as shown in the dlpc347x_samples.c

    Best,

    Maximus