[Tinyos-devel] Proposed UART Changes
Trevor Pace
trevorpace at gmail.com
Thu Jun 18 15:50:08 PDT 2009
Hey Phil,
That's pretty much exactly what I was thinking. If there is something common
amongst all chip sets why not provide it to developers to use?
Most, if not all, of the chips currently have commands like these defined in
HPL so it would be very easy to simply wire them through.
A question then would be whether it would be better to allow the user to do
something like:
CFLAGS += -DPLATFORM_BAUDRATE=9600L
or force them to call a command after Uart has started up:
call StdControl.start();
call setSpeed(TOS_UART_9600);
I would argue that both be implemented because even though the MCU might not
explicitly support a baud of lets say 10100 someone still might have a
device that functions at that (albeit rare) baud rate. So they might be
willing to accept the error rate that might come with that.
Trevor Pace
On Thu, Jun 18, 2009 at 7:24 PM, Philip Levis <pal at cs.stanford.edu> wrote:
>
> On Jun 17, 2009, at 12:56 PM, Trevor Pace wrote:
>
> Hey Eric,
>>
>> The problem I am seeing right now is that I am developing a module which
>> should in theory work on any mote that supports UART. However, there exists
>> no hardware abstraction interface provided by all platforms that would allow
>> me to disable/enable communication. It does exist at the lower HPL but that
>> is implemented per chip.
>>
>> So for me to shut-off my reception temporary I must wire a chip-specific
>> HPL Uart module removing the possibility of compatibility with other chip
>> sets. The Msp430HplUart you mentioned does support enabling/disabling for
>> sure, unfortunately by the time it gets to the PlatformSerialC abstraction
>> (which is available to all chipsets with UART) then I lose that ability.
>>
>
> It seems we definitely want a UartControl or UartSettings interface.
>
> One constraint is that we want to catch bad settings at compile-time. For
> example, trying to set the UART to a speed the MCU does not support should
> be a compile-time error. The standard way to do this is with enums: if you
> use an undefined enum you don't compile.
>
> How about something like
>
> interface UartControl {
> command error_t enableRx();
> command error_t disableRx();
> command bool rxEnabled();
>
> command error_t enableTx();
> command error_t disableTx();
> command bool txEnabled();
>
> // TOS_UART_2400, TOS_UART_57600, etc.
> command error_t setSpeed(uart_speed_t spd);
> command uart_speed_t speed();
>
> // TOS_PARITY_NONE, TOS_PARITY_EVEN, TOS_PARITY_ODD, etc.
> command error_t setParity(uart_parity_t par);
> command uart_parity_t parity();
>
> command error_t setStop();
> command error_t setNoStop();
> command bool stopBits();
> }
>
> Thoughts?
>
> Phil
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-devel/attachments/20090618/0e892c5b/attachment.htm
More information about the Tinyos-devel
mailing list