Tom,
Thank you for your response. I am now using TeraTerm and I have the gpio initialized correctly (I think). I also cleaned up the code a little so it is more readable.
Note that this code is based off of CW 10.2 generated bareboard project for mcf52258. For clarity, I've attached the entire project. Rename the .tst file to .exe and run it to extract.
The uart_getchar function below is stuck waiting for RXRDY. If I comment out "c = uart_getchar (2);", the uart_putchar() function works.
Any idea what I am doing wrong here?
Thanks,
-Vince
#include "support_common.h" /* include peripheral declarations and more */
#if (CONSOLE_IO_SUPPORT || ENABLE_UART_SUPPORT)
/* Standard IO is only possible if Console or UART support is enabled. */
#include <stdio.h>
#include "uart_support.h"
#endif
class counterclass
{
private:
int m_counter;
public:
counterclass(void)
{
m_counter = 0;
};
void increment(void)
{
m_counter++;
};
};
int main(void)
{
counterclass myccounter;
volatile char c;
unsigned char status;
//setup gpio for uart.
MCF_GPIO_PUCPAR = 0 | MCF_GPIO_PUCPAR_UTXD2_UTXD2 | MCF_GPIO_PUCPAR_UTXD2_UTXD2;
uart_init(2, SYSTEM_CLOCK_KHZ, TERMINAL_BAUD);
#if (CONSOLE_IO_SUPPORT || ENABLE_UART_SUPPORT)
// printf("Hello World in C++ from MCF52258 derivative on MCF52258 board\n\r");
// printf("\n\rM52223EVB board\n\r");
#endif
for(;;) {
myccounter.increment();
c = uart_getchar (2); // Read a character.
uart_putchar (2, 'c');
status = MCF_UART_USR(2);
}
}
char uart_getchar (int channel)
{
/* Wait until character has been received */
while (!(MCF_UART_USR(channel) & MCF_UART_USR_RXRDY))
{
};
return (char)MCF_UART_URB(channel);
}