[Tinyos-2-commits] Adjacency bug in new (vastly improved) UART implementation

Roland Tembo Hendel rhendel at solarenigma.com
Thu Jun 14 22:18:02 PDT 2007


On 5-25, Alec Woo made some much needed improvements to the implementations
of Atm128UartP.nc HplAtm128UartP.nc.

I have been using this improved version, but would like to alert the
community to a nasty bug that I uncovered in my testing:

The Atm128 implementation of McuSleepC.nc determines which power mode to
enter by checking if UART interrupts are enabled. The new improved UART
implementation does not enable interrupts by default. The result of this is
that under certain conditions the atm128 will enter idle mode (UARTS not
serviced), stranding bytes in the UART FIFOS if the UART is enabled but NOT
running interrupts. This caused me a multitude of headaches as I use the
UART to instrument a one-wire network.

The solution is to change the line in McuSleepC.nc from:

--- FROM:
else if ((UCSR0B | UCSR1B) & (1 << TXCIE | << 1 RXCIE)) {
 return AM128_POWER_IDLE;
}

--- TO:
else if ((UCSR0B | UCSR1B) & (1 << TXEN | << 1 RXEN)) {
 return AM128_POWER_IDLE;
}
---

There may be a more granular check than the one that I am proposing and I'm
open to suggestions, but at least this implementation works. In the
meantime, improved power management can be maintained by disabling the UARTs
when they are not in use.

Cheers,
Roland



More information about the Tinyos-2-commits mailing list