Tweet Not so long ago, I was engaged in the MC programming (in the framework of the work on the nanosatellite), in particular, I implemented a communication between devices by different protocols. So, where do we start? When it is necessary to solve this kind of problem, first of all, you should choose (if there are “hardware” restrictions, it means that the choice is partly made for us): data communication type (synchronous, asynchronous); interface (RS-232, RS-422, RS-485, USB, Bluetooth, etc.); protocol (WAKE, Modbus, etc.). To make the right choice, you need to take into account the scope, speed and signal transmission distance limits and other characteristics. One of my tasks was to implement a data communication between a computer and the STM32F105 MC on the existing board. On the interface board, there was the RS-485 for asynchronous serial data communication, which allows implementing connection of up to 32 devices at the same time, has a speed of 30 Mbit/s and a transmission distance of 1 200 m (see Table 1). Parameter RS-485 Data communication type Differential Maximum number of receivers 32 Maximum cable length 1200 m Maximum transmission rate 30 MBit/sec Output voltage -7…+12 V Receiver sensitivity ±200 mV Table 1. RS-485 interface parameters In principle, it is possible to implement a data communication without a protocol, but in this way, nobody guarantee data integrity and timely delivery, so a common practice is to use specialized protocols. Data communication protocol is a set of agreements of a logic level interface that define a data communication between different programs. These agreements define a uniform method for transmitting messages and error handling in the interaction of software of spaced apart devices, connected by one or another interface. A standardized data communication protocol also enables to develop interfaces (now at the physical level), which are not tied to a particular hardware platform and manufacturer (e.g., USB, Bluetooth). Communication protocols generally operate on the “master-slave” principle. A master initiates a communication and sends a request to slave devices (slaves), and slave devices respond (or do not respond) to requests according to the address in a package. There are many protocols, but one of the most common is Modbus. The Modbus protocol was established many years ago but is still very...
Read More