after add LCD show code in main, the PD machine is repeat restarted, using CYPD2122-24

Announcements

Live Webinar: USB-C adoption. Simple & Cost-efficient solutions | April 18th @9am or 5pm CEST. Register now !

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

您好,

 

目前项目使用CYPD2122-24芯片,项目描述如前所述(用一个按键切充电头的输出电压,并显示电压值 PDO等参数)。

At present, the project uses CYPD2122-24 chip, and the project description is as mentioned before.

  1.  我用notebook参考代码,发现去掉bootloader后,可以运行但不能触发source充电头电压的切换。不知为何?目前代码空间有限,希望能去掉这个bootloader。

  1. I used the notebook reference code to find that after bootloader was removed, it could run but could not trigger the switching of the source charging head voltage. I don't know why? At present, the code space is limited, hoping to remove this bootloader.

  2.  在while(1)代码里添加电压值获取和显示代码((通过IIC总线驱动 TFT屏))后,CYPD2122一直在重复启动。电压值在5V, 0V, 5V, 0V....间变化。代码如下。

  2. after adding show code into the main function(through the IIC bus driver TFT screen), CYPD2122 is repeat restarted. The code is as follows.

main()

{

.....

......

   while(1) {

        type_c_state_machine();

        pe_state_machine();  

        cbl_discovery();

         //

         showpd();

   }

}

void showpd(void)

{

  getpdo();  //get pdo, voltage..... 

  drawfont(....); //show voltage

drawfont(....);  // show pdo parameters

drawfont(....); //show current

...

}

估计是显示代码刷屏时间长影响了PD machine,那这个pd machine能否放高优先级中断里处理的吗?还是有其他途径可解决冲突问题?

谢谢!

0 Likes
1 Solution
ShifangZ_26
Moderator
Moderator
Moderator
10 likes given 250 sign-ins 1000 replies posted

Hi ,

目前PD machine已经是最高优先级。目前能够建议您这边做的是,在显示代码往外刷的时候采用事件(例如有电压或者电流改变)中断机制或者timer的机制,不要放在while(1)里面。可以采用task模式进行调用。 因为您这边不需要一直刷新没有改变的数据。

Best Regards,

Lisa

View solution in original post

0 Likes
1 Reply
ShifangZ_26
Moderator
Moderator
Moderator
10 likes given 250 sign-ins 1000 replies posted

Hi ,

目前PD machine已经是最高优先级。目前能够建议您这边做的是,在显示代码往外刷的时候采用事件(例如有电压或者电流改变)中断机制或者timer的机制,不要放在while(1)里面。可以采用task模式进行调用。 因为您这边不需要一直刷新没有改变的数据。

Best Regards,

Lisa

0 Likes