This project was developed for use with the Blaustahl Storage Device, providing a simple method for data transfer and memory management of the device via a serial port using the Simple Read Write Protocol (SRWP) API. The protocol implements basic read and write operations, ensuring reliable interaction with the device. The example and implementation of this protocol were specifically developed for this fork of the repository, which contains the Blaustahl Storage Device and corresponding drivers.
The SRWP protocol allows interaction with the Blaustahl Storage Device through a serial port. It uses commands, each defined by a unique code, and includes a zero byte indicating that it is an SRWP command.
- CMD_TEST (0x00): Used for testing data transmission. The command sends data to the device and expects it to be returned. Returns bytes of data received from the device.
- CMD_READ (0x01): Reads data from the device. Requires specifying the address and the length of the data to be read. Returns bytes of data read from the specified address.
- CMD_WRITE (0x02): Writes data to the device. Requires specifying the address and the data to be written. This command does not return any data.
Each command begins with a zero byte indicating an SRWP command and follows the format:
-
SRWP_CMD (0x00): Indicates the start of an SRWP command.
-
CMD_TEST:
SRWP_CMD
- Zero byte indicating an SRWP command.CMD_TEST
- Command code.<data length>
- 4 bytes indicating the length of the data.<data>
- Bytes of data to be transmitted.- Returns: Bytes of data sent back from the device.
-
CMD_READ:
SRWP_CMD
- Zero byte indicating an SRWP command.CMD_READ
- Command code.<address>
- 4 bytes indicating the starting address for reading.<length>
- 4 bytes indicating the length of the data to be read.- Returns: Bytes of data read from the specified address.
-
CMD_WRITE:
SRWP_CMD
- Zero byte indicating an SRWP command.CMD_WRITE
- Command code.<address>
- 4 bytes indicating the starting address for writing.<data length>
- 4 bytes indicating the length of the data to be written.<data>
- Bytes of data to be written.- Returns: This command does not return any data.
The SRWP protocol is a simple and effective method for memory management of the Blaustahl Storage Device via a serial port. It supports basic read and write operations, ensuring reliable interaction between the device and the host. The example code demonstrates the use of the serialport
library to implement the protocol.
SRWP uses various commands to manage data transfer, making it a flexible and easy-to-use solution for applications requiring reliable data transmission.
To get started with the SRWP protocol, follow these steps:
- Connect the Blaustahl Storage Device to your computer via USB.
- Ensure the serial port is configured correctly (9600 baud, 8 data bits, 1 stop bit, software flow control, no parity).
- Use the provided code to perform read and write operations on the device.