Photovoltaic Installation Tools Pv Testers,Photovoltaic Installation Tools,Photovoltaic Tester,Solar Pv Tester Sowell Electric CO., LTD. , https://www.sowellsolar.com
Many engineers have a headache when choosing the baud rate. I read how to quickly solve the special baud rate calculation.
Many factors influence the stability of a CAN bus, and one of the most critical indicators is the baud rate. Engineers often struggle when selecting the right baud rate. Today, we’ll discuss a quick way to solve the issue of special baud rate calculations.
The CAN bus uses asynchronous serial communication, meaning there’s no dedicated clock line to maintain synchronization among transceivers. Each transceiver interprets the bus level based on the preset baud rate. Hence, setting the baud rate properly is crucial for stable CAN bus communication.
In the CAN bus, we can achieve different baud rates by adjusting the bit timing registers within the CAN nodes. According to the CAN protocol, a bit time is divided into four segments: the synchronization segment, propagation segment, phase buffer segment 1, and phase buffer segment 2. Each segment's length can be expressed as an integer number of basic time units, derived from the system’s clock oscillator.
The synchronization segment is at the start of a bit. It's specified that the edge of the transition serves as a synchronization signal. However, there’s a network propagation delay between when a transmitting node sends a bit and when the receiving node receives it. The propagation segment compensates for this delay. Since the sampling point lies between the phase buffer segment 1 and phase buffer segment 2, adjusting these two segments allows us to position the sampling point accurately, ensuring consistency across all bits. The range of adjustment for these segments is determined by the synchronization jump width (SJW).
[Insert image of CAN bit time structure]
After understanding the CAN bus bit time segmentation, let’s explore how to set the baud rate for a node. Figure 2 illustrates the bit timing characteristic register (CAN_BTR) of an ARM core.
[Insert image of ARM core bit time characteristic register]
SILM (silent mode) and LBKM (loopback mode) are mainly used for debugging purposes.
The SJW refers to the synchronization jump width; TS2/TS1 represent the allocation of two time periods within the bit time; BRP stands for the baud rate prescaler, defining the length of the basic time unit. For instance, a renowned automotive manufacturer’s CAN communication standard mandates that when the communication rate is 125 kbps, single sampling should be used, with the sampling point positioned between 70% and 77%. The values of the bit timing parameters can be seen in Table 1 and Table 2.
[Insert Table 1 and Table 2 images]
The sampling point cannot be too early or too late. If it’s near the rising or falling edge of a bit, it may lead to misrecognition. According to the CIA105 specification, the ideal sampling point is around 87.5%. However, in practice, we typically choose between 75% and 85%.
The SJW directly impacts the adjustable range of the phase buffer segment during resynchronization. The SJW value can range from 1 to 4. Choosing 3 or 4 broadens the baud rate tolerance of the bus.
Single sampling versus triple sampling: While triple sampling was initially designed to filter out noise on the bus, it often interferes with the SJW jump. Thus, in practical applications, we generally opt for single sampling.
Understanding the principles of baud rate settings, we utilized ZLG Zhiyuan’s baud rate calculation software to determine the bit timing parameters for a 25kbps baud rate. The results are shown in Figure 3.
[Insert Figure 3]
Based on the principles discussed, we chose a set of parameters with a sampling point of 75%, an SJW of 4, and a time share of 14, then verified them using ZLG’s CAN card.
Automatic baud rate identification: Using CANScope’s automatic baud rate detection function, the baud rate of the CAN card was identified, and the result was 25kbps.
[Insert Figure 4]
Sampling point testing: Using CANScope to test the sampling point of the CAN card at the current baud rate, the result showed a sampling point at 75%.
[Insert Figure 5]
Bit width tolerance testing: Using CANScope to test the bit width tolerance of the CAN card at the current baud rate, its tolerance to the baud rate was tested, and the result showed a tolerance range of 24kbps to 26kbps, indicating good tolerance.
[Insert Figure 6]
Bit time testing: Using CANScope’s eye diagram function to test the bit time of the CAN card at the current baud rate, the bit time was measured at 40us, consistent with the bit time for a 25kbps baud rate.
[Insert Figure 7]
By verifying the baud rate register settings calculated by the baud rate calculator, the test results matched our expectations. Thus, when using special baud rates, we can quickly calculate the bit timing register parameter values using the baud rate calculator. Below are some parameters for special baud rates that can serve as references:
[Insert image of additional parameters]
This method ensures smooth communication while offering flexibility and precision in setting up the CAN bus.