Mark Potts

uart_support

Discussion created by Mark Potts on Jun 1, 2009
Latest reply on Jun 2, 2009 by Mark Potts

I am attempting to use uart_support with an M52259DEMOMCU board [CodeWarrior IDE 5.9.0]. I can receive data using uart_getchar() but when I send data using uart_putchar() it seems to always output a null byte. I call uart_init() once before doing any I/O.

 

However if I use printf() the data is output correctly. If I trace through printf() after some gyrations it eventually uses uart_putchar(). Maybe there is some initialization I am missing? Any suggestions would be be appreciated.

 

Thanks,

Mark

 

Following up: I traced printf() in more depth. It calls:

 

set_printf(TERMIO_PutChar); /* set up TERMIO_PutChar for writing */

----------------------------------------------------------

void set_printf(void (*f)(char)) {
  /* installs a handler function to write to the terminal */
  pbuf.outc = f;
  pbuf.s = NULL;
  pbuf.i = 0;
}

----------------------------------------------------------

static struct __print_buf {
  char * s;
  void (*outc)(char);
  unsigned int i;
}
pbuf;

 

It looks like I may need to call TERMIO_PutChar at some point, however I can't locate this function(?).

 

Message Edited by Mark Potts on 2009-06-01 06:51 PM

Outcomes