Tool/software: Code Composer Studio
Hello,
I am trying to use the UART0 interface with the tm4c129 launchpad to connect with the venus gps sensor from sparkfun. I can receive data every time but i cannot send commands to limit what data I want to actually get every time. Below is the uart code i have written that has worked with receiving. I also get an overrun error when i do receive data from this interrupt process as well. Any advice or help would be greatly appreciated!
www.sparkfun.com/.../Skytraq-Venus634FLPx_DS_v051.pdf this is the data sheet, and this is the binary commands for the sensor www.sparkfun.com/.../AN0003_v1.4.14_FlashOnly.pdf
below is my code thus far.
#include <stdint.h>
#include <string.h>
#include <strings.h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#include "inc/hw_ints.h"
#include "driverlib/interrupt.h"
uint32_t ui32SysClkFreq;
int y;
char *token;
char c = '0';
char data[80];
int count = 0;
unsigned char rate[17] = {0xA0,0xA1,0x00,0x09,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x0D,0x0A};
unsigned char gga[16] = {0xA0,0xA1,0x00,0x09,0x08,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x0D,0xA0};
uint32_t num = 120000;
uint32_t delay = 102888;
void sendChar();
int main(void)
{
ui32SysClkFreq = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |SYSCTL_CFG_VCO_480), 120000000);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_UART0))
UARTClockSourceSet(UART0_BASE, UART_CLOCK_SYSTEM);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTFIFODisable(UART0_BASE);
UARTTxIntModeSet(UART0_BASE, UART_TXINT_MODE_FIFO);
UARTConfigSetExpClk(UART0_BASE, ui32SysClkFreq, 9600,(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
UARTFIFOEnable(UART0_BASE);
UARTTxIntModeSet(UART0_BASE, UART_TXINT_MODE_FIFO);
UARTFIFOLevelSet(UART0_BASE, UART_FIFO_TX1_8, UART_FIFO_RX1_8);
IntMasterEnable();
IntEnable(INT_UART0);
UARTRxErrorClear(UART0_BASE);
UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_OE | UART_INT_RT);
}
/*void sendChar()
{
unsigned int y;
for(x=0;x<10;x++)
{
while(UARTBusy(UART0_BASE));
UARTCharPut(UART0_BASE,rate[x]);
SysCtlDelay(100);
x++;
*/
void UARTIntHandler(void)
{
uint32_t ui32Status;
ui32Status = UARTIntStatus(UART0_BASE, true); //get interrupt status
UARTIntClear(UART0_BASE, ui32Status); //clear the asserted interrupt
while(UARTCharsAvail(UART0_BASE)) //loop while there are chars
{
for(y=0;y<16;y++)
{
while(UARTBusy(UART0_BASE));
UARTCharPut(UART0_BASE,gga[15]);
y++;
}
if(count<80)
{
//SysCtlDelay(delay);
data[count] = UARTCharGet(UART0_BASE);
//SysCtlDelay(delay);
count++;
}
if(count==80)
{
UARTDisable(UART0_BASE);
}
}
}