16 Jul 2012

usart problem 2!!!!!!!!!!!!!!!!!!!!!!!!!!!1

The main reason that minicom why serial programs we get errors is before you transmit or receive you should check the following conditions:

1. Baud rate 
2. Frequency

these two things should be same in the program and in the minicom if you are transmitting the program with the baud rate of 9600 and you have configured the baud rate of the minicom as the 115200 what do you think you will get output. You will get the junk values in the terminal . In order to get sync with the transmission you should make it 9600 in the hyperterminal. In detail i will should you my errors and how did i rectify them.

see the program which i have programmed has the baud rate of 9600 bits per second and i configured the terminal as the 115200 bits per second . So no sync in between both of them . So you get the following output.

usart junk value due mismatch sync

So in order to get your data as the data you are transmitting in the program if there is sync or have baud rate same then you get the transmission as below

 How to configure the baudrate in minicom

 open minicom using the minicom -s before you do this connect serial port with serial wire. And as i explained in previous post in detail here lets discuss how to change the baudrate

Assume previously you have the baudrate of 115200 and you need to change it to 9600 .
Now change the baudrate what you need.

 you press 'C' for 9600 baud rate and then press ESC now you will see your baud rate


You got your required baudrate so continue working with your application . 
And also make that hardware / software flow control : NO
enjoy..................


                                    PROBLEM3

 







minicom problems!!!!!!!!!!!!!!!!!

(usart )
Common problems and solutions :

Q. Trying to open minicom to complete the installation and i keep getting is  "minicom : cannot open /dev/tty8 : Permission denied "
Sol : Type minicom -s  and change the port of access to /dev/ttyUSB0


use the command  minicom -s as shown


and then change the port name which is showing the as permission denied to /dev/ttyUSB0 and your frequency as required by default hardware/software flow control should be : NO


now press A to change the port  this is the default port which is showing permission denied. Now you need to change it so


press A  and type /dev/ttyUSB0 in the place of the ttyS0 or something .

Now change hardware flow control to NO if it is already unselected then leave it.  Press ESC for comming out of those selections.

Even though it doesn't open minicom then first connect the serial port for the board and try the whole thing again .

Now you get your minicom to work . enjoy .................

Problem2 : Baudrate selection config 

XMODEM PROTOCOL

XMODEM USING MINICOM: 

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:
1. XMODEM - CRC
2. XMODEM - CHECKSUM
3. XMODEM - 1K
4. XMODEM - 1KG

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.