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.

LM4F120 LaunchPad USB Keyboard

Other Parts Discussed in Thread: TM4C1233H6PM, EK-LM3S9D90, TM4C123GH6PGE

Hi,

I have two questions about developing a USB keyboard using LM4F120.

1. Is that possible to develop a USB HID keyboard with this controller?

2. I tried given examples but every single one gives "#35 #error Unrecognized COMPILER!" error. I'm using Code Composer Studio v5.2 fyi.

Thanks.

  • Hello Mesut,

    The example codes have been tested with CCSv6.1 . Can you please attach the compilation logs for checking?

    The LM4F120 device is not in production but its equivalent TM4C123x devices are. And yes it is possible for the development of a USB HID keyboard with the same.

    Regards
    Amit
  • Hi Amit,

    I'm using example located at "C:\StellarisWare\boards\ek-lm4f232\usb_dev_keyboard".  Only addition i made was to "#include "inc/lm4f120h5qr.h" header file.  This is the console log for this example.

    **** Build of configuration Debug for project usb_mouse ****

    C:\ti\ccsv5\utils\bin\gmake -k all

    'Building file: ../main.c'

    'Invoking: ARM Compiler'

    "C:/ti/ccsv5/tools/compiler/tms470_4.9.5/bin/cl470" -mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me -g --include_path="C:/ti/ccsv5/tools/compiler/tms470_4.9.5/include" --include_path="C:/StellarisWare" --diag_warning=225 --display_error_number --preproc_with_compile --preproc_dependency="main.pp"  "../main.c"

    "C:/StellarisWare/inc/hw_gpio.h", line 116: warning #48-D: incompatible redefinition of macro "GPIO_LOCK_KEY" (declared at line 2031 of "C:/StellarisWare/inc/lm4f120h5qr.h")

    "C:/StellarisWare/usblib/usblib.h", line 95: fatal error #35: #error Unrecognized COMPILER!

    >> Compilation failure

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

    Compilation terminated.

    gmake: *** [main.obj] Error 1

    gmake: Target `all' not remade because of errors.

    **** Build Finished ****

    Error located at usblib.h header file:

    #if defined(ccs) ||             \

       defined(codered) ||         \

       defined(gcc) ||             \

       defined(rvmdk) ||           \

       defined(__ARMCC_VERSION) || \

       defined(sourcerygxx)

    #define PACKED __attribute__ ((packed))

    #elif defined(ewarm)

    #define PACKED

    #else

    #error Unrecognized COMPILER!

    #endif

    Best Regards.

  • Hello Mesut,

    Few points to consider

    1. The define "ccs" is not there during compilation
    2. The StellarisWare has been migrated to TivaWare and the latest version has been released last week. I would suggest an upgrade.
    3. The examples already have the options built in. I am not sure how the define went missing.

    Regards
    Amit
  • Hi Amit,

    I downloaded & installed TivaWare from this link. http://www.ti.com/tool/sw-tm4c
    I think Stellaris is not migrated to TivaWare as you mentioned. Because in this folder "C:\ti\TivaWare_C_Series-2.1.2.111\inc" there is no header file "lm4f120h5qr.h". I copied that file from "C:\StellarisWare\inc" to "C:\ti\TivaWare_C_Series-2.1.2.111\inc" folder but i'm having trouble including options and linking files those are necessary. I read "Getting Started with the Tiva TM4C123G LaunchPad Workshop" and tried to do the same. No luck. What i'm missing?

    Best Regards,
    Mesut
  • Hello Mesut

    The equivalent device for the LM4F120H5QR is tm4c1233h6pm. Secondly, why do you need to include the DRM header file (Please pardon the advanced anticipation, that you want to use the DRM to learn about the device: because it is not the way to learn complex devices). Instead use the TivaWare API's.

    Regards
    Amit
  • Hi Amit,

    I guess adding DRM header file is an old habit from 8 bit controllers :)

    I upgraded code composer studio version to 6.  Now, i can access all chips. I tried usb_mouse example (this example gave less error and no LCD interface) written for LM3S9D90.  When i change LM3S9D90 to LM4F120H5QR i get these errors:

    Description Resource Path Location Type

    #10010 errors encountered during linking; "usb_dev_mouse1.out" not usb_dev_mouse1 C/C++ Problem

    #16004-D file usb_dev_mouse1 C/C++ Problem

    Console log:

    **** Build of configuration Debug for project usb_dev_mouse1 ****

    "c:\\ti\\ccsv6\\utils\\bin\\gmake" -k all
    'Building target: usb_dev_mouse1.out'
    'Invoking: ARM Linker'
    "c:/ti/ccsv6/tools/compiler/arm_5.1.6/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me -O2 -g --gcc --define=ccs="ccs" --define=TARGET_IS_FIRESTORM_RA2 --define="ccs" --define=PART_LM4F120H5QR --display_error_number --diag_warning=225 --gen_func_subsections=on --ual -z -m"usb_dev_mouse_ccs.map" --heap_size=0 --stack_size=640 -i"c:/ti/ccsv6/tools/compiler/arm_5.1.6/lib" -i"c:/ti/ccsv6/tools/compiler/arm_5.1.6/include" --reread_libs --warn_sections --display_error_number --xml_link_info="usb_dev_mouse1_linkInfo.xml" --rom_model -o "usb_dev_mouse1.out" "./lm4f120h5qr_startup_ccs.obj" "./usb_dev_mouse.obj" "./usb_mouse_structs.obj" "./utils/uartstdio.obj" "../lm4f120h5qr.cmd" -l"libc.a" -l"C:/StellarisWare/boards/ek-lm3s9d90/usb_dev_mouse/ccs/../../../../driverlib/ccs-cm3/Debug/driverlib-cm3.lib" -l"C:/StellarisWare/boards/ek-lm3s9d90/usb_dev_mouse/ccs/../../../../usblib/ccs-cm3/Debug/usblib-cm3.lib"
    <Linking>
    error #16004-D: file
    "C:/StellarisWare/boards/ek-lm3s9d90/usb_dev_mouse/ccs/../../../../driverlib
    /ccs-cm3/Debug/driverlib-cm3.lib<gpio.obj>" has a Tag_ABI_VFP_args attribute
    value of "1" that is different than one previously seen ("0"); combining
    incompatible files
    error #16004-D: file
    "C:/StellarisWare/boards/ek-lm3s9d90/usb_dev_mouse/ccs/../../../../driverlib
    /ccs-cm3/Debug/driverlib-cm3.lib<interrupt.obj>" has a Tag_ABI_VFP_args
    attribute value of "1" that is different than one previously seen ("0");
    combining incompatible files
    error #16004-D: file
    "C:/StellarisWare/boards/ek-lm3s9d90/usb_dev_mouse/ccs/../../../../driverlib
    /ccs-cm3/Debug/driverlib-cm3.lib<cpu.obj>" has a Tag_ABI_VFP_args attribute
    value of "1" that is different than one previously seen ("0"); combining
    incompatible files
    error #16004-D: file
    "C:/StellarisWare/boards/ek-lm3s9d90/usb_dev_mouse/ccs/../../../../usblib/cc
    s-cm3/Debug/usblib-cm3.lib<usbdhidmouse.obj>" has a Tag_ABI_VFP_args
    attribute value of "1" that is different than one previously seen ("0");
    combining incompatible files
    error #16004-D: file
    "C:/StellarisWare/boards/ek-lm3s9d90/usb_dev_mouse/ccs/../../../../usblib/cc
    s-cm3/Debug/usblib-cm3.lib<usbdhid.obj>" has a Tag_ABI_VFP_args attribute
    value of "1" that is different than one previously seen ("0"); combining
    incompatible files
    error #16004-D: file
    "C:/StellarisWare/boards/ek-lm3s9d90/usb_dev_mouse/ccs/../../../../usblib/cc
    s-cm3/Debug/usblib-cm3.lib<usbdhandler.obj>" has a Tag_ABI_VFP_args
    attribute value of "1" that is different than one previously seen ("0");
    combining incompatible files
    error #16004-D: file
    "C:/StellarisWare/boards/ek-lm3s9d90/usb_dev_mouse/ccs/../../../../usblib/cc
    s-cm3/Debug/usblib-cm3.lib<usbdenum.obj>" has a Tag_ABI_VFP_args attribute
    value of "1" that is different than one previously seen ("0"); combining
    incompatible files
    error #16004-D: file
    "C:/StellarisWare/boards/ek-lm3s9d90/usb_dev_mouse/ccs/../../../../usblib/cc
    s-cm3/Debug/usblib-cm3.lib<usbdconfig.obj>" has a Tag_ABI_VFP_args attribute
    value of "1" that is different than one previously seen ("0"); combining
    incompatible files
    error #16004-D: file
    "C:/StellarisWare/boards/ek-lm3s9d90/usb_dev_mouse/ccs/../../../../usblib/cc
    s-cm3/Debug/usblib-cm3.lib<usbdcdesc.obj>" has a Tag_ABI_VFP_args attribute
    value of "1" that is different than one previously seen ("0"); combining
    incompatible files
    error #16004-D: file
    "C:/StellarisWare/boards/ek-lm3s9d90/usb_dev_mouse/ccs/../../../../usblib/cc
    s-cm3/Debug/usblib-cm3.lib<usbtick.obj>" has a Tag_ABI_VFP_args attribute
    value of "1" that is different than one previously seen ("0"); combining
    incompatible files
    error #16004-D: file
    "C:/StellarisWare/boards/ek-lm3s9d90/usb_dev_mouse/ccs/../../../../usblib/cc
    s-cm3/Debug/usblib-cm3.lib<usbmode.obj>" has a Tag_ABI_VFP_args attribute
    value of "1" that is different than one previously seen ("0"); combining
    incompatible files
    error #16004-D: file
    "C:/StellarisWare/boards/ek-lm3s9d90/usb_dev_mouse/ccs/../../../../usblib/cc
    s-cm3/Debug/usblib-cm3.lib<usbdesc.obj>" has a Tag_ABI_VFP_args attribute
    value of "1" that is different than one previously seen ("0"); combining
    incompatible files
    error #16004-D: file
    "C:/StellarisWare/boards/ek-lm3s9d90/usb_dev_mouse/ccs/../../../../usblib/cc
    s-cm3/Debug/usblib-cm3.lib<usbhostenum.obj>" has a Tag_ABI_VFP_args
    attribute value of "1" that is different than one previously seen ("0");
    combining incompatible files
    error #16004-D: file
    "C:/StellarisWare/boards/ek-lm3s9d90/usb_dev_mouse/ccs/../../../../usblib/cc
    s-cm3/Debug/usblib-cm3.lib<usbhhub.obj>" has a Tag_ABI_VFP_args attribute
    value of "1" that is different than one previously seen ("0"); combining
    incompatible files
    error #16004-D: file
    "C:/StellarisWare/boards/ek-lm3s9d90/usb_dev_mouse/ccs/../../../../driverlib
    /ccs-cm3/Debug/driverlib-cm3.lib<usb.obj>" has a Tag_ABI_VFP_args attribute
    value of "1" that is different than one previously seen ("0"); combining
    incompatible files
    error #16004-D: file
    "C:/StellarisWare/boards/ek-lm3s9d90/usb_dev_mouse/ccs/../../../../driverlib
    /ccs-cm3/Debug/driverlib-cm3.lib<udma.obj>" has a Tag_ABI_VFP_args attribute
    value of "1" that is different than one previously seen ("0"); combining

    incompatible files
    error #16004-D: file
    "C:/StellarisWare/boards/ek-lm3s9d90/usb_dev_mouse/ccs/../../../../driverlib
    /ccs-cm3/Debug/driverlib-cm3.lib<sysctl.obj>" has a Tag_ABI_VFP_args
    attribute value of "1" that is different than one previously seen ("0");
    combining incompatible files
    error #10010: errors encountered during linking; "usb_dev_mouse1.out" not
    >> Compilation failure
    built
    gmake: *** [usb_dev_mouse1.out] Error 1
    gmake: Target `all' not remade because of errors.

    **** Build Finished ****

    Best Regards.

  • Hello Mesut,

    Since you have a EK-LM4F120 launchpad, please take the DK-TM4C123G example instead of the LM3S example. Comment out all the Graphics Library code in that example.

    Also in your implementation the LM4F device would be the keyboard as seen by the PC? However, what will be the key input to the LM4F device. That is not clear.

    Regards
    Amit
  • Hi Amit,

    I'm making my own mechanical keyboard. So pc will recognize this keyboard as a hid keyboard. I used a 8bit microcontroller and it worked. But i didn't get the response that i wanted. Controller seems a bit slow to sending usb package. There are nearly 64 buttons therefore a matrix loop design used. Some time ago i bought LM4F120 launchpad for school projects. After 8bit microcontroller failure i thought i could use this as a USB HID keyboard controller.

    So basically what i wanted to do is check keyboard buttons in a loop and send bytes to PC. Also i need 5 inputs and 14 outputs for keyboard matrix.

    I couldn't get those examples working in my LM4F120. Changing controller from properties is not enough always gives errors. I try to send a key to PC when i push LM4F120's pushbuttons at first. I couldn't manage it. There is not much documentation about this topic also.

    Best Regards.
  • Hello Mescut

    The example I suggested to be taken from DK-TM4C123G (without the grlib) would get a key press working. Then you can add scan matrix to get the inputs from the 14 x 5 array and code it to as HID keyboard.

    Regards
    Amit
  • Hi Amit,

    I tried your example but it didn't work or i couldn't get it working. So i created a new project and started converting tm4c123gh6pge example code to my lm4f120h5qr. With this "Migrating Software Projects from StellarisWare toTivaWare™" document i nearly did it all. But i can't get pass this error:

    "../main.c", line 553: error #20: identifier "GPIO_PG4_USB0EPEN" is undefined

    Description Resource Path Location Type
    #20 identifier "GPIO_PG4_USB0EPEN" is undefined main.c /usb_hid_keyboard line 553 C/C++ Problem

    According valvono (table 6.1) TM4C123 and LM4F120 has same USB0epen pin but code composer gives me an error. Also there is no USB0EPEN definition on lm4f120h5qr header file.

    users.ece.utexas.edu/.../C6_MicrocontrollerPorts.htm

    Best Regards.

  • Hello Mesut,

    First of all let go of "lm4f120h5qr header file". When using TivaWare API using the device header file is not going to be worth the debug effort (and soon you would realize that). The example is taken from the 144 Pin device which is now being ported to the 64 pin device. The Port Pin name for USB pins is different on the device packages. If you can open the data sheet of LM4F120H5QR device then you will get the new Port Pin positions.

    Regards
    Amit