Hi together,
I am trying to get UART working on my Stellaris Launchpad (LM4F120H5QR) using the onboard PIN headers (UART1/2) instead of the USB cable (UART0). This is how my code looks like (based on uart_echo from StellarisWare). I am using a FOCA tiny break-out board (integrating a FT232 IC) to receive the data on my terminal software. Currently, I am trying to set up UART1 and GPIOB (PB0 / PB1). However, I do not receive anything on my temrinal software, while using the standard uart_echo code for UART0 it works properly.
Can somebody tell me what I am missing? If this works, I am getting closer to my actual goal, which is enabling and using UART1/2 in ASM.
Best regards
uart_echo.c
uart_echo.c int main(void) { // // Enable lazy stacking for interrupt handlers. This allows floating-point // instructions to be used within interrupt handlers, but at the expense of // extra stack usage. // ROM_FPUEnable(); ROM_FPULazyStackingEnable(); // // Set the clocking to run directly from the crystal. // ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // // Enable the GPIO port that is used for the on-board LED. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); // // Enable the GPIO pins for the LED (PF2). // ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2); // // Enable the peripherals used by this example. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); // // Enable processor interrupts. // ROM_IntMasterEnable(); // // Set GPIO A0 and A1 as UART pins. // GPIOPinConfigure(GPIO_PB0_U1RX); GPIOPinConfigure(GPIO_PB1_U1TX); ROM_GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1); // // Configure the UART for 115,200, 8-N-1 operation. // ROM_UARTConfigSetExpClk(UART1_BASE, ROM_SysCtlClockGet(), 115200, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); // // Enable the UART interrupt. // ROM_IntEnable(INT_UART1); ROM_UARTIntEnable(UART1_BASE, UART_INT_RX | UART_INT_RT); // // Loop forever echoing data through the UART. // while(1) { UARTSend((unsigned char *)"Hello World!\n", 13); } }
And I changed the corresponding values in the Startup file to the following values:
startup_rvmdk.S
... ... DCD IntDefaultHandler ; The PendSV handler DCD IntDefaultHandler ; The SysTick handler DCD IntDefaultHandler ; GPIO Port A DCD IntDefaultHandler ; GPIO Port B DCD IntDefaultHandler ; GPIO Port C DCD IntDefaultHandler ; GPIO Port D DCD IntDefaultHandler ; GPIO Port E ;DCD UARTIntHandler ; COMMENTED OUT ... UART0 Rx and Tx ;DCD IntDefaultHandler ; COMMENTED OUT ... UART1 Rx and Tx DCD IntDefaultHandler ; UART0 Rx and Tx DCD UARTIntHandler ; UART1 Rx and Tx