I'm using Texas Instruments Tiva C Launchpad to communicate with a micro SD and micro SDHC cards. The development board uses TM4C123GH6PM chip and I'm using TI RTOS's FatFS example for the Launchpad to access the card. In the example, port SSI2 was used for SPI communication. The SSI2 port is connected to port B's pins. The port is connected using jumper wires to a micro SD card adapter positioned on a breadboard.

Here's the adapter's pinout:

GND - to launchpad's ground
+3.3V - from Launchpad's regulator
Card detect - not connected
DATA2 - not connected
Chip Select - connected to SSI2
MOSI - connected to SSI2
Clock - connected to SSI2
MISO - connected to SSI2
DATA1 - not connected

In order to get the FAT example to work, I had to make some modifications to it, since it obviously wasn't tested.

In file EK_TM4C123GXL.c I made following changes:

const SDSPITiva_HWAttrs sdspiTivaHWattrs[EK_TM4C123GXL_SDSPICOUNT] = {
        SSI2_BASE,          /* SPI base address */

        GPIO_PORTB_BASE,    /* The GPIO port used for the SPI pins */
        GPIO_PIN_4,         /* SCK */
        GPIO_PIN_6,         /* MISO */
        GPIO_PIN_7,         /* MOSI */

        GPIO_PORTB_BASE,    /* Chip select port, in TI's example was PORTA_BASE */
        GPIO_PIN_5,         /* Chip select pin */

        GPIO_PORTB_BASE,    /* GPIO TX port */
        GPIO_PIN_7,         /* GPIO TX pin */


Void EK_TM4C123GXL_initSDSPI(Void)
    /* Enable the peripherals used by the SD Card */

    /* Configure pad settings */
//This was original TI's code
//            GPIO_PIN_4 | GPIO_PIN_7,
//            GPIO_PIN_6,
//            GPIO_PIN_5,
//            GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD);//Used to be PORTA_Base, but this didn't work
                                        GPIO_PIN_6 | GPIO_PIN_7);//Copied from SPI-loopback example


     * These GPIOs are connected to PB6 and PB7 and need to be brought into a
     * GPIO input state so they don't interfere with SPI communications.


After this, the code managed to write a file to the card correctly.

Now comes the actual question itself:

While I was probing the communication between the microcontroller and the SD card, I noticed that on the MOSI pin, there's a waveform that reminds me of a capacitor charging.

MOSI line getting charged, MISO line high

Red channel is MOSI and yellow channel is MISO.

At first, I thought that it could be the MISO line charging the parasitic capacitance between the MISO and MOSI pins on the development board, since those two pins are next to each-other. After probing some more, I came to the conclusion that this is not the main cause of the phenomenon.

MOSI line getting charged, MISO line low

Here we can see that there is still some charging action on the MOSI line, even thought the MISO line is low at the moment.

On the SD card adapter itself the clocl line is in between the MOSI and MISO lines, so I thought that it could be causing the issue, but while the MOSI is getting charged, the clock line is low as well.

[MOSI line getting charged, clock in yellow, 1

Red is the MOSI line, yellow is the clock.

Here's a shot of the smaller "triangle" and the clock line:

MOSI line getting charged, clock in yellow, 2

During all this, the Chip Select line is held low, so it could not be charging the master out pin.

So any ideas what could be causing this type of behavior?

  • 1
    \$\begingroup\$ Is it possible that you are accidentally changing the MOSI line to an open-collector output, or to an input with a weak pullup? \$\endgroup\$
    – Joe Hass
    Commented Dec 19, 2013 at 13:19
  • \$\begingroup\$ @Joe Hass I'm not sure, this is my first "real" project with this micro and I still haven't digested the libraries used here. On the surface, it doesn't look like that is happening, but until I dig through the source code, I can't say for sure. The micro does have option to set outputs to open collector. \$\endgroup\$
    – AndrejaKo
    Commented Dec 19, 2013 at 13:23
  • \$\begingroup\$ Are you showing all your code stuff because you think it may relate to your code? \$\endgroup\$
    – Andy aka
    Commented Dec 21, 2013 at 23:20
  • \$\begingroup\$ @Andy aka Well yes. Maybe it would be a bit more accurate to say that I can't say that the piece of code I'm using is not related to this. At the moment, I don't see how the code I posted could produce the shown effect, but I'm not yet comfortable enough with the toolchain to say that the error isn't in the code. Actually, I suspect that is probably is somewhere in one of the called functions, since the microcontroller does have weak pull-up resistors as a feature, but they should be disabled during the whole procedure, as far as I understand how things work. \$\endgroup\$
    – AndrejaKo
    Commented Dec 22, 2013 at 0:07
  • \$\begingroup\$ maybe if it's possible program the pull ups to be more regular values like 10k or just put a 10k resistor external. It looks like cap charging and with a known lowish value resistor, the charge curve would tell you the line capacitance and yield a better explanation. \$\endgroup\$
    – Andy aka
    Commented Dec 22, 2013 at 0:15

1 Answer 1


Looks like your MOSI line is being Z-stated sometimes and weak pull-up on this line is charging it up. This is not cross line interference.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.