i.MXRT1051. Disable/enable USB OTG2 for security reasons

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

i.MXRT1051. Disable/enable USB OTG2 for security reasons

跳至解决方案
1,366 次查看
vanessa_dis
Contributor III

Hello, I would like to disable USB OTG2 (by code) from imxrt1051 for security reasons, but i dont know how to do that.
And I would like to enable after in code way.

 

Do you have some idea?

 

Thank you

标签 (1)
标记 (3)
0 项奖励
1 解答
1,359 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi vanessa_dis,

   Do you connect the OTG1 and OTG2 in the hardware with the RT1051? If your hardware didn't connect the USB port, I think you even don't need to care about it. As it won't be used.

   From the reference manual, you can know:

kerryzhou_0-1621911605111.png

you can find the related OTG pins. 

So if you don't want to use it, you also can disable the related OTG pins, just don't select it as the OTG function.

 

Wish it helps you!

Kerry

   

  

在原帖中查看解决方案

0 项奖励
8 回复数
1,360 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi vanessa_dis,

   Do you connect the OTG1 and OTG2 in the hardware with the RT1051? If your hardware didn't connect the USB port, I think you even don't need to care about it. As it won't be used.

   From the reference manual, you can know:

kerryzhou_0-1621911605111.png

you can find the related OTG pins. 

So if you don't want to use it, you also can disable the related OTG pins, just don't select it as the OTG function.

 

Wish it helps you!

Kerry

   

  

0 项奖励
1,342 次查看
vanessa_dis
Contributor III

Another doubt that I have is..

if I change the functionality of these pins by code and also I activate serial download (which enable USB) mode of boot mode by hardware, which one is considered?

 

Thank you

0 项奖励
1,336 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi vanessa_dis,

   When you use the OTG, do you use the ehciPhy or not? if yes, I think you also can call this API:

USB_EhciPhyDeinit

  Deinit it.

  About the pin function switch, previously, I mean change the USB OTG function to other functions, eg, GPIO. In my previous reply picture, you can see it as the mode ALT selection, just don't select it as the USB.

  But, I think Deinit is also the good usage, as you know, when we use the module functions, normally will init it, if we don't want to use it, we also can call the deinit API to disable it.

  About your mentioned serial download (which enable USB) mode of boot, it will not be influence, as when you enter the serial download mode, the ROM will configure the related pin as the related function automatically, your code won't influence the serial download mode. I also check the BOOT_MOD pin, your OTG pins are not the BOOT_MODE pin. It's OK.

 

Wish it helps you!

Best Regards,

kerry

0 项奖励
1,330 次查看
vanessa_dis
Contributor III

Thank you again for you answer Kerry.

I'm a little confuse you know, because in the code there is not any definition of USB, and with the boot mode in fuses (I haven't burn the fuses) PC doesn't detect the board (correctly) but when I change the boot mode to serial downloader, PC detects the board.

Why this is happen if there is not any definition of USB?

0 项奖励
1,319 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @vanessa_dis 

  Thanks for your discussion.

  If you didn't burn the fuse, the boot mode mainly determined by the BOOT_MODE pin and the BOOT_CFG pins during the reset.

   Please note, the mode just selected when you reset the board, other time, no reset happens, the related pin can be used as the other function.

  Talk back to your issues, you mentioned, when enter serial download mode, the PC can detect your board, but when your switch to the Internal boot mode, your debugger can't detect it, right? Which method you mean about your PC detects? Debugger or USB recognition?

If you mean when in the serial down mode, the PC USB can detect it, it is correct, as the serial download mode is controlled by the ROM directly, ROM define the USB, customer can't change it, as this mode, USB HID is used for the code downloading.

May I understand your questions correctly?

If now, please help to give me more details about your issues.

 

Best Regards,

kerry

 

 

0 项奖励
1,354 次查看
vanessa_dis
Contributor III

Thank you Kerry for you answer.

 

Yes exactly, the hardware is connected to the pins, that is because I want to be able to enable/disable this. 

Sorry, how can I disable these pins? Do I have to activate another functionability for all related pins?

标记 (1)
0 项奖励
1,364 次查看
vanessa_dis
Contributor III

Correction: **I want to disable OTG1, but i guess its the same

标记 (1)
0 项奖励
1,364 次查看
vanessa_dis
Contributor III
Correction: **I want to disable OTG1, but i guess its the same
0 项奖励