Hi Coco3811...
I have got the same problem. I am trying to send data from the board to the com-port.
I am working with MFC52235EVB. Did you find any solution for the undefined error problem?
Best Regards
T. Schmidt
#include "support_common.h" /* include peripheral declarations and more */ // Change this line for your board #include "M52223EVB_sysinit.h" #include "uart_support.h" #if (CONSOLE_IO_SUPPORT || ENABLE_UART_SUPPORT) /* Standard IO is only possible if Console or UART support is enabled. */ #include <stdio.h> #endif int main(void) { int counter = 0; volatile char c; uart_init(TERMINAL_PORT, SYSTEM_CLOCK_KHZ, TERMINAL_BAUD); #if (CONSOLE_IO_SUPPORT || ENABLE_UART_SUPPORT) printf("\n\rM52223EVB board\n\r"); // fflush(stdout); #endif for(;;) { counter++; c = uart_getchar (TERMINAL_PORT); // Read a character. uart_putchar (TERMINAL_PORT, c); // echo it. } }
c = uart_getchar (TERMINAL_PORT); // Read a character. uart_putchar (TERMINAL_PORT, c); // Echo it.
/* Enable UART Support. */#define ENABLE_UART_SUPPORT 1
#include "support_common.h" /* include peripheral declarations and more */// Change this line for your board#include "MCF52233_sysinit.h" #include "uart_support.h"
#include "MCF52233_sysinit.h" #include "uart_support.h" #include "support_common.h" /* include peripheral declarations and more */
Hey Jim,
I struggled with this same problem for quite some time until I hit the right keywords in the search box to discover this thread.
I am so glad I did. And just reading it and following all the steps that you mentioned solved it in no time. I am working with the
MCF5234 board but the steps to the solution are the same.
It's great that you helped someone with this with a complete correct code posted here.
Also, due to this person's mistake about the order of the includes, I got to learn not to make that mistake too.
Keep up the good work!
c = uart_getchar (TERMINAL_PORT); // Read a character. uart_putchar (TERMINAL_PORT, c); // echo it.
/* * main implementation: use this sample to create your own application * */#include "support_common.h" /* include peripheral declarations and more */#include "M52223EVB_sysinit.h" // This may be different for you chip. #if (CONSOLE_IO_SUPPORT || ENABLE_UART_SUPPORT) /* Standard IO is only possible if Console or UART support is enabled. */#include <stdio.h>#endifint main(void){ int counter = 0; int c; c = uart_getchar (TERMINAL_PORT); // Read a character. uart_putchar (TERMINAL_PORT, c); // echo it.#if (CONSOLE_IO_SUPPORT || ENABLE_UART_SUPPORT) printf("Hello World in C from MCF52223 derivative on M52223EVB board\n\r"); fflush(stdout);#endif for(;;) { counter++; }}
#include "uart_support.h"#include "uart_support.c"
/* * main implementation: use this sample to create your own application * */#include "support_common.h" /* include peripheral declarations and more */#include "MCF52235_sysinit.h"#include "uart_support.h"#include "uart_support.c"#if (CONSOLE_IO_SUPPORT || ENABLE_UART_SUPPORT) /* Standard IO is only possible if Console or UART support is enabled. */#include <stdio.h>#endifint main(void){// uart_init (0,60000,9600); int channel = 0; int c = 0; c = uart_getchar (channel); // Read a character. uart_putchar (channel, c); // Echo it./*#if (CONSOLE_IO_SUPPORT || ENABLE_UART_SUPPORT) printf("Hello World in C++ from MCF52235 derivative on MCF52235 board\n\r"); fflush(stdout);#endif for(;;) { }*/ }