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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

Jump to solution
1,226 Views
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

Labels (1)
Tags (3)
0 Kudos
1 Solution
1,219 Views
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

   

  

View solution in original post

0 Kudos
8 Replies
1,220 Views
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 Kudos
1,202 Views
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 Kudos
1,196 Views
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 Kudos
1,190 Views
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 Kudos
1,179 Views
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 Kudos
1,214 Views
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?

Tags (1)
0 Kudos
1,224 Views
vanessa_dis
Contributor III

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

Tags (1)
0 Kudos
1,224 Views
vanessa_dis
Contributor III
Correction: **I want to disable OTG1, but i guess its the same
0 Kudos