Hello people from TI.
I´m new to TIVA C. I´m using the TM4C123G_LaunchPad_Workshop_Workbook to learn how to program and use the peripherals.
I´m trying to build the exemple where the UART uses interrupts.
I have done all the "PATH" and "Build" variable steps to ensure that the links were ok. The main code is posted down:
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#include "utils/uartstdio.h"
#define GPIO_PA0_U0RX 0x00000001
#define GPIO_PA1_U0TX 0x00000401
// UART INTERRUPT HANDLER
void UARTIntHandler(void)
{
uint32_t ui32Status;
ui32Status = UARTIntStatus(UART0_BASE, true); //get interrupt status
UARTIntClear(UART0_BASE, ui32Status); //clear the asserted interrupts
while(UARTCharsAvail(UART0_BASE)) //loop while there are chars
{
UARTCharPutNonBlocking(UART0_BASE, UARTCharGetNonBlocking(UART0_BASE));
//echo character
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2); //blink LED
SysCtlDelay(SysCtlClockGet() / (1000 * 3)); //delay ~1 msec
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0); //turn off LED
}
}
int main(void) {
SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2);
UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
IntMasterEnable();
IntEnable(INT_UART0);
UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT);
UARTCharPut(UART0_BASE, 'E');
UARTCharPut(UART0_BASE, 'n');
UARTCharPut(UART0_BASE, 't');
UARTCharPut(UART0_BASE, 'e');
UARTCharPut(UART0_BASE, 'r');
UARTCharPut(UART0_BASE, ' ');
UARTCharPut(UART0_BASE, 'T');
UARTCharPut(UART0_BASE, 'e');
UARTCharPut(UART0_BASE, 'x');
UARTCharPut(UART0_BASE, 't');
UARTCharPut(UART0_BASE, ':');
UARTCharPut(UART0_BASE, ' ');
while (1)
{
//if (UARTCharsAvail(UART0_BASE)) UARTCharPut(UART0_BASE, UARTCharGet(UART0_BASE));
}
}
I also apllied the functions in the startup_ccs.c for the UART interruption exactly as the Workbook shows, but the compiler is not able to compile due to the error below:
**** Build of configuration Debug for project UART_INTERRUP_II ****
"C:\\ti\\ccsv5\\utils\\bin\\gmake" -k all
'Building file: ../UART_Main.c'
'Invoking: ARM Compiler'
"C:/ti/ccsv5/tools/compiler/arm_5.0.4/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me -g --include_path="C:/ti/ccsv5/tools/compiler/arm_5.0.4/include" --include_path="C:/ti/TivaWare_C_Series-2.0.1.11577" --diag_warning=225 --display_error_number --diag_wrap=off --preproc_with_compile --preproc_dependency="UART_Main.pp" "../UART_Main.c"
"../UART_Main.c", line 56: warning #225-D: function declared implicitly
"../UART_Main.c", line 56: error #20: identifier "INT_UART0_" is undefined
1 error detected in the compilation of "../UART_Main.c".
gmake: *** [UART_Main.obj] Error 1
gmake: Target `all' not remade because of errors.
>> Compilation failure
**** Build Finished ****
All the header files are there and I tryed to link (and later I copied) the driverlib file.
I tried to update to TivaWare 2.0 but didnt resolved the problem.
Did I miss something?
Thanks in advance.