by limor » Fri Sep 15, 2006 3:28 am
by limor
Fri Sep 15, 2006 3:28 am
Ok.. it's 4am and i've made some progress on analyzing the protocol between the RN1 board MR-C3024.
I took two files from the RoboBasic templates, compiled them, and downloaded them into the controler. This was done while the software from
www.serial-port-monitor.com was running and tracking the communications link.
The results seem pretty straightforward.
1) A prologue of about 16 fixed chars that are sent one-by-one from the PC, waiting for the RN1 to respond with the same char (except for one case).
2) Then the PC sends the short int representing the Code-lengh one byte at a time, MSB first. RN1 responds to each byte with same value.
3) then comes a magic 3F
4) now the PC sends the program in chunks of 128 bytes at a time. each chunk is preceded by a magic 21 and followed by a 2-byte checksum (havent checked the formula yet. this may be challenging). Last chunk is 0-padded to complete the 128 bytes chunk although the Code-length value only accounts for the actual code without the 0-padding.
The code sent to the RN1 is not the whole OBJ file!
The compiled obj file has 164 prologue bytes that are completely ignored by the downloader.
I've put all this evidence in word files for your viewing pleasure.
At the end of the file you can see the two screenshots of the obj file (using the freeware WinHex). one is with the preceding 164 bytes and the other without. I erased the first 164 bytes so that the sequence is alligned with the port monitor output.
http://robosavvy.com/Builders/limor/handsup_analyzed.doc
http://robosavvy.com/Builders/limor/simpledance_analyzed.doc
Next steps (help anyone?)
- decyphering the checksum
- scripting something to emulate the PC-RN1 serial protocol
- writing some hardcore C++ code for RN1, compiling it with WinAVR, sending it to RN1 for execution...
Ok.. it's 4am and i've made some progress on analyzing the protocol between the RN1 board MR-C3024.
I took two files from the RoboBasic templates, compiled them, and downloaded them into the controler. This was done while the software from
www.serial-port-monitor.com was running and tracking the communications link.
The results seem pretty straightforward.
1) A prologue of about 16 fixed chars that are sent one-by-one from the PC, waiting for the RN1 to respond with the same char (except for one case).
2) Then the PC sends the short int representing the Code-lengh one byte at a time, MSB first. RN1 responds to each byte with same value.
3) then comes a magic 3F
4) now the PC sends the program in chunks of 128 bytes at a time. each chunk is preceded by a magic 21 and followed by a 2-byte checksum (havent checked the formula yet. this may be challenging). Last chunk is 0-padded to complete the 128 bytes chunk although the Code-length value only accounts for the actual code without the 0-padding.
The code sent to the RN1 is not the whole OBJ file!
The compiled obj file has 164 prologue bytes that are completely ignored by the downloader.
I've put all this evidence in word files for your viewing pleasure.
At the end of the file you can see the two screenshots of the obj file (using the freeware WinHex). one is with the preceding 164 bytes and the other without. I erased the first 164 bytes so that the sequence is alligned with the port monitor output.
http://robosavvy.com/Builders/limor/handsup_analyzed.doc
http://robosavvy.com/Builders/limor/simpledance_analyzed.doc
Next steps (help anyone?)
- decyphering the checksum
- scripting something to emulate the PC-RN1 serial protocol
- writing some hardcore C++ code for RN1, compiling it with WinAVR, sending it to RN1 for execution...