开发板在StreamerExample模式下启动后切换到bootloader失败

公告

大中华汽车电子生态圈社区并入开发者社区- 更多资讯点击此

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

cross mob
Flute
Level 2
Level 2
10 replies posted First solution authored 25 sign-ins

我使用的开发板是CYUSB3KIT-003。开发板在StreamerExample模式下正常启动后,PC端通过EP0端口给开发板发送一个字节,开发板响应代码如下所示:

    if(itype == 64 && itarget == 2 && ireq_type==66 && irequest == 11)
    {
        CyU3PDebugPrint(6, "switch to bootloader\r\n");
        CyU3PUsbAckSetup ();
        CyU3PThreadSleep (10);
        app_stop();
        CyU3PDebugDeInit ();
        CyU3PUartDeInit ();
        //CyU3PConnectState(CyFalse, CyFalse);
        CyU3PUsbSetBooterSwitch (CyTrue);
        CyU3PUsbJumpBackToBooter (0x40078000);
        //CyU3PDeviceReset(CyTrue);
        while (1)
            CyU3PThreadSleep (100);
        bis_handled = CyTrue;
    }

 我希望它切换到bootloader模式,结果设备不见了,如下图所示:

Flute_0-1653531399744.png

怎样用代码从StreamerExample模式切换到bootloader模式呢?如下图所示:

Flute_2-1653531568814.png

 

 

0 点赞
1 解答
Roy_Liu
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 10 questions asked

这个不是代码控制的,而是CYUSB3KIT-003板子上的J4, 把J4 跳线帽插上就行。

Roy Liu

在原帖中查看解决方案

0 点赞
6 回复数
Roy_Liu
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 10 questions asked

Please set the PMODE pins to Z11 (USB Boot) which is equivalent to populating the jumper J4 on the explorer kit. After this, call the API CyU3PDeviceReset (CyFalse); as part of handling the command received from EP0.

请将PMODE引脚设置为Z11(USB boot),这相当于在explorer套件上接跳线J4。然后,调用API CyU3PDeviceReset(CyFalse);作为处理从EP0接收的命令的一部分。

Roy Liu
0 点赞
Flute
Level 2
Level 2
10 replies posted First solution authored 25 sign-ins

对不起,我不知道这个地方用代码怎么写,请再给一点提示。

Flute_0-1653548183596.png

我已经查找这个提问:Solved: About PMODE pin condition - Infineon Developer Community,知道了Z的意思,但还不知道如何用代码实现。请问是设置GPIO引脚吗? 

 

0 点赞
Roy_Liu
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 10 questions asked

这个不是代码控制的,而是CYUSB3KIT-003板子上的J4, 把J4 跳线帽插上就行。

Roy Liu
0 点赞
Flute
Level 2
Level 2
10 replies posted First solution authored 25 sign-ins

请问这个能不能用代码做得到?如果做不到,我就需要转变产品的实现思路。

0 点赞
Roy_Liu
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 10 questions asked

Yes,  you can control it using code.

The PMODE[2:0] lines are input pins that are used by the FX3 bootloader to decide the bootmode once the device comes out of reset. As you are using CYUSB3KIT-003, the J4 jumper can directly be used for setting the PMODE pins. If you are using a custom board, then you can drive the PMODE[2:0] lines externally using a controller or hardwire using pull-up or pull-down resistors. You can refer to the following thread to understand how the PMODE pins are interpreted by the device:
https://community.infineon.com/t5/USB-superspeed-peripherals/About-PMODE-pin-condition/m-p/91343#M72...

可以的。PMODE[2:0]线是输入引脚,FX3引导加载程序使用这些引脚来决定设备复位后的引导模式。当您使用CYUSB3KIT-003时,J4跳线可直接用于设置PMODE引脚。如果您使用的是定制板,那么您可以使用控制器或使用上拉或下拉电阻器的硬线从外部驱动PMODE[2:0]线。您可以参考以下帖子来了解设备如何解释PMODE引脚:

https://community.infineon.com/t5/USB-superspeed-peripherals/About-PMODE-pin-condition/m-p/91343#M72...

Roy Liu
0 点赞
Eddyi
Level 3
Level 3
25 sign-ins 10 replies posted 10 likes given

我猜你想实现的是在StreamerExample启动成功的条件下实现更新固件?你只需要在你的这段代码中加入修改EEPROM/Flash的语句,这样在下次重启时SPI boot/I2C boot就会失败,回退到USB boot,这样bootloader device就又出来了。一般实现在线更新的产品都是这么设计的。