LPC546xx USB1_ID

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

LPC546xx USB1_ID

1,556 Views
terence_kong
Contributor II

Hi NXP support,

We realize the LPC546xx doesn't support USB OTG, can we use an GPIO to detect the USBID and switch between host and device mode?

The SDK only support either host or device, need support regarding on how to switch between host and device.

Labels (1)
Tags (1)
0 Kudos
9 Replies

1,320 Views
diego_charles
NXP TechSupport
NXP TechSupport

Hello, Terence. 

I´m currently working on your question. As soon I get a useful answer I´ll let you know. 

Regards, Diego

0 Kudos

1,320 Views
diego_charles
NXP TechSupport
NXP TechSupport

Sorry for my late reply. 

You can  use a GPIO pin with a pull-up resistor  in order to detect If the cable that you

are using sets the LPC54xx  as a host or a  B device.

 

In terms of software, you can take as a starting point our examples for HOST or DEVICE.   You will need to do your own implementation to switch the role from HOST to DEVICE.

 

Additionally,  take into account that your design must change to provide  VBUS as a host and receive VBUS power as a device.

Best regards, Diego

0 Kudos

1,320 Views
terence_kong
Contributor II

Ok will try that out, thanks

0 Kudos

1,320 Views
diego_charles
NXP TechSupport
NXP TechSupport

Please let me know if I can help you further. 

Best regards, Diego. 

0 Kudos

1,320 Views
terence_kong
Contributor II

another question, how to read the value from the USB1_ID pin? seems that is not a standard GPIO

0 Kudos

1,320 Views
diego_charles
NXP TechSupport
NXP TechSupport
  • Hi Terence!

I will take a look at this. Please provide time to investigate.

Best regards!

0 Kudos

1,320 Views
terence_kong
Contributor II

Any idea how to read the value from the USB1_ID pin?

0 Kudos

1,320 Views
diego_charles
NXP TechSupport
NXP TechSupport

 Hi Terence!

I apologize for the delay! I missed the track of your inquirie due my workload.

You can check the value of the  USB1_ID pin!

Altougth this pin  does not have a GPIO alternative like USB0_ID.

To do this please,  refer to the  register PortMode of the LPC546 UM

pastedImage_1.png

This is the small code  that I made to   test the  USB1_ID pin :

#include "fsl_power.h"

 int main( void )

{

    /* Init FSL debug console. */
    BOARD_InitDebugConsole();

    POWER_DisablePD(kPDRUNCFG_PD_USB1_PHY); /*< Turn on USB Phy */
    CLOCK_EnableClock(kCLOCK_Usbh1 );
    CLOCK_EnableUsbfs0HostClock(kCLOCK_UsbSrcUsbPll, 48000000U);

    while (1)
    {
        USBHSH->PORTMODE |= 1<<8;//  enabling pull up resistor on USB1_ID pin
        if(USBHSH->PORTMODE & (0x01))
        {
            //The pin is pulled up
            PRINTF(" A device connected /n");
        }
        else
        { // the pin is pulled down
            PRINTF("B device connected /n");
        }
    }
}

Additional comments:

This was tested using the LPCxpress54628 EVK. I can guarantee that this example code will work as intended on all situations!

To pull down the USB1_ID line I used to connect a OTG adapter to the high speed USB connector, since has the ID pin grounded.

I hope this helps!

-------------------------------------------------------------------------------
Note:
 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

1,320 Views
terence_kong
Contributor II

Apparently no, thanks for your information

0 Kudos