So after thinking on this scenario a bit, i started to wonder.....
If the Bootloader enables the power to the usb by setting a GPIO pin high.
Code:
PORTA_PCR28 = PORT_PCR_MUX(1) | PORT_PCR_SRE_MASK; /* Slow slew rate */
GPIOA_PSOR |= 1 << 28;
GPIOA_PDDR |= 1 << 28;
GPIOA_PCOR |= 1 << 28;
Then it jumps to the application space.
Power will be already applied to the usb before i enter the _bsp_usb_io_init function.
Could this cause the current scenario i am seeing?
I made an attempt to reverse this by adding the following lines of code to the function.
//Set Power on to 0.
PORTA_PCR28 = PORT_PCR_MUX(1) | PORT_PCR_SRE_MASK;
GPIOA_PSOR &= ~(1 << 28);
GPIOA_PDDR &= ~(1 << 28);
GPIOA_PCOR &= ~(1 << 28);
_time_delay(1000);
//Set Power on to 1.
PORTA_PCR28 = PORT_PCR_MUX(1) | PORT_PCR_SRE_MASK;
GPIOA_PSOR |= 1 << 28;
GPIOA_PDDR |= 1 << 28;
GPIOA_PCOR |= 1 << 28;
I did not see any positive results in this test.
Still working on a resolution.
Edit:
I even went one step farther by simply toggling the USB power using.....
if (!lwgpio_init(&USB_POWER, BSP_USB_POWER, LWGPIO_DIR_OUTPUT, LWGPIO_VALUE_NOCHANGE))
{
printf("Initializing USB GPIO as output failed.\n");
_task_block();
}
lwgpio_set_functionality(&USB_POWER, BSP_USB_POWER_MUX_GPIO);
lwgpio_set_value(&USB_POWER, LWGPIO_VALUE_HIGH);
_time_delay(3000);
lwgpio_set_value(&USB_POWER, LWGPIO_VALUE_LOW);
This was probably more of a hardware test, but it worked and i did see the power to the USB host pin go low before initializing it.
However, still did not get the usb to enumerate.
-Jason