[mc1322x] problems with the UART
Jon Smirl
jonsmirl at gmail.com
Mon Jan 4 23:48:27 EST 2010
On Mon, Jan 4, 2010 at 11:39 PM, Jim Paris <jim at jtan.com> wrote:
> Your numbers "0" and "31" seem strange. The MC1322xRM says that
That was just test code. This is my real put_char(). I'm now able to
run at 921,600 baud without dropping chars. The missing trick was
turning on hardware flow control so that I don't overrun the ft232.
I'm trying to fix up the serial_802154 code to work with linux-zigbee
and run at the full ~250Kb radio speed.
char tx_buf[1024];
int head, tail;
void uart1_isr(void) {
while( reg32(UT1CON) != 0 ) {
if (head == tail) {
disable_irq(UART1);
return;
}
reg32(UART1_DATA) = tx_buf[tail];
tail++;
if (tail >= sizeof(tx_buf))
tail = 0;
}
}
int uart1_putchar(int c) {
int h;
disable_irq(UART1);
h = head + 1;
if (h >= sizeof(tx_buf))
h = 0;
if (h == tail) /* drop chars when no room */
return;
tx_buf[head] = c;
head = h;
uart1_isr();
enable_irq(UART1);
return c;
}
--
Jon Smirl
jonsmirl at gmail.com
More information about the mc1322x
mailing list