4.14 Signal Quality Indicator (SQI)
The channel Signal Quality Indication (SQI) provides an indication of channel quality between nodes on the network segment. In the LAN8670/1/2, the SQI implementation is designed to be compatible with the OPEN Alliance specification for advanced diagnostic features for automotive Ethernet PHYs.
The SQI is determined by accumulating statistics on received data. When PLCA is used, a single node is selected by using the Transmit Opportunity ID (TOID) bit field of the SQI Configuration 0 (SQICFG0); the SQI is then computed from the data received only during that transmit opportunity. If the average SQI of the transmission line required, it is possible to set this field to ‘0xFF’ to calculate the SQI for all nodes simultaneously. This calculates a weighted average of the complete data traffic on the line, the more a node transmits, the higher this node will be weighted. When PLCA is not enabled, this field should be set to ‘0xFF’ to request that the SQI will be computed over all received data. Statistics are calculated on the selected data and the resulting quality index is stored in the SQI Value (SQIVAL) field of the SQI Status 0 (SQISTS0) register in eight levels (between ‘000’ = worst value and ‘111’ = best value).
During the accumulation of statistics, it is possible that an error could occur. Such an error is indicated by setting bits in two different registers: the SQI Error (SQIERR) bit in the SQI Status 0 (SQISTS0) register and the SQI status bit in the Status 1 (STS1) register. In addition, an SQI error can be selected to assert the IRQ_N pin by clearing the SQI Interrupt Mask (SQIM) bit in the Interrupt Mask 1 (IMSK1) register.
The SQI feature operates in one of two modes. Polling mode is used for taking a single measurement or when comparing performance between multiple channels. Threshold alert mode is used to monitor one TOID continuously and provide an interrupt should SQI drop below a limit. These modes are described in the following sections.
Programming Model - Polling
- Configure the PLCA transmit opportunity of the node of interest into the Transmit Opportunity ID (TOID) bit field of the SQI Configuration 0 (SQICFG0) register. If not using PLCA, the value 0xFF should be used so that the SQI is computed from received packets from all nodes.
- Ensure that the SQI Interrupt Threshold (SQIINTTHR) field of the SQI Configuration 2 (SQICFG2) register is at the default value of 11111b.
- Set the SQI Enable (SQIEN) bit to ‘1’ in the SQI Control (SQICTL) register to start SQI measurement.
- The SQI statistical accumulation
process has completed and an SQI computed once the SQI Valid (SQIVLD) bit is set.
Periodically poll both the SQIVLD and SQIERR bit until one is set.
- If the SQIVLD bit = ‘1’, the measured SQI is returned in the SQI Value (SQIVAL) field.
- Else if the SQIERR bit = ‘1’,
restart the measurement:
- Write a ‘0’ to the SQI Enable bit to clear the error.
- Write a ‘1’ to the SQI Enable to restart.
Tip: The time required for the SQI statistical accumulation process to complete depends on the amount of data received from the node of interest and may therefore vary significantly. A polling rate of approximately once per second is recommended. - The SQI Valid status bit will be cleared when read and automatically set again once a new SQI value has been determined. The application may continue to monitor the SQI for the selected transmit opportunity by returning to step #3 above and polling for the SQI Valid bit to become set again.
- To stop SQI measurements, write a ‘0’ to clear the SQI Enable bit.
Programming Model - Threshold Alert Mode
- Configure the PLCA transmit opportunity of the node of interest into the Transmit Opportunity ID (TOID) bit field of the SQI Configuration 0 (SQICFG0) register. If not using PLCA, the value 0xFF should be used so that the SQI is computed from received packets from all nodes.
- Configure the SQI Interrupt Threshold (SQIINTTHR) field of the SQI Configuration 2 (SQICFG2) register for the SQI threshold at which the SQI status bit will be asserted. For example, configuring SQIINTTHR to 00101b will result in the SQI status bit being asserted when an SQI of 4 or below is measured.
- Write a ‘0’ to the SQI Interrupt Mask (SQIM) bit of the Interrupt Mask 1 (IMSK1) register to enable the assertion of the IRQ_N pin when the SQI status bit is set.
- Set the SQI Enable (SQIEN) bit to ‘1’ in the SQI Control (SQICTL) register to enable SQI measurement.
- When the IRQ_N pin is asserted, read
the Status 1 (STS1) register.
- If the SQIVLD bit = ‘1’, the device measured an SQI of less than or equal to the configured threshold.
- Else if the SQIERR bit = ‘1’,
restart the measurement:
- Write a ‘0’ to the SQI Enable bit to clear the error.
- Write a ‘1’ to the SQI Enable to restart.
- To stop SQI measurements, write a ‘0’ to clear the SQI Enable bit.