Part Number: EK-TM4C123GXL
Other Parts Discussed in Thread: MAX3232
Tool/software: Code Composer Studio
Hey people
I am trying to connect my U-blox Neo6M GPS sensor to EK-TM4C123GXL launchpad. My connections are below;
GPS Tx -> TM4C PC4
TM4C Debug USB -> PC
I am trying to read GPS data afrom Uart 4 (PC4-PC5) and without even touching it, directly passing to PC via UART0 and usb cable. To be safe, I based my source code on uart_echo example. And kinda tried to do everything that is done for UART0 for UART4 too(copied function calls with parameters changed to UART4 related ones).
My source code is below
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "driverlib/debug.h"
#include "driverlib/fpu.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#ifdef DEBUG
void
__error__(char *pcFilename, uint32_t ui32Line)
{
}
#endif
void
UARTIntHandler(void)
{
uint32_t ui32Status0;
uint32_t ui32Status1;
ui32Status0 = ROM_UARTIntStatus(UART0_BASE, true);
ROM_UARTIntClear(UART0_BASE, ui32Status0);
ui32Status1 = ROM_UARTIntStatus(UART4_BASE, true);
ROM_UARTIntClear(UART4_BASE, ui32Status1);
while(ROM_UARTCharsAvail(UART4_BASE))
{
ROM_UARTCharPutNonBlocking(UART0_BASE,ROM_UARTCharGetNonBlocking(UART4_BASE));
}
}
void UARTSend(const uint8_t *pui8Buffer, uint32_t ui32Count)
{
while(ui32Count--)
{
ROM_UARTCharPutNonBlocking(UART0_BASE, *pui8Buffer++);
}
}
int
main(void)
{
ROM_FPUEnable();
ROM_FPULazyStackingEnable();
ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART4);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
ROM_IntMasterEnable();
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
GPIOPinConfigure(GPIO_PC4_U4RX);
GPIOPinConfigure(GPIO_PC5_U4TX);
ROM_GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_4 | GPIO_PIN_5);
ROM_UARTConfigSetExpClk(UART0_BASE, ROM_SysCtlClockGet(), 115200,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
ROM_UARTConfigSetExpClk(UART4_BASE, ROM_SysCtlClockGet(), 9600,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
ROM_IntEnable(INT_UART0);
ROM_UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT);
ROM_IntEnable(INT_UART4);
ROM_UARTIntEnable(UART4_BASE, UART_INT_RX | UART_INT_RT);
UARTSend((uint8_t *)"\033[2JEnter text: ", 16);
while(1)
{
}
}
When I debug the code, and after a while pausing, it stops at FaultISR function's infinite loop.
I might be doing some fundamental mistake as all UARTs might not be exactly same, maybe I do need another circuitry like MAX3232. Can you help me about this problem?
Note: I can test uart_echo example binary on my TM4C so at least UART0 works properly.
Data sheet for GPS is : www.u-blox.com/.../NEO-6_DataSheet_(GPS.G6-HW-09005).pdf