{"id":5546,"date":"2023-11-27T17:38:07","date_gmt":"2023-11-27T09:38:07","guid":{"rendered":"https:\/\/www.tosunai.com\/?p=5546"},"modified":"2024-04-23T15:40:49","modified_gmt":"2024-04-23T07:40:49","slug":"tsmaster-sampling-point-configuration-method-and-error-frame-elimination-process","status":"publish","type":"post","link":"https:\/\/www.tosunai.com\/en\/tsmaster-sampling-point-configuration-method-and-error-frame-elimination-process\/","title":{"rendered":"TSMaster Sampling Point Configuration Method and Error Frame Elimination Process"},"content":{"rendered":"
Sampling point definition<\/u><\/p>
Communication problems due to sampling points<\/u><\/p>
How to Adjust Sample Point Parameters in TSMaster<\/u><\/p>
tsapp_configure_canfd_regs parameter configuration<\/u> The sampling point is the point in time when the CAN controller reads the bus level and interprets the logical value of each bit. Before we understand the sampling point, we need to understand the concept of bit time in CAN messages and the components of bit time. Bit time refers to the time required to transmit each bit of data, while the minimum time period of the CAN controller is called Time Quantum (TQ), which is obtained by dividing the frequency of the chip crystal period. A bit time consists of a number of TQs (usually 8 to 25), and at the same time, depending on the function, it can be divided into four phases: synchronization segment, propagation segment, phase buffer segment 1 and phase buffer segment 2.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t The four phases function as follows:<\/b><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t \u25cf Synchronization Segment: Used to implement timing adjustments, the hopping edge of each node on the bus is generated within the synchronization segment, usually 1 TQ.<\/p> \u25cf Propagation Segment: Used to compensate for physical delay times on the network that incorporate signal transmission delays on the bus and processing delays within the CAN node.\u00a0<\/p> \u25cf Phase Buffer Segment 1 (Phase_Seg1) and Phase Buffer Segment 2 (Phase_Seg2): are used to compensate for phase errors along the hopping edge, and their lengths are lengthened or shortened during the implementation of resynchronization.\u00a0<\/p> The share of sampling points and bit times corresponding to different scored baud rate times in CAN communication varies. Common sample points and related parameters are shown in the table below. Taking a baud rate of 500K as an example, a bit time is allocated into 16 time shares and the sampling point is in the 14th time share.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t Suitable sampling point location is the guarantee of CAN controller's normal communication, and its importance has three main points as follows:<\/p> \u25cf For the CAN network as a whole, each node should try to use the same sampling point location, otherwise it is easy to have sampling errors, which will cause the communication of the whole network to malfunction;\u00a0<\/p> \u25cf Sampling too early for a single node makes the node susceptible to level fluctuations at the beginning of the bit time, which in turn leads to sampling errors;\u00a0<\/p> \u25cf The CAN controller cannot sample too late due to resynchronization requirements and the width of the phase buffer segment.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t The CAN network uses asynchronous communication, so it needs to be sampled according to the baud rate, and the sampling principle is shown in the figure below. The red arrow indicates the location of the sampling point, and the sampled data is \"1010 1010\".<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t If the sampling point is set to 20% in advance, the data obtained after sampling is \"0101 1010\", which is not the same as the fifth bit of data obtained by sampling in Figure 4 when compared with the data in Figure 1. Therefore, in the CAN communication network, if the sampling point difference between the transmission nodes is different, it will cause the data transmission error, and as more data is transmitted, the more erroneous data bits are accumulated. Therefore, it is necessary to set the baud rate and sampling point of each node with the same bit when performing CAN network communication.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t In a CAN communication network, the mismatch of baud rate and sample point settings between nodes leads to problems mainly in the form of error frames. Taking baud rate 500k, sampling point 80% (phase buffer segment 1 is 63, phase buffer segment 2 is 16) and baud rate 250k, sampling point 50% (phase buffer segment 1 is 3, phase buffer segment 2 is 4) as an example, the test is carried out by using the same-star hardware TC1016 and TSmaster, respectively, and the above parameters of baud rate and sampling point are deployed to the shorted CAN1 and CAN2 channels respectively.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t Under the condition of this parameter configuration, send a message in the message sending window of TSMaster, and then you can see the status of the message data transmitted on the bus under the message information window. As shown in the figure below, if the baud rate and sampling point parameters are configured differently between the communication nodes, an error frame will appear in the message information window.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t Therefore, checking the baud rate and sampling point parameter configurations between nodes is a key direction to investigate when error frames appear in the TSMaster message information window. In addition, not only the error frame types shown in the above figure, but also other error frame types, such as bit error, form error, etc. (as shown in Figures 8 and 9), need to check the baud rate and sample point sampling point parameter configurations.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t When error frames are observed in the message information window of TSMaster due to improper sampling point settings, the parameter configurations in TSMaster need to be readjusted to achieve normal communication between nodes. Therefore, it is especially important to know how to adjust the sampling point and baud rate parameters in TSMaster to eliminate the error frames and improve the communication quality. But before that, one needs to know how to calculate the sampling point.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t Where TSEG1 and TSEG2 are represented in TSmaster as phase buffer segment 1 and phase buffer segment 2, respectively. after knowing the formula of the sampling point, the corresponding sampling point parameters can be accurately calculated according to the communication parameters of the measured parts, and then the corresponding parameters can be further configured in the Bus Hardware Interface of TSmaster in order to realize the normal communication between nodes.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t Procedure for adjusting the sample point and baud rate parameters:<\/b><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t \u25cf Step 1: First, you need to select the corresponding hardware channel in the channel needs to be selected screen and click Confirm.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t Take the CAN communication network as an example, the baud rate selection range is from 125kbps to 1000kbps, the baud rate selection should refer to the communication parameters of the DUT, and the baud rate parameter setting in TSmaster should be corresponding to it, if you don't know the baud rate parameter of the DUT, you can ask the manufacturer or switch to other baud rate parameter for the communication to see if it can improve the error frames under the other baud rate parameter. If you do not know the baud rate parameters of the device under test, you can ask the manufacturer or use other baud rate parameters for communication to see if the occurrence of error frames can be improved under other baud rate parameters.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t :: Step 3: Configure sampling point parameters (i.e., arbitration segment time)\u00a0<\/p> TSMaster provides a number of sample point parameters for configuration purposes. Referring to the arbitration segment time option in the bus hardware interface, the same sampling point may correspond to different phase buffer segment 1 parameters and phase buffer segment 2 parameters, therefore, when selecting the sampling point, you need to use the sampling point formula to calculate the sampling point parameters by selecting the corresponding phase buffer segment 1 parameter and phase buffer segment 2 parameter according to the communication parameters of the DUT and then calculate the sampling point parameters.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
<\/u><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\tI. Definition of sampling points<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
II. Communication problems due to sampling points<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
III. How to adjust the sampling point in TSMaster<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t