Jump to content

Enable USB device on TIVA C TM4C123g

Recommended Posts

I am using CCS version 5.5, I am using TIVA C microcontroller, TM4C123g series microcontroller, as soon as I add the include file

#include "usblib/usblib.h" I am have compiling issue. pls see below my complete include headers and attached error message


Please see the console message:

'Building file: ../main.c'

'Invoking: ARM Compiler'

"C:/ti/ccsv5/tools/compiler/arm_5.1.1/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me -O1 --include_path="C:/ti/ccsv5/tools/compiler/arm_5.1.1/include" --include_path="C:/ti/TivaWare_C_Series-1.1" --include_path="C:/ti/TivaWare_C_Series-1.1/third_party" -g --define=PART_TM4C123GH6PGE --define=DEBUG --diag_warning=225 --display_error_number --diag_wrap=off --preproc_with_compile --preproc_dependency="main.pp" "../main.c"

"C:/ti/TivaWare_C_Series-1.1/usblib/usblib.h", line 97: fatal error #35: #error directive: Unrecognized COMPILER!

1 catastrophic error detected in the compilation of "../main.c".

Compilation terminated.


can some one please help me understand what is going on?






full header:


#include <stdint.h>

#include <stdio.h>

#include <stdbool.h>

#include <string.h>

#include <time.h>

#include "inc/hw_memmap.h"

#include "inc/hw_types.h"

#include "inc/hw_nvic.h"

#include "inc/hw_i2c.h"

#include "inc/hw_gpio.h"

#include "driverlib/debug.h"

#include "driverlib/sysctl.h"

#include "driverlib/systick.h"

#include "grlib/grlib.h"

#include "inc/tm4c123gh6pge.h"

#include "driverlib/gpio.h"

#include "driverlib/interrupt.h"

#include "driverlib/timer.h"

#include "driverlib/adc.h"


#include "driverlib/rom.h"

#include "driverlib/pin_map.h"

//#include "driverlib/hibernate.h"

#include "utils/ustdlib.h"

#include "driverlib/flash.h"

#include "driverlib/eeprom.h"

#include "driverlib/fpu.h"

#include "driverlib/uart.h"

#include "usblib/usblib.h"

//#include "usblib/usb-ids.h"

//#include "usblib/device/usbdevice.h"

//#include "usblib/device/usbdbulk.h"

#include "utils/uartstdio.h"

#include "grlib/widget.h"

#include "grlib/canvas.h"

#include "grlib/checkbox.h"

#include "Kentec320x240x16_ssd2119_8bit.h"

#include "fatfs/src/ff.h"

#include "fatfs/src/diskio.h"

Link to post
Share on other sites

I've found most of the examples are still setup for the LM4F rather than the TM4C and don't work without a small amount of tweaking to the example code.


I have written three functional USB HID device firmwares, so I might be able to help you out.  The first tweak that has to be made to the examples is to set it to compile for the correct chip.  Secondly, you have to use a special command to force the chip into USB device mode since the hardware doesn't have the autodetection pins hooked up correctly by default.  I'm not sitting in front of a computer with CCS and Tivaware on it at the moment, so I don't remember the command off the top of my head.  If I get a chance I will look at my code and post the correct command when I have time, or you can look it up in the transition documentation from TI's website or the Tivaware package.  You won't get the TM4C Launchpad into device mode without the force tweak or a hardware modification.

Link to post
Share on other sites

when would you able to get back to me on this?



Hi Shoba,


This is a community forum, if you are in a hurry, might I suggest you try this link to arrange for paid support - http://www.ti.com/general/docs/contact.tsp


Alternatively you can also get free support from TI forums - http://e2e.ti.com/support/microcontrollers/tiva_arm/default.aspx


Though I must warn you, that since you have obviously not done the hard hours required to understand USB on the Tiva, the chances of TI support responding are very slim.


I recommend you utilise the following resources to truly understand what you have got yourself into when trying to develop for USB on an embedded device.


USB in a Nutshell - http://www.beyondlogic.org/usbnutshell/usb3.shtml#USBProtocols

Tivaware USB Library User Guide - http://www.ti.com/lit/ug/spmu297/spmu297.pdf


Trust me, I know USB isn't easy on embedded devices, I have suffered the learning experience, and have learnt there are no short cuts. Be happy you are developing a USB device, I had to develop a custom USB host driver for a device I am working with, and found 2 bugs in the Tivaware USB host controller drivers while I was at it.


Good luck!


Link to post
Share on other sites

thanks to all who replied to my post, i figured it out and now it's working.





Hi Shoba,


Great to hear it's working. 


Perhaps share with the rest of us what you did to get it working, it may help someone else out in the future.



Yes, good that you solved it.. but an explanation would be really helpful.


Link to post
Share on other sites

Sorry for the late update,



Just to let every one who is working with USB_BULK example, to know that there is no issue on the driver file that provided. It was a hardware issue on my side, USB0DM and USBID pins are connected. 



Following command will work if you can't allowcate a pin to control feature (USB0EPEN to enbable the Vbus) then forcing the device with following   

    // Set the USB stack mode to Device mode with VBUS monitoring.
    USBStackModeSet(0, eUSBModeForceDevice, 0);



if you have implemented a hardware for USB0EPEN, USBID(PB0), USB_VBUS(PB1)




Both works



Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...