uMCP Ino - is a free view on old (but still good!) DEC's DDCMP protocol.
- a lightweight (only 6 extra bytes for data packets and 4 bytes for control packets)
- byte-oriented
- point-to-point
- with handshake
- with Nagle's algorithm
- pipelining
- integrity control
- guaranteed packets ordering
- and guaranteed delivery
In the Arduino-compatible implementation, there are some limitation due to memory size:
- the packet size is limited to 64 bytes
- the number of sent and unacknowledged packets is limited to 8
- the number of packets to be send in pipelining mode is limited to 4
Offset, bytes | Item | Size, bits |
---|---|---|
0 | SIGN = 0xAD | 8 |
1 | PTYPE | 8 |
2 | TCNT | 4 |
2 | RCNT | 4 |
3 | HCHK | 8 |
if PTYPE == uMCP_PTYPE_DTA || PTYPE == uMCP_PTYPE_DTE
Offset, bytes | Item | Size, bits |
---|---|---|
4 | DCNT | 8 |
.. | DATA | 8 * DCNT |
5 + DCNT | DCHK | 8 |
endif
There are two types of nodes in the protocol:
- Selected by default (Master node)
- And unselected by default (tributary node)
A node can only send data messages when its SELECT flag is set to true
The main differences between Master and Tributary nodes are:
- a master node has SELECT flag is set to true by default
- a tributary node should return the SELECT flag as soon as it transmits all the data to be transmitted
- if for some reason a master node doesn't receive the SELECT flag, it regains it by timeout
All control messages transfer the SELECT flag.
- Program your Arduino board with uMCPInoNode sketch
- Connect your Arduino board with your PC via USB-UART converter
- On your PC, run the uMCPIno Test application
- Open Port monitor in Arduino IDE
- Connect the uMCPIno test application to the USB-UART converter port
- Now, to establish uMCPIno connection you can reset your Arduino board or press "START" button in the application.
Here some screenshots:
- if you want to use a standalone Arduino board as a uMCP-converter, when you put some data to it, and want it to be safely transferred to another uMCP Node, use uMCPIno.ino sketch. It supposed to use 2 serial ports - one to send and receive data bytes, and another to use as uMCP line (it can be Bluetooth, RF, or even underwater acoustic link).
- if you want to embed the uMCPIno protocol to your project, you can use the uMCPInoNode.ino sketch. In this case you should change the sketch's code:
-
To send data over uMCPIno link use the function:
bool uMCPIno_SendData(byte* dataToSend, byte dataSize);
where:
dataToSend
- a byte buffer to send
dataSize
- size of the buffer -
Before sending data, check if there is enough space in tx buffer:
bool uMCP_IsCanSend(byte dataSize);
where:
dataSize
- number of bytes to send -
To analyse the received data:
The received over uMCP link data is stored in a ring bufferil_ring
.
The amount of received bytes is stored inil_Cnt
The read pointer is inil_rPos
.
To perform the analysis of the received data, put your code in function:
void USER_uMCPIno_DataPacketReceived();
It fires when new data packet has been received from a remote node over uMCP line -
If you need to be informed, when the tx buffer is empty, put your code in function:
void USER_uMCP_OnTxBufferEmptry();
it fires when all sent messages has been acknowlegded by the remote node
-