Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I provided uart communication via debug port, but I could not provide this function with the pins, I did the configuration of the pins in

I provided uart communication via debug port, but I could not provide this function with the pins, I did the configuration of the pins in the code, but I guess I can't get output, can you help? I want to make the output between U6Rx and U6Tx. I am new to this platform, I apologize in advance if I have given incomplete or incorrect information.
I'm using TM4C1294 with Code Composer Std
#include
#include
#include
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_uart.h"
#include "driverlib/fpu.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/systick.h"
#include "driverlib/uart.h"
#include "driverlib/udma.h"
#include "utils/cpu_usage.h"
#include "utils/uartstdio.h"
#include "utils/ustdlib.h"
#include "driverlib/timer.h"
uint32_t g_ui32SysClock;
bool g_ledBlinking = false;
uint32_t g_ui32CPUUsage;
#define SYSTICKS_PER_SECOND 100
void TimerBegin()
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
TimerConfigure(TIMER0_BASE, TIMER_CFG_ONE_SHOT);
TimerLoadSet(TIMER0_BASE, TIMER_A, g_ui32SysClock *2);
TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
TimerEnable(TIMER0_BASE, TIMER_A);
while (!TimerIntStatus(TIMER0_BASE, false))
{
}
TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
if (g_ledBlinking)
{
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, GPIO_PIN_0);
}
else
{
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0,0);
}
g_ledBlinking =!g_ledBlinking;
}
void PrintAsciiCodeAndName(char character)
{
UARTprintf("'%c'- ASCII Code: %d
", character, character);
}
void PrintMyNameAscii()
{
const char *myName = "MEHMET ABIYE TESEKKURLER ";
int i;
while (1)
{
for (i =0; myName[i]!='\0'; i++)
{
// Print ASCII code and name for the current character
PrintAsciiCodeAndName(myName[i]);
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, GPIO_PIN_0);
// Wait for 2 seconds using TimerBegin
TimerBegin();
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0,0);
// Wait for 2 seconds using TimerBegin
TimerBegin();
g_ledBlinking =!g_ledBlinking;
}
}
}
void SysTickHandler(void)
{
}
void uDMAErrorHandler(void)
{
}
void uDMAIntHandler(void)
{
}
void UART1IntHandler(void)
{
}
void ConfigureUART(void)
{
// Enable the peripherals for UART0 and GPIOA
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
// Configure the UART pins (PA0= UART0 RX, PA1= UART0 TX)
MAP_GPIOPinConfigure(GPIO_PP0_U6RX);
MAP_GPIOPinConfigure(GPIO_PP1_U6TX);
MAP_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0| GPIO_PIN_1);
// Configure the UART to 115200 baud, 8N1 format
UARTConfigSetExpClk(UART0_BASE, g_ui32SysClock, 115200,
(UART_CONFIG_WLEN_8| UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
// Enable UART
UARTEnable(UART0_BASE);
// Enable UART0 for sleep mode
MAP_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_UART0);
// Configure UART stdio
UARTStdioConfig(0,115200, g_ui32SysClock);
}
int main(void)
{
g_ui32SysClock = MAP_SysCtlClockFreqSet(
(SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL
| SYSCTL_CFG_VCO_480),
120000000);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_0);
ConfigureUART();
UARTprintf("\033[2J\033[H");
UARTprintf("String & ASCII
");
UARTprintf("Tiva C Series @ %u MHz
", g_ui32SysClock /1000000);
MAP_SysTickPeriodSet(g_ui32SysClock / SYSTICKS_PER_SECOND);
MAP_SysTickIntEnable();
MAP_SysTickEnable();
while (1)
{
TimerBegin();
PrintMyNameAscii();
MAP_SysCtlSleep();
}
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Power Of Numbers In Health Care A Students Journey In Data Analysis

Authors: Kaiden

1st Edition

8119747887, 978-8119747887

More Books

Students also viewed these Databases questions