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.

DLP4710EVM-LC: 关于dlpc347x_samples示例的问题,如果我调用任何写入相关的函数,程序就无法重复运行,必须断开投影仪的电源才能恢复

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

1.我用一个循环重复运行投影仪的示例代码dlpc347x_samples.c

//dlpc347x_samples.c
//main函数

    while (true)
    {
        InitConnectionAndCommandLayer();
        bool Status = CYPRESS_I2C_RequestI2CBusAccess();
        if (Status != true)
        {
            printf("Error Request I2C Bus ACCESS!!!");
            return;
        }
        DLPC34XX_ControllerDeviceId_e DeviceId = DLPC34XX_CDI_DLPC3479;
        DLPC34XX_ReadControllerDeviceId(&DeviceId);
        printf("Controller Devicde Id = %d \n", DeviceId);

        uint16_t PixelsPerLine, LinesPerFrame;
        DLPC34XX_ReadInputImageSize(&PixelsPerLine, &LinesPerFrame);
        printf("Input Image Size = 0x%x, 0x%x \n", PixelsPerLine, LinesPerFrame);

        LoadPreBuildPatternData();
        LoadPatternOrderTableEntryfromFlash();
        DLPC34XX_WriteTriggerOutConfiguration(DLPC34XX_TT_TRIGGER2,
            DLPC34XX_TE_ENABLE, DLPC34XX_TI_NOT_INVERTED, 0);

        DLPC34XX_WriteOperatingModeSelect(DLPC34XX_OM_SENS_INTERNAL_PATTERN);
        DLPC34XX_WriteInternalPatternControl(DLPC34XX_PC_START, 0x0);
        WaitForSeconds(3);

        if (CYPRESS_I2C_RelinquishI2CBusAccess())
        {
            printf("RelinquishI2CBusAccess\n\n");
        }
    }

运行结果如下,循环只成功执行了一次,随后卡住约10分钟自动退出

经过debug,发现代码在第二次循环调用CYPRESS_I2C_RequestI2CBusAccess()函数时,陷入在该函数的循环里,直到超时

    //cypress_i2c.c
    //bool CYPRESS_I2C_RequestI2CBusAccess()
    
    while ((time(NULL) - StartTime) < I2C_TIMEOUT_MILLISECONDS)
    {
        //printf("%d", &Value);
        if (!CYPRESS_I2C_GetCyGpio(I2C_ACCESS_GRANTED_GPIO, &Value))
        {
            break;
        }

        if (Value == 1)
        {
            if (!CYPRESS_I2C_SetCyGpio(START_I2C_TRANSACTION_GPIO, 1))
            {
                break;
            }

            CyI2cReset(s_Handle, false);
            CyI2cReset(s_Handle, true);

            return true;
        }
    }

2.后来我将主函数下的所有关于写入的函数注释掉,并再次运行,代码如下

//dlpc347x_samples.c
//main函数,移除写入操作
  
    while (true)
    {
        InitConnectionAndCommandLayer();
        bool Status = CYPRESS_I2C_RequestI2CBusAccess();
        if (Status != true)
        {
            printf("Error Request I2C Bus ACCESS!!!");
            return;
        }
        DLPC34XX_ControllerDeviceId_e DeviceId = DLPC34XX_CDI_DLPC3479;
        DLPC34XX_ReadControllerDeviceId(&DeviceId);
        printf("Controller Devicde Id = %d \n", DeviceId);

        uint16_t PixelsPerLine, LinesPerFrame;
        DLPC34XX_ReadInputImageSize(&PixelsPerLine, &LinesPerFrame);
        printf("Input Image Size = 0x%x, 0x%x \n", PixelsPerLine, LinesPerFrame);

        //LoadPreBuildPatternData();
        //LoadPatternOrderTableEntryfromFlash();
        //DLPC34XX_WriteTriggerOutConfiguration(DLPC34XX_TT_TRIGGER2,
        //    DLPC34XX_TE_ENABLE, DLPC34XX_TI_NOT_INVERTED, 0);

        //DLPC34XX_WriteOperatingModeSelect(DLPC34XX_OM_SENS_INTERNAL_PATTERN);
        //DLPC34XX_WriteInternalPatternControl(DLPC34XX_PC_START, 0x0);
        //WaitForSeconds(3);

        if (CYPRESS_I2C_RelinquishI2CBusAccess())
        {
            printf("RelinquishI2CBusAccess\n\n");
        }
    }

此时运行结果如下,循环正常运行

3.经过debug,我发现只要程序经DLPC_COMMON_SendWrite()函数成功写入过数据,主函数循环就只能执行一次。只能通过断电重置投影仪,再次运行出现同样的问题

这意味着投影仪无法正常待机,我每次使用投影仪必须先断开电源,请问如何解决?