9 years, 2 months ago.

help for lpc1768 uart software handshaking

hello my freinds. i need help for start up sofware handshaking in lpc i work hardware hanshaking everything ok but i dont know how must do for software handshaking. thanks for your help

Question relating to:

Rapid Prototyping for general microcontroller applications, Ethernet, USB and 32-bit ARM® Cortex™-M3 based designs

1 Answer

9 years, 1 month ago.

Hamid,

Software handshaking is initiated by the receiving device by sendng a command when this device cannot receive anymore characters, The sending device must check for this command and stop sending data, it must then wait until it receives a command indicating that is can send data again.

In the ASCII character set the characters Xoff and Xon are reserved for this purpose.

The tricky part is that sending devices must respond quick enough to the Xoff character so that they stop sending data before the buffer of the receiving device is full and of course this means that the receiving device must send the Xoff character before it's receive buffer is full. When that does not happen you will lose data and if there is no checksum you will not know it.

To make it more robust you can implement a buffer overflow detection mechanism on the receiving device to check for data loss and implement a set of cmmands on both ends to retransmit data if something goes wrong.

See https://en.wikipedia.org/wiki/Software_flow_control for more on this

Hope that this helps.

Ed van Rijn

Hi,Reading your answer carefully, I think your answer is more similar with modbus protocol,but is not handshaking, software handshaking needs host device send a register command with slave number, then all slaves receive and analyze the register command, the slave device whose slave number is same with the one of register command responds the host device with sending its slave number, the host device receives the respond, then sends command data frame with checksum code to slave device, the slave device receives the command data frame and checkout the command data, if the verification result is same the checksum code, it sends the command of verification code correct such as 7FH to the host device, or else sends the command of verification code error such as 70H. Through this way, the host one has a handshake with slave one. Of course, many ways can finish the handshaking, the core is the host sends command with checksum code to the slave one, then the salve one receives and checks the command and compares the checkout is whether or not same with the checksum code which is send by the host, and according to the comparing results, the salve one sends correct respond or error one to the host.

posted by Jiang Xianming 07 Mar 2015

Jiang, your description is for handshaking with a much more sophisticated protocol and more devices on the bus. My answer is for replacing hardware handshaking in a 1 to 1 connection that can be much simplier.. Ed

posted by Ed van Rijn 18 Mar 2015