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.

Regarding tiva TM4C123G6PM launch pad

Hi sir / mam,

        I am using TIVA C series launch pad(TM4C123G6PMI). I started to program in that launch pad and finished GPIO's.

        I try to communicate ADC through this launch pad. That time controller get more heat.  Whenever I connect launch pad to PC and controller get heat.

                                                                                                                                                                                                                           Thanks and regards,

                                                                                                                                                                                                                            C.Saravanakumar

  • Hi,

    Post a schematic diagram of that ADC input to Tiva Launchpad.

    - kel
  • Hi,

          I just connect potentiometer terminals are,

                              wiper     -     PE4

                              VDD      -     +5V

                               VSS     -      GND

          

  • Hello Saravanan,

    Is the Potentiometer wiper at the min position where the 5V is getting connected to the TM4C device? Can you turn the potentiometer the other way to GND and see if the uC still gets heated?

    Regards
    Amit
  • I connect 5V from external source...
  • Hello Saravanan,

    How is the pad PE4 configured (code post would be useful). Also since the 5V is from an external source did you put a current limit on it?

    Regards
    Amit
  • hi,

    I attached my code. 5V is i connect from external source.

    #include<stdint.h>
    #include<stdbool.h>
    #include<hw_memmap.h>
    #include<hw_types.h>
    #include<sysctl.h>
    #include<hw_sysctl.h>
    #include<gpio.h>
    #include<hw_gpio.h>
    #include<adc.h>

    #define RS GPIO_PIN_1
    #define RW GPIO_PIN_2
    #define EN GPIO_PIN_3

    void delay_ms(int del)
    {
    del=(SysCtlClockGet()/3.0)*del/1000.0;
    SysCtlDelay(del);
    }

    void lcd_cmd(unsigned char a)
    {
    GPIOPinWrite(GPIO_PORTE_BASE, RS,0); //RS=0
    GPIOPinWrite(GPIO_PORTE_BASE, RW,0); //RW=0
    GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7, a); //portb=a
    GPIOPinWrite(GPIO_PORTE_BASE, EN,8);delay_ms(2);GPIOPinWrite(GPIO_PORTE_BASE, EN,0); //EN=0
    }

    void lcd_data(unsigned char a)
    {
    GPIOPinWrite(GPIO_PORTE_BASE, RS,2); //RS=1
    GPIOPinWrite(GPIO_PORTE_BASE, RW,0); //RW=0
    //EN=1
    GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7, a); //portb=a
    GPIOPinWrite(GPIO_PORTE_BASE, EN,8);delay_ms(2);GPIOPinWrite(GPIO_PORTE_BASE, EN,0); //EN=0
    }

    void lcd_init()
    {
    lcd_cmd(0x38);lcd_cmd(0x0E);lcd_cmd(0x01);
    }


    void main()
    {
    uint32_t adcbuffer[1];
    SysCtlClockSet(SYSCTL_SYSDIV_5| SYSCTL_USE_PLL| SYSCTL_XTAL_16MHZ| SYSCTL_OSC_MAIN);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
    GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_4);
    GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, 0xff);
    GPIOPinTypeGPIOOutput(GPIO_PORTE_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);
    ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_PROCESSOR, 0);
    ADCSequenceStepConfigure(ADC0_BASE, 3, 0, ADC_CTL_CH9| ADC_CTL_IE| ADC_CTL_END);
    ADCSequenceEnable(ADC0_BASE, 3);
    ADCIntClear(ADC0_BASE, 3);
    lcd_init(); delay_ms(50);
    lcd_cmd(0x80);
    lcd_data('R');
    while(1)
    {
    ADCProcessorTrigger(ADC0_BASE, 3); //init trigger
    while(!ADCIntStatus(ADC0_BASE, 3, false)); //wait thr till conversion complete
    ADCIntClear(ADC0_BASE, 3);
    ADCSequenceDataGet(ADC0_BASE, 3, adcbuffer);
    unsigned int a=adcbuffer[0];
    lcd_cmd(0x80);
    //if(a<4096){lcd_data('A');} else lcd_data('B');
    if(a>999){lcd_data(48+((a/1000)%10));}
    if(a>99){lcd_data(48+((a/100)%10));}
    if(a>9){lcd_data(48+((a/10)%10));}
    {lcd_data(48+(a%10));}
    //GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7, a);

    }
    }

  • Hello Saravan,

    Please read my analysis and carefully answer each one.

    1. The ADC can only convert an input between VREF and 0V. By applying 5V you are effectively going out of range. The input shall be clamped to VDD voltage level. So applying 5V through a pot is not really a valid scenario. You would need to scale it to VREF to 0V range. Are you doing that?
    2. The code seems fine and does it show 0x000 +/- error when the pin is connected to GND?
    3. A power supply of 5V can drain a lot of current into a pin. It would be wiser to current limit it. Have you done that?

    Regards
    Amit