Based on the previous survey, it has become possible to control the console screen for the time being. However, for file transfer, I do not know the data generation method for error detection and remain unsolved.
Only the parts that are known about file transfer.
Transfer method
Flowchart
- Send M28 command from the PC side and wait for OK from the device side.
- Divide the file to be transferred into 4096 bytes and send it. Every 4096 bytes sent, the device will return whether it has been successfully transferred.
- After sending all data, the PC sends an M29 command, and the file transfer process is completed.
Contents of M28 command
M28 “File size” “File name”
The file name seems to be the storage destination on the device side, and has a form of 0: /user/.g.
0: / user / would be the storage folder on the device side
Split file transfer
Split the file into 4096-byte units and transfer it with 16 bytes of header. After the transfer, the equipment side sends back a reply whether the transfer is successful or not.
Contents of M29 command
Send only M29.
Header information
At the time of file division transfer, add 16-byte header. The contents were as follows.
0~3 byte | 5a 5a a5 a5 Fixed 4 bytes above. |
4~7 byte | Sequence number of the transferred block. Store with 0 end and big endian. |
8~11 byte | Stores the number of bytes of data to be transferred in big endian. |
12~15 byte | Error detection information of data to be transferred. |
Error detection information
At first it was like 32 bits, so I tried a whole algorithm to output such data, but the results did not match.
I tried CRC-32, CRC-32C, Adler32, Fletcher Checksum.
At first, the result with the simplest data is as follows.
Data | Error detection information |
47 31 | af 3f cb 07 |
Summary
If you know the algorithm of the error detection information, the library class of communication is complete.
Then, you can incorporate file pre-processing such as GUI construction, improvement of Z-axis position accuracy, and improvement of fixability of Brim.
Around here, I wonder if you split the program.
コメント