Core Protocol Implementation

This document describes some implementation specific details of the uSherpa
protocol on a certain hardware.

1. General Status Reporting

The following table will give an overview about the states returned in response
to a protocol request in general.

1. Requests with no return values

All requests which do not have an explicit return value will be answered with
a status message by the MCU. The status message contains one of the following
status types in its payload:

Type                Description
---------------------------------------------------------------------
ACK                 Request was successfully processed by MCU
BAD_PACKET          Packet was male-formed (e.g. wrong CRC, wrong data length)
INVALID_PACKET      Packet type was not known
INVALID_DATA        Data sent with packet was wrong for that type 
INVALID_PIN_COMMAND The command tried to execute for a given PIN was invalid
                    (e.g. if configuring a PIN for analog read which is not 
                    capable of analog read).	

2. Requests with return values

For packets which return a value in response, the corresponding response packet
is returned if everything went well. In case of an error, a status packet is
returned.

The status message contains one of the following status types in its payload:

Type                Description
---------------------------------------------------------------------
BAD_PACKET          Packet was male-formed (e.g. wrong CRC, wrong data length)
INVALID_PACKET      Packet type was not known
INVALID_DATA        Data sent with packet was wrong for that type 
INVALID_PIN_COMMAND The command tried to execute for a given PIN was invalid
                    (e.g. if configuring a PIN for analog read which is not 
                    capable of analog read).	

3. Trying to configure a reserved PIN

If one tries to configure a PIN reserved for internal use trough a PIN_FUNCTION
request, a status message with type INVALID_PIN_COMMAND will be returned.

4. Trying to configure a PIN with an unsupported function

If one tries to configure a PIN with an unsupported function through a PIN_FUNCTION
request, a status message with type INVALID_PIN_COMMAND will be returned.

2. TI Launchpad MPS430G2553 Implementation

1. Reserved PINs

This depends on the firmware loaded to the MCU.

For the “serial-sherpa” firmware which implements the uSherpa core protocol,
the following PINs are reserved:

PIN             Internal Use
-------------------------------------
P1.1            RX for UART to client
P1.2            TX for UART to client

2. Available PIN functions

X indicates function is available for PIN
– indicates function is NOT available for PIN

PIN    INPUT* OUTPUT ANALOG_IN PWM UART_RX UART_TX  	
--------------------------------------------------
P1.0     X      X       X       -    X       X   
P1.1**   X      X       X       -    X       X
P1.2**   X      X       X       X    X       X
P1.3     X      X       X       -    X       X
P1.4     X      X       X       -    X       X
P1.5     X      X       X       -    X       X
P1.6     X      X       X       X    X       X
P1.7     X      X       X       -    X       X
P2.0     X      X       -       -    X       X
P2.1     X      X       -       X    X       X
P2.2     X      X       -       X    X       X
P2.3     X      X       -       -    X       X
P2.4     X      X       -       -    X       X
P2.5     X      X       -       -    X       X
P2.6     X      X       -       -    X       X
P2.7     X      X       -       -    X       X

*) Includes FLOAT, PULL-UP, PULL-DOWN
**) Reserved for UART to client if serial transport is used by firmware

3. Limited Resources

Resource     Function   Limited to PINs
-----------------------------------------
TIMER_A0      PWM        P1.2 or P1.6
TIMER_A1      PWM        P2.1 or P2.2
TIMER_A0      UART_TX    any non reserved
TIMER_A1      UART_RX    any non reserved

In words, the above table means: If PWM is configured for pin P1.2 or P1.6,
this will bind TIMER_A0. Thus, no other function needing TIMER_A0 could be
set up at that time.

Leave a Reply

You must be logged in to post a comment.