Community Translation - FX3: IsBootLoaderRunning() Function in libcyusb Linux - KBA231809

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

cross mob
Kenshow
Level 8
Level 8
Distributor - Marubun (Japan)
50 solutions authored 25 solutions authored 10 solutions authored

Hi,               

 I would like to translate KBA231809 into Japanese.

Please confirm to my work.

 Thanks,
Kenshow

1 Solution
Kenshow
Level 8
Level 8
Distributor - Marubun (Japan)
50 solutions authored 25 solutions authored 10 solutions authored

Hi Jenna-san,

                                

Japanese translation was over.
Please check below.

 

Original KBA:

FX3: IsBootLoaderRunning() Function in libcyusb Linux - KBA231809

 

Thanks.

Kenshow

==============================

 

タイトル: FX3:libcyusb LinuxIsBootLoaderRunning()関数 - KBA231809

 

バージョン:**

 

質問: FX3のブートローダがLinux SDKを使用して実行されているかどうか、またはFX3 Linux SDKのIsBootLoaderRunning()関数に相当するものを確認するにはどうすればよいですか?

回答:

FX3 Linux SDKには、FX3ブートローダが実行されているかどうかを確認するための特定の機能はありません。

しかし、制御転送(cyusb_control_transfer()関数)により、ベンダーコマンド0xA0を使用して機能を実現することができます。

ベンダーコマンド0xA0は、ファームウェアのダウンロードとアップロードのためにFX3ブートローダに実装されており、同じコマンドを使ってFX3がブートローダモードになっているかどうかを確認することができます。

リクエストコード0xA0の1バイトIN制御転送が開始されます。制御転送が成功してバイトを返せば、ブートローダは実行中です。

制御転送パラメータ:

bRequest = 0xA0;

bmRequestType = 0xC0;

wValue = 0x0000;

wIndex = 0x0000;

wLength = 1;

FX3 Linux SDKからの制御伝達関数プロトタイプ:

int cyusb_control_transfer (cyusb_handle *h, unsigned char bmRequestType,

unsigned char bRequest, unsigned short wValue,

unsigned short wIndex, unsigned char *data,

unsigned short wLength, unsigned int timeout);

サンプルコード:

int num = cyusb_open();

printf("number of devices = %d\n", num);

if (num <= 0)

return -1;

cyusb_handle *h = cyusb_gethandle(0);

unsigned short vid = cyusb_getvendor(h);

unsigned short pid = cyusb_getproduct(h);

printf("vid = %04x,  pid  = %04x\n" , vid, pid);

unsigned char bmReqType = 0xC0;

unsigned char bRequest = 0xA0;

unsigned short wValue = 0x0000;

unsigned short wIndex = 0x0000;

unsigned short wLength = 1;

unsigned char buf_data[1] = {0};

unsigned int timeout = 5000;

int retval = cyusb_control_transfer (h, bmReqType, bRequest, wValue, wIndex, buf_data, wLength, timeout);

if(retval>0)

printf("fx3 bootloader running\n");

else

printf("fx3 bootloader not running\n");

 

==============================

5-Feb-2021
Kenshow

View solution in original post

3 Replies
JennaJo
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hi, Kenshow-san

Confirm to work this KBA.

Thanks,

Jenna 

Jenna Jo
0 Likes
Kenshow
Level 8
Level 8
Distributor - Marubun (Japan)
50 solutions authored 25 solutions authored 10 solutions authored

Hi Jenna-san,

                                

Japanese translation was over.
Please check below.

 

Original KBA:

FX3: IsBootLoaderRunning() Function in libcyusb Linux - KBA231809

 

Thanks.

Kenshow

==============================

 

タイトル: FX3:libcyusb LinuxIsBootLoaderRunning()関数 - KBA231809

 

バージョン:**

 

質問: FX3のブートローダがLinux SDKを使用して実行されているかどうか、またはFX3 Linux SDKのIsBootLoaderRunning()関数に相当するものを確認するにはどうすればよいですか?

回答:

FX3 Linux SDKには、FX3ブートローダが実行されているかどうかを確認するための特定の機能はありません。

しかし、制御転送(cyusb_control_transfer()関数)により、ベンダーコマンド0xA0を使用して機能を実現することができます。

ベンダーコマンド0xA0は、ファームウェアのダウンロードとアップロードのためにFX3ブートローダに実装されており、同じコマンドを使ってFX3がブートローダモードになっているかどうかを確認することができます。

リクエストコード0xA0の1バイトIN制御転送が開始されます。制御転送が成功してバイトを返せば、ブートローダは実行中です。

制御転送パラメータ:

bRequest = 0xA0;

bmRequestType = 0xC0;

wValue = 0x0000;

wIndex = 0x0000;

wLength = 1;

FX3 Linux SDKからの制御伝達関数プロトタイプ:

int cyusb_control_transfer (cyusb_handle *h, unsigned char bmRequestType,

unsigned char bRequest, unsigned short wValue,

unsigned short wIndex, unsigned char *data,

unsigned short wLength, unsigned int timeout);

サンプルコード:

int num = cyusb_open();

printf("number of devices = %d\n", num);

if (num <= 0)

return -1;

cyusb_handle *h = cyusb_gethandle(0);

unsigned short vid = cyusb_getvendor(h);

unsigned short pid = cyusb_getproduct(h);

printf("vid = %04x,  pid  = %04x\n" , vid, pid);

unsigned char bmReqType = 0xC0;

unsigned char bRequest = 0xA0;

unsigned short wValue = 0x0000;

unsigned short wIndex = 0x0000;

unsigned short wLength = 1;

unsigned char buf_data[1] = {0};

unsigned int timeout = 5000;

int retval = cyusb_control_transfer (h, bmReqType, bRequest, wValue, wIndex, buf_data, wLength, timeout);

if(retval>0)

printf("fx3 bootloader running\n");

else

printf("fx3 bootloader not running\n");

 

==============================

5-Feb-2021
Kenshow

JennaJo
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hi, Kenshow-san

Thank you for your work.

FX3:libcyusb LinuxのIsBootLoaderRunning()関数 - KBA23... - Cypress Developer Community

It has been published as above, let you know there is any issues to update. 

You will be received the score based on your words#.

However, currently the scoring system is now working on.

I will be back to this Thread - when we finalize the score system by end of Feb. 

Thanks,

Jenna Jo
0 Likes