16 Jul 2012



XMODEM is one of the serial communication protocols which is used to write/read  the data to/from microcontroller serially. So in order to do that you need to have some medium to communicate that medium is xmodem .

XMODEM is used to transmit the files to/from PC.

This is having many models like:
3. XMODEM - 1K

Firstly lets discuss about XMODEM - CRC  in detail as we are using it presently:

You send your data in the form of packets :
A Packet consists of

1. Start of header           <   soh    >     1 byte
2. Packet number           <   pk no >     1 byte
3. ~Packet number        <~(pk no)>    1 byte
4. 128 bytes of data       <   data    > 128byte
5. 2 bytes of check sum <    crc     >     2byte
                                                            133 byte
In this protocol the data packet is in the format :

The file is divided into packets and send according to acknowledgements . Before sending another packet acknowledgement should be sent to say that we received the packet successfully or return No Acknowledgement so that the same packet will be retransmitted .

Packet number starts from value 1 and goes upto 255 and then start from 0 . 
Checksum is calculated by taking a 256 modulus of the sum of all ASCII values of each of 128 bytes in the data block.

The data flow is given :

The receiver will be sending 'C' to transmitter i.e:XMODEM to say that i am ready to receive data waits for 3 seconds and then timeout and again resend 'C' this will be continuing  until we receive data.

If we get the data then send the acknowledgement to the minicom so that xmodem will come to know that packet was received successfully and then this continues and if something goes wrong some error in the packet or not received it sends <NAK> (No Acknowledgement ) so that it transmit the same packet to the receiver. 

To verify that whole data is transmitted it sends EOT at the end which is nothing but End Of Transmission we should be checking for EOT. 

At receiver side you should build the code to receive the data don't bother about transmission as it is simple it is done by the hyperterminal. I will show you this clearly in next post.

In next post we will discuss about the XMODEM - checksum it is similar as the crc little changes were present.

1 comment:

  1. i see bascom bootloader (MCS ELECTRONICS)
    use this protokol to make data transfer serial bootloader...

    what about arduino??? can this protokl??
    see my blog