This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C123GH6PM: USB library, opening usblib.lib + help with the USB controller

Part Number: TM4C123GH6PM
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.

  • Morgan Demange said:

    However there is an important file that I can't open : usblib.lib.

    Where can I find this file in the .c format?

    May I note that 'yours' is a very well formed 'first ever' Forum Posting.    Good Job!

    Under my firm's installation - under Win_10 - I find:

    and post 'Clicking that highlighted' item:

    Your 'usblib.h' reveals - but no trace of  'usblib.c!'     That stated - had you noted that 'each/every .c file' - was (also) absent a 'mated .h file?"    (but for 'usbulpi' - that's good (maybe great) 'Attention to Detail' - is it not?)

    My small tech firm uses many ARM MCUs - from many vendors -  I'm unable to quickly/easily assist your USB code elements w/this MCU.    (Young staff are 'far' more qualified.)

    However your review of the many examples (shown above) can only assist your efforts - that's strongly recommended.     And - assuming that you are 'armed' w/an 'LPad' - you are well equipped to 'Tease Out' many USB facts ... even when - especially when ...  'On your own!'

    Beware - Vendor staff (I believe properly) 'dislike your 'DRM' * style of coding.'     (I know - (can read your lips remotely) "NOW you tell me!"    They've invested much in their API - which, 'Speeds, Eases & Enhances' your coding efforts.   (while easing & speeding their forum efforts as well)

    Perhaps a vendor agent will arrive ...  while staff & I worked today - all flee till Monday...    Good luck...

    *  DRM - Direct Register Manipulation - far more time-consuming, error-prone, effort investing than the long tried/tested API...

  • Hi cb1,

      Thank you for your suggestions to the OP. It is very helpful. 

       I will provide a little more information to the OP.  I will suggest the OP start with the usb examples under <TivaWare_installation>/examples/boards/ek-tm4c123gxl/. Make sure the usblib.lib is in the linker searchpath as shown below. If you use the examples, the compiler/linker searchpath is already setup in CCS project.