Part Number: EK-TM4C1294XL
Hi, friends, I'm trying to use the interruption feature of my TM4C1294Xl using UART. In few words, I want to turn on an led, using an ISR , after sending a char.
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#include "driverlib/gpio.h"
/*Global Variables */
uint32_t g_ui32SysClock;
void UART7Isr(void);
int main(void)
{
/* Set the clocking to run at 120MHz */
g_ui32SysClock= SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480), 120000000);
char my_char = 'J';
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_1);
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 0x00);
/*Initialize GPIOC for UART*/
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
/*Enabling UART7*/
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART7);
/*Configuring GPIO pins for port C*/
GPIOPinConfigure(GPIO_PC4_U7RX);
GPIOPinConfigure(GPIO_PC5_U7TX);
/*Setting up GPIOC pins for UART function */
GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_4 | GPIO_PIN_5);
/*Setting UART7 configurations*/
UARTConfigSetExpClk(UART7_BASE,g_ui32SysClock,19200,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
IntMasterEnable();
UARTIntEnable(UART7_BASE, UART_INT_TX);
UARTIntRegister(UART7_BASE, UART7Isr);
UARTCharPutNonBlocking(UART7_BASE, my_char);
return 0;
}
void UART7Isr(void){
UARTIntClear(UART7_BASE, UART_INT_TX);
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, GPIO_PIN_1);
}
Until now, the led is not turning on.
