Jump to content
luligar

Tiva TM4C GPIO pins with "two logic-high states"

Recommended Posts

Hi,

 

I'm getting to grips with a Launchpad ek-tmc123gxl board, and so far it looks amazing. However I have hit a snag which is pretty painful. Consider the following code:

#include <stdbool.h>
#include <stdint.h>
#include "inc/hw_gpio.h"
#include "inc/hw_memmap.h"
#include "inc/hw_sysctl.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/sysctl.h"

void setup(void);

#define delay(x) SysCtlDelay((SysCtlClockGet() / 3000000) * x)

uint8_t sequence_1[16] = {
    0x4b, 0x4e, 0xcd, ... other 8-bit values
};
uint8_t sequence_2[16] = {
    ... another list of 16 8-bit values like sequence_2
};

int index;

int main()
{ 
    int i, wait;
    setup();

    index = 0;
    wait = 1000;

    while(1)
    {
	delay(wait);
	GPIOPinWrite(GPIO_PORTB_AHB_BASE, 0xFF, seq_m1[index]);
	GPIOPinWrite(GPIO_PORTD_AHB_BASE, 0xFF, seq_m2[index]);
        if(++index == 16) index = 0;
}

void setup(void)
{
    // Set the clocking to run directly from the PLL at 80 MHz.
    SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
    SysCtlGPIOAHBEnable(SYSCTL_PERIPH_GPIOB);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
    SysCtlGPIOAHBEnable(SYSCTL_PERIPH_GPIOD);

    GPIOPinTypeGPIOOutput(GPIO_PORTB_AHB_BASE, 0xFF);
    GPIOPadConfigSet(GPIO_PORTB_AHB_BASE, 0xFF, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
    GPIOPinTypeGPIOOutput(GPIO_PORTD_AHB_BASE, 0xFF);
    GPIOPadConfigSet(GPIO_PORTD_AHB_BASE, 0xFF, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
}

I am seeing how pins D0 and D1 and B6 and B7 show the following scope trace:

post-45176-0-78988400-1426718442_thumb.jpg

Where a normal binary squarish wave should be seen, I'm getting two high states, one at 1.85 V and another at the nominal 3.3 (!).

I provide the facts below for context:

  • The Launchpad board is brand-new.
  • This behavior is also what I get when using an equivalent Energia sketch.
  • None of the Port B or D pins are connected to anything. Just to the scope probes.
  • This code is compiled on CCSv6 and arm-gcc. Same behavior.
  • The usage of the AHB was just a "what if..." decision. The behavior is just as present when using the default APB.

I suppose I'm missing a very big catch in dealing with the ports, but I thought the TivaWare drivers were written precisely to avoid this sort of unexpected and annoying behavior?

 

As a more basic test, I made a program that toggles all bits of Ports B and D after a 2 ms delay. In that case, the scope showed a clean square wave. The ports configuration is identical to what I showed above.

 

Thanks for the attention!

Share this post


Link to post
Share on other sites

It's a great little board, isn't it!  :-)

 

In the little flyer that came with the board, on the spread that shows the header pin functions, you'll find that PD0 and PB6 are connected together. Similarly, PD1 and PB7 are also connected together. It's my understanding that this was done for backward compatibility with the older 43oh booster boards (or something like that). So, we can't drive both pins of those pairs at the same time.

 

The user guide for the board is spmu296.pdf, full title "Tiva C Series TM4C123G LaunchPad Evaluation Board User's Guide".

The schematic is in the back, and shows those pins connected together.

 

Valvano's site has a video showing the removal of the two zero-ohm resistors; it was easy to do.

This is his video link page:  http://users.ece.utexas.edu/%7Evalvano/Volume1/E-Book/VideoLinks.htm

Here's one link http://youtu.be/MWIX7wgS9PM

And the other: https://s3.amazonaws.com/edx-course-videos/ut-embedsys/UTXUT601T114-G018400_100.mp4

 

Have fun!

Share this post


Link to post
Share on other sites

Hi mgh,

 

It is indeed an amazing board, specially for the price! Shortly before your reply, I was sifting through these forums and I saw a thread about the 0 Ohm resistors you mentioned. I went back to the flyer and they show the pin pairs that are shorted in the signals diagram, but the resistors themselves, as R9, R10, were not mentioned. Sure enough, I took them out and one of my boards had its PD1 pin taken out :( , I guess after I tried using the stronger current drivers :blink:. On my second board, to my surprise, all 4 pins were fine!

 

I don't see how to close an issue, if that is even intented in this forum. But I consider it closed and solved. Thanks for your quick and kind reply!

 

Regards,

Luis

Share this post


Link to post
Share on other sites

I agree.  Thanks go to Luis for the detailed followup!

 

Also... check the schematics again and see that some other PortB pins are used for the second USB connector on the side of the board... it's another place to get hosed.

Share this post


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.

Guest
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...