Other Parts Discussed in Thread: EK-TM4C123GXL
Hello everyone,
I would like to learn the USB protocol and practicing on my microcontroller.
I have installed the tivaware usb library, and I'm reading the .c and .h files in order to understand how it works. However there is an important file that I can't open : usblib.lib.
Where can I find this file in the .c format?
By the way, can someone help me to get started with the USB controller? Here is my initialisation:
void USB_init(void)
{
SYSCTL_RCGCUSB_R |= SYSCTL_RCGCUSB_R0; // enable usb module clock
SYSCTL_RCGCGPIO_R |= SYSCTL_RCGCGPIO_R3; // enable GPIO Port D clock (PD4 = D-, PD5 = D+)
// wait for 3 system clock cycles
__asm("NOP");
__asm("NOP");
__asm("NOP");
GPIO_PORTD_AFSEL_R |= (BIT_4 | BIT_5); // enable alternate functions for PD4-5
GPIO_PORTD_DEN_R &= ~(BIT_4 | BIT_5); // disable digital function for PD4-5
GPIO_PORTD_AMSEL_R |= (BIT_4 | BIT_5); // disable the analog isolation circuit for PD4-5
USB0_DEVCTL_R |= 0x80; // sets device/otg b mode
USB0_POWER_R |= 0x40; // enables connection to the bus
return;
}
After initializing the USB controller, I am polling the USB_TXIS register to see if I received a SETUP command from the host (enumeration start):
if(USB0_TXIS_R != 0)
{
led_off(RED);
led_on(GREEN);
}
but nothing happens, what did I miss?
Thank you for your help.