Hi,
I am trying to setup UART1 communication on the LPC4357 device. This is the first time I am using an ARM device, I usually use AVR ATmega devices. Now, to setup an I/O stream, I used
(line 12) FILE *UART_STR = FDEV_SETUP_STREAM(UartPutChar, UartGetChar, _FDEV_SETUP_RW);
and then later on,
(line 24) stdout = stdin = UART_STR;
But this is not working as the IDE gives me the following errors
Driver.c(12): error: #20: identifier "FDEV_SETUP_STREAM" is undefined Driver.c(12): error: #59: function call is not allowed in a constant expression Driver.c(12): error: #20: identifier "_FDEV_SETUP_RW" is undefined Driver.c(24): error: #137: expression must be a modifiable lvalue Driver.c(24): error: #137: expression must be a modifiable lvalue
Apparently, the stdio.h library in Keil does not have this macro defined unlike the AVR library. I do not know of anything else to make my code for the UART setup work, as I need to setup an I/O stream.
So, I'm wondering if someone knows how I might fix this issue in Keil and get my code to work. Please help me with this matter!
Thank you. -Jameel
Before I started working on the UART setup for LPC4357, I went through the user manuals for the microcontroller and Keil uVision. But, the only thing I did not know was the problem that I am seeking a solution for here. The example code provided by Keil simply sets up the UART (i.e. the getc and putc functions along with the uartInit function) but does not provided any code for I/O stream setup. I tried running the code after removing the two lines, the program compiles but I do not see any output or typed text on the terminal emulator softwares like TeraTerm or RealTerm.
I did my research before posting this topic here, I tried other functions in the stdio library like fopen(), but nothing seems to work. I have run out of ways to fix this issue on my own, and that is why I thought I should seek help from those who have worked on the ARM devices before.
-Jameel