bsp_usb_io_init -USB host only- Can I use USB_DM_PDOWN and USB_DP_PDOWN in my application?

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

bsp_usb_io_init -USB host only- Can I use USB_DM_PDOWN and USB_DP_PDOWN in my application?

1,224 Views
admin
Specialist II

Hi,

in my product I'm utilizing MQX 3.5.1 with USB Host + MFS (will be only USB host). In this product I have to utilize the pins  USB_DP_PDOWN and USB_DM_PDOWN as outputs so the usb task mustn't drive these pins. Can I use these ports as outputs for my application or I cause the bad functioning of USB stack? 

 

 

Thanks,

Maurizio

Labels (1)
Tags (1)
0 Kudos
1 Reply

365 Views
elel
Contributor III

Hi Maurizio.

 

In my project(that uses mqx 3.5.1 with USB host + MFS) I use theese pins like SPI_CS2 and SPI_CS3, and I've no problem with the USB.

 

The USB driver, when initializes the USB as host, set that pins like pull down by calling the function "_bsp_usb_io_init".

So if you don't change the "_bsp_usb_io_init" function into the bsp project, every time you initialize the USB as host that pins will be forced to perform pull down functionality.

 

In way to use that pins always like CS I've commented out the line that sets theese pins as pull down.

 

I post here the function with my changes:

 

void _bsp_usb_io_init
(
    void
)
{
    VMCF5225_STRUCT_PTR reg_ptr = _PSP_GET_IPSBAR();

  // setup gpio state, func and dirrections
    reg_ptr->GPIO.PUAPAR &= 0x3f;
    reg_ptr->GPIO.PORTUA |= MCF5225_GPIO_PORTxP3;   // turn Vbus off
    reg_ptr->GPIO.DDRUA |= MCF5225_GPIO_DDRx3;      // CTS0 as output
    
    reg_ptr->GPIO.PUAPAR &= 0xcf;
    reg_ptr->GPIO.DDRUA &= ~MCF5225_GPIO_DDRx2;     // RTS0 as input
    
    //reg_ptr->GPIO.PORTUA |= MCF5225_GPIO_PORTxP3; // turn Vbus off
    reg_ptr->GPIO.PORTUA &= ~MCF5225_GPIO_PORTxP3;  // turn Vbus on


    //reg_ptr->GPIO.PQSPAR |= MCF5225_GPIO_PQSPAR_PQSPA5(3) | MCF5225_GPIO_PQSPAR_PQSPA6(3);
}

 

Regards,

Stefano