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.

sd_card Example with modified mmc-ek-tm4c1294xl.c

Hi there,


I am using the Tiva™ C Series TM4C1294XL Connected Launchpad and I was trying to modify the file mmc-ek-tm4c1294xl.c to use SSI0 instead of SSI3. But after building the project I realized that the file was not compiled. Instead the library driverlib.a was used. But when I remove that library from the build I get these errors:

Description Resource Path Location Type
unresolved symbol GPIOPadConfigSet, first referenced in ./sd_card.obj sd_card     C/C++ Problem
unresolved symbol GPIOPinTypeEthernetLED, first referenced in ./drivers/pinout.obj sd_card     C/C++ Problem
unresolved symbol GPIOPinTypeGPIOOutput, first referenced in ./sd_card.obj sd_card     C/C++ Problem
unresolved symbol SysCtlClockFreqSet, first referenced in ./sd_card.obj sd_card     C/C++ Problem
unresolved symbol SysCtlPeripheralEnable, first referenced in ./sd_card.obj sd_card     C/C++ Problem
#10234-D unresolved symbols remain sd_card     C/C++ Problem
#10010 errors encountered during linking; "sd_card.out" not built sd_card    

C/C++ Problem

I simply want to change the code of mmc-ek-tm4c1294xl.c and then compiling and using it. I have not linked that file to my project, but copied it to the project, because I don't want to change anything in the Tiva Ware Library itself.

How can I tell the compiler to use that file instead of the precompiled version of mmc-ek-tm4c1294xl.c within driverlib.a?

I am programming and building on Ubuntu 14.04 x64.

  • Hi Nicolas, in first some question about your setup:

    are you using CCS?

    Have you imported project or working on original one?

    [Linux issue I have] Is .project ok and is <linkedResources> section present? If not copy from original and paste to destination .project file on same position.

     try clean project and rebuild too, sometimes wrong obj files are confusing linker.

  • Yes, I am using CCS and I did manually add the linked resources from the original sample from the Tiva Ware Library.

    I guess I figured it out. I also had to link the "driverlib" folder to my project. This way I don't have to add driverlib.lib to the libraries in the project properties. Now it is building without problems and the mmc-ek-tm4c1294xl.c file is compiled and linked correctly.

    But now I have an new problem:

    The FSS/CS PIN is working well. SELECT sets the PIN to low and DESELECT sets it to high. But SSI0 gives no output. SCLK and TX doesn't do anything. Any suggestions?

    This is the new configuration at the beginning of mmc-ek-tm4c1294xl.c:

    /* Peripheral definitions for EK-TM4C129EXL board */
    /* SSI port */
    #define SDC_SSI_BASE            SSI0_BASE
    #define SDC_SSI_SYSCTL_PERIPH   SYSCTL_PERIPH_SSI0
    
    /* GPIO for SSI pins */
    /* CLK pin */
    #define SDC_SSI_CLK_GPIO_PORT_BASE   GPIO_PORTA_BASE
    #define SDC_SSI_CLK             GPIO_PIN_2
    /* TX pin */
    #define SDC_SSI_TX_GPIO_PORT_BASE   GPIO_PORTA_BASE
    #define SDC_SSI_TX              GPIO_PIN_4
    /* RX pin */
    #define SDC_SSI_RX_GPIO_PORT_BASE   GPIO_PORTA_BASE
    #define SDC_SSI_RX              GPIO_PIN_5
    /* CS pin */
    #define SDC_SSI_FSS_GPIO_PORT_BASE   GPIO_PORTA_BASE
    #define SDC_SSI_FSS             GPIO_PIN_3

    After power_on() the function send_initial_clock_train() should send the initial clock train, but nothing happens. I used a logic analyzer to find that out.

    I also added the line ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); to the power_on() function.

    Any suggestions?

  • Hello Nicolas,

    Can you use the debugger to check if the pin PA2 which is SSI0CLK is being configured correctly in the GPIO registers for Port A?

    Regards
    Amit
  • How can I find that out using the debugger? At the moment I only use the debugger to halt on breakpoints and inspecting variables. How can I check if a pin is correctly configured in the GPIO registers for a given Port?
  • Hello Nicolas,

    Just like the C Code, there is Memory Browser in the CCS. There you can enter the absolute address of the registers and check the values. Then these values can be cross referred against the data sheet to see if the programming is as expected for PA2 pin to be SSI0CLK. The table for using a GPIO as peripheral pin would be useful in identifying the registers.

    Regards
    Amit
  • For example there is this line inside the power_on function:

    ROM_GPIOPinTypeSSI(SDC_SSI_CLK_GPIO_PORT_BASE, SDC_SSI_CLK);

    These are the values:

    SDC_SSI_CLK_GPIO_PORT_BASE = GPIO_PORTA_BASE = 0x4000
    SDC_SSI_CLK = GPIO_PIN_2 = 0x4

    GPIOPinTypeSSI uses the function GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW).
    The two HWREG lines become this:

    HWREG(ui32Port + GPIO_O_DIR) = HWREG(0x40004400) = (HWREG(0x40004400) & ~(0x4)); = xxxxxxxxxxxxxxxxxxxxxxxxxxxxx0xx
    HWREG(ui32Port + GPIO_O_AFSEL) = HWREG(0x40004420) = (HWREG(0x40004420) | 0x4); = xxxxxxxxxxxxxxxxxxxxxxxxxxxxx1xx

    At memory address 0x40004400 the memory viewer says "Error: memory map prevented reading 0x40004400".

    And when I use the "Registers" tab to choose the register GPIO_PORTA_AHB -> GPIO_DIR and open that address in the memory viewer it jumps to address 0x40058400 with the value 0x00000008.

  • Hello Nicolas,

    The address space is remapped to AHB so that is OK. The registers to look for are the AFSEL, PCTL, DEN and ODR.

    Regards
    Amit
  • So it is correct, that in the code the address is 0x40004000 and in the memory viewer it is 0x40058000?
    At address GPIO_PORTA_AHB_GPIO_AFSEL the value is 00000000000000000000000000110111. That seems okay.
    These are the other registers:
    GPIO_PCTL 00000000000000000000000000010001 (Binary) GPIO Port Control [Memory Mapped]
    GPIO_DEN 00000000000000000000000000111111 (Binary) GPIO Digital Enable [Memory Mapped]
    GPIO_ODR 00000000000000000000000000000000 (Binary) GPIO Open Drain Select [Memory Mapped]
    But I have not checked by hand if that are the correct values.
  • I guess the PCTL value is wrong.
    It should be 00000000 11111111 00001111 00000000, shouldn't it?
    According to the data sheet that value would connect PA2, PA4 and PA5 to SSI0Clk, SSI0XDAT0 and SSI0XDAT1.
    If the value is 00000000 00000000 00000000 00010001, then PA0 and PA1 were connected to U0Rx and U0Tx. Maybe is this the configuration for the UART Debugging Interface? So should I simply use SSI1, SSI2 or SSI3?
  • Hello Nicolas,

    Yes. It seems that the GPIOPinConfigure has not been called with the parameter to configure the PCTL.

    Regards
    Amit
  • Thank you very much!

    I added the following lines to power_on and now it is working!

        GPIOPinConfigure(GPIO_PA2_SSI0CLK);
        GPIOPinConfigure(GPIO_PA4_SSI0XDAT0);
        GPIOPinConfigure(GPIO_PA5_SSI0XDAT1);

    But why are these lines missing in the file mmc-ek-tm4c1294xl.c ?