Skip to main content

What's the serial communication in Rust?

 What's the serial communication in Rust?

What's the serial communication in Rust?

Description

  • It's a communication mechanism that takes place using the asynchronous protocol.
  • Two devices exchange data serially in this communication 1 bit at a time
  • These 2 devices exchange data using 2 shared data lines and 1 common ground.
  • The protocol is asynchronous because none of the shared lines carries a clock.
  • But both (transmitter and receiver) have to agree prior to the communication that how fast data will be sent/received.
  • This protocol allows duplex communication which means both can send data simultaneously.

Why we need this protocol? What's the use-case?

  • We are using this protocol to exchange data between MCU and host computers for example our laptops.

  • Unlike ITM protocol, this protocol lets us send data from laptop to MCU

Now a question arises. How fast we may send data using this protocol?

  • This protocol works with frames
  • Each frame has 1 start bit, 1-2 stop bits, and 5-9 data bits
  • Speed of protocol is known as baud rate and it's quoted in baud per seconds (bps)
  • Few baud rate examples are: 9600, 19200, 38400, 57600, and 115200 bps
  • To actually answering the question
  • With a common configuration of 1-start bit, 8-data bits, 1-stop bit, and a baud rate of 115200 bps
  • Theoretically, we can send 11,520 frames per second
  • Data rates will probably be lower due to processing time on the slower side of communication (the MCU) practically.

Now the problem is our laptops don’t support serial communication protocol!

  • It means we can’t connect our laptop directly to the MCU
  • Here is the serial module come in the picture
  • Our module will sit between the 2 devices and expose a serial interface to the MCU and a USB interface to the laptop
  • This is how both MCU and laptop will see each other as a serial device.

Uses

  • We use Serial communication for all long-haul communication.
  • All-out computer networks that the cost of cable and synchronization difficulties makes similar communication irrational.
  • Serial computer buses are fetching additional common even at shorter distances.
  • Technologies have begun to outweigh the parallel bus's advantage of simplicity due to healthier signal reliability and transmission speeds in newer serial.

Serial buses

  • A lot of communication systems were usually intended to connect two integrated circuits on the same printed circuit board.
  • That board is connected by signal traces on that board rather than external cables.
  • Combined circuits are more expensive when they have more pins.
  • Many ICs use a serial bus to transfer data when speed is not important to reduce the number of pins in a package.

Cables

  • A lot of serial communication systems were first designed to transfer data over comparatively large distances through some sort of data cable.
  • Rather than in parallel, almost all long-distance communication transmits data one bit at a time as it decreases the cost of the cable.
  • The cables that carry this data other than the serial cable and the computer ports they plug into are typically mentioned with an extra specific name to reduce confusion.
  • Keyboard and mouse cables and ports are nearly always serial.

Popular posts from this blog

What is Internet of Things (IoT)?

 What is Internet of Things (IoT)?    The internet of Things, or IoT, refers to the billions of physical devices  round the  world that are now connected to  the web  , collecting, sharing and analyses  of knowledge  . It presents and provides the explanation of the network of physical things which is embedded with software , sensors,  and other technologies for the benefit of connecting and exchanging data with other devices and systems on the internet   . Due to the cheap processors and wireless networks, it's possible to  means  anything, from a pill to an aero plane to a self-driving car into  an area  of the IoT. Overview IoT will control the Fourth  technological revolution  . The Fourth  technological revolution  is changing the very software-defined automation allows manufacturers to link all stages of  the worth  chain, rapidly adapt to changing markets , and make highly personalized products on a mass scale. The opportunities provided by this revolution are authenticated

What is Rust Borrowing?

What is Rust Borrowing? Borrowing We call having references as function parameters borrowing. As in real world , if an individual owns something, we 'll borrow it from them . Whenever we’re done, we 've got to offer it back. Referencing  The reference is that the act of consulting somebody or something so as to urge information We would  declare reference in terms of Rust programing as if we are taking a replica of it without damaging or taking its ownership. ‘&’ symbol is employed to pass the reference Have a look that  how ‘&’ symbol is employed in code. fn main() { let s1 = String::from("hello"); let len = calculate_length(&s1); println!("The length of {} is {}.", s1, len); } fn calculate_length(s: &String) -> usize { s.len()} Mutable References The actual concept of mutable reference is same as we use mutable variable When  we  need to  modify  mutable reference is employed once   the worth we make regard to.

Kubernetes Readiness Probes

 Kubernetes Readiness Probes Description We understand that liveness probes and the way they assist keep our apps healthy by ensuring unhealthy containers are restarted automatically. Same like liveness probes, Kubernetes permit us to also define a readiness looked for our pod. The readiness probe is deployed periodically and examines whether the precise pod should receive client requests or not. Whenever a container’s readiness probe returns back success, it’s signaling that the container is ready to simply accept requests. This notion of being prepared is clearly something that’s specific to every container. Almost as liveness probe Kubernetes sends requests to container and supported the result either successful or unsuccessful response it decides container is prepared to require traffic or still preparing for that. The liveness probes not like, if a container fails the readiness check, it won’t be killed or restarted.   This is a very good practice to