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.

not able to see the output in the uart console

in am new to ccs and tiva and hence i cant able to find the real problem

the compilation has done with no errors but the error in the output

the output has been in the fault isr

the code given by

#include <stdint.h>
#include <stdio.h>
#include <stdbool.h>
#include <math.h>

#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/sysctl.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/adc.h"
#include "driverlib/gpio.h"
#include "driverlib/comp.h"
#include "driverlib/rom_map.h"
#include "driverlib/debug.h"
#include "driverlib/fpu.h"
#include "driverlib/timer.h"
#include "driverlib/uart.h"
#include "utils/uartstdio.h"
#include "driverlib/rom.h"

uint32_t g_ui32SysClock;
void ConfigureUART(void);


void
ConfigureUART(void)
{
//
// Enable the GPIO Peripheral used by the UART.
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

//
// Enable UART0.
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);

//
// Configure GPIO Pins for UART mode.
//
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

//
// Initialize the UART for console I/O.
//
UARTStdioConfig(0, 115200, g_ui32SysClock);
}

void main (void)
{
uint32_t v[1],x[1],vtotal,xtotal;
float vrms;
g_ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN |
SYSCTL_USE_PLL |

SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_2);
ADCSequenceConfigure(ADC0_BASE,3,ADC_TRIGGER_PROCESSOR,0);
ADCSequenceStepConfigure(ADC0_BASE,3,0,ADC_CTL_CH13 | ADC_CTL_END);
ADCSequenceEnable(ADC0_BASE,3);
ADCIntClear(ADC0_BASE,3);

//ConfigureUART();
UARTprintf("\033[2J\033[H");
UARTprintf("adc values\n");
while(1)
{int i;
for(i=0;i<512;i++)
{
ADCIntClear(ADC0_BASE,3);
ADCProcessorTrigger(ADC0_BASE,3 );
while(!ADCIntStatus(ADC0_BASE,3,false)){}
ADCIntClear(ADC0_BASE,3);
uint32_t adc0buffer[512];
ADCSequenceDataGet(ADC0_BASE,0,&adc0buffer[i]);
v[i] = adc0buffer[i];
UARTprintf("%d\n",v[i]);
}
for (i=0;i<512;i++)
{
vtotal = vtotal + v[i];
x[i] = v[i]*v[i];
}
for (i=0;i<512;i++)
{
xtotal = xtotal + x[i];
}
vrms = sqrt(xtotal / 512);
UARTprintf("%d",vrms);
}

}

  • Hi santhosh,

    Which device and HW do you use? You don't set the clock for UART module.

    The statement in your code above for setting the system clock is not correct:
    g_ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
    SYSCTL_OSC_MAIN |
    SYSCTL_USE_PLL |

    Regards,
    QJ
  • dear QJ wang,
    the actual statement used was
    g_ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
    SYSCTL_OSC_MAIN |
    SYSCTL_USE_PLL |
    SYSCTL_CFG_VCO_480), 120000000);

    i used teraterm to check the output of the uart module
  • >the output has been in the fault isr

    UART can not output characters when it vectors into fault ISR handler. Be sure to added any UART interrupt vector call name into (startup_ccs.c). Perhaps take a look at the UART example project in Tivaware.

    software-dl.ti.com/.../index_FDS.html
  • BTW you need an interrupt handler to notify APP samples are ready at END.  ADC_TRIGGER_PROCESSOR only starts the sample sequence.

    Not sure why ADC_CTL_END other than maybe signals FIFO to start conversion last step.

    ADCSequenceStepConfigure(ADC0_BASE,3,0,ADC_CTL_CH13 | ADC_CTL_END | IE);