Home > other >  Ask questions about stm32 custom transport protocol
Ask questions about stm32 custom transport protocol

Time:10-09

To use stm32 control a laser, 32 serial port (many) after send instruction to laser, laser to 32 reply will be many all instructions, these instructions must be received, each instruction is four bytes, how to implement this function custom transfer protocol

CodePudding user response:

A microcontroller send laser 0 x20272727, after you receive the laser will
Back to MCU 0 x84845223, this must be received

Two, single chip microcomputer to send laser 0 x00000000, after you receive the laser will
Return 0 x85462536, this must also be received

Reply to the above laser MCU two instructions are fixed

Three, the above is the initialization of laser, and then laser cut to wavelength,
Also through instruction, enter 1550 in serial assistants, according to 1550
Which channel is calculated, the formula, then according to the channel calculated
Wavelength switching to send instructions

CodePudding user response:

Refer to the Modbus protocol, if only one laser can remove the address Byte; Check code can also be refinished with a simple xor without CRC calculation, 1 Byte is enough; Custom function code, data domain 4 Byte, after receiving the right frame according to self-defined protocol parsing again good,

CodePudding user response:

HMMM this laser has its own communication protocol, feet oif - msa but don't know how to write

CodePudding user response:

Custom: frame head + data + check + frame tail,
Or consider a JSON string
  • Related