Disclosure of Invention
The embodiment of the invention aims to provide a decoding method and a decoding device for an RFID reader-writer, which solve the problem that the error rate of the RFID reader-writer in the prior art is high in a low signal-to-noise environment and overcome the problem of fast strong signal conversion caused by relative movement of the RFID reader-writer and an electronic tag.
In order to achieve the above object, an embodiment of the present invention provides a decoding method for an RFID reader, where the method includes: receiving a return signal of the electronic tag; obtaining an in-phase signal and a quadrature signal from the return signal at a preset sampling frequency, wherein the preset sampling frequency is a preset multiple of the return frequency of the return signal; obtaining a complex signal corresponding to the return signal according to the data phase of the in-phase signal and the quadrature signal; determining actual oversampling numbers of data to be decoded and single pilot tones in the complex signal according to the return frequency, the preset sampling frequency, a frequency preset deviation range and the coding type of the return signal; and determining a decoding result corresponding to the data to be decoded in the relevant period corresponding to the actual oversampling number according to the encoding type of the return signal and the actual oversampling number.
Further, the obtaining an in-phase signal and a quadrature signal from the return signal at a preset sampling frequency includes: sampling through an analog-to-digital converter (ADC), and converting an in-phase signal and a quadrature signal in the return signal from an analog domain to a digital domain; and respectively filtering the in-phase signal and the quadrature signal of the digital domain at the preset sampling frequency.
Further, the obtaining a complex signal corresponding to the return signal according to the data phase of the in-phase signal and the quadrature signal includes: according to F = (I + j Q) < e >(-j*Φ)And obtaining a complex signal F corresponding to the return signal, wherein I is the in-phase signal, Q is the quadrature signal, and phi is a channel phase calculation value, wherein phi is approximately equal to atan (Q/I).
Further, after obtaining a complex signal corresponding to the return signal according to the data phase of the in-phase signal and the quadrature signal, the method further includes: comparing the real part of the complex signal with a preset signal threshold; when the real part of the complex signal is lower than the preset signal threshold, determining that the return signal of the electronic tag is an invalid signal, and ending the decoding operation of the return signal; and when the real part of the complex signal is not lower than the preset signal threshold, determining that the return signal of the electronic tag is an effective signal, and continuing the decoding operation of the return signal.
Further, the determining the actual oversampling number of the single pilot tone and the data to be decoded in the complex signal according to the return frequency, the preset sampling frequency, the preset frequency deviation range, and the coding type of the return signal includes: according to Hl=FS/[F0*(1+r)],Hh=FS/[F0*(1-r)]Obtaining the lower limit value H of the oversampling number of the single pilot tone in the complex signallAnd an upper limit value HhWherein F is0For said return frequency, FSSetting the preset sampling frequency as the preset deviation range of the frequency +/-r%; obtaining the value range of the oversampling number of the single pilot tone in the complex signal according to the lower limit value and the upper limit value of the oversampling number; determining a lead code capture coefficient corresponding to each oversampling number in the oversampling number value range according to the oversampling number value range and the coding type of the return signal; taking the lead code capture coefficient corresponding to each oversampling number as the coefficient of the lead code matched filter corresponding to each oversampling number; matching the real part of the complex signal with a lead code matched filter corresponding to each oversampling number to obtain a matched output value corresponding to each oversampling number; taking the oversampling number corresponding to the maximum value in the matching output values as the actual oversampling number of the single pilot tone in the complex signal; and determining a lead code corresponding to the actual oversampling number according to a coding protocol corresponding to the coding type, and taking the data from which the lead code in the complex signal is removed as data to be decoded.
Further, the determining, according to the encoding type of the return signal and the actual oversampling number, a decoding result corresponding to the data to be decoded in the correlation period corresponding to the actual oversampling number includes: determining sampling point values of a first waveform and a second waveform in the correlation period according to the coding type of the return signal and the actual oversampling number; extracting waveform data in the relevant period from the data to be decoded; respectively multiplying and accumulating the waveform data with the sampling point value of the first waveform and the sampling point value of the second waveform to respectively obtain a first correlation result corresponding to the first waveform and a second correlation result corresponding to the second waveform; taking the maximum value of the first type of correlation result and the second type of correlation result as a signal decision result; and determining the waveform corresponding to the signal judgment result as a decoding result corresponding to the data to be decoded in the relevant period.
Further, the obtaining a first correlation result corresponding to the first waveform and a second correlation result corresponding to the second waveform by performing multiply-accumulate operations on the waveform data and the sample values of the first waveform and the sample values of the second waveform respectively includes: respectively carrying out multiplication and accumulation operations on the waveform data without delay, the waveform data delayed by a sampling point and the waveform data delayed by two sampling points and sampling point values of the first waveform to respectively obtain a first leading correlation result, a first current correlation result and a first delaying correlation result corresponding to the first waveform; acquiring absolute values corresponding to a first type of leading correlation result, a first type of current correlation result and a first type of delaying correlation result corresponding to the first waveform, and taking the maximum absolute value as the first type of correlation result corresponding to the first waveform; respectively carrying out multiplication and accumulation operations on the waveform data without delay, the waveform data delayed by a sampling point and the waveform data delayed by two sampling points and the sampling point value of the second waveform to respectively obtain a second advanced correlation result, a second current correlation result and a second delayed correlation result corresponding to the second waveform; and acquiring absolute values corresponding to a second type of leading correlation result, a second type of current correlation result and a second type of delaying correlation result corresponding to the second type of waveform, and taking the maximum absolute value as the second type of correlation result corresponding to the second type of waveform.
Further, after the determining the decoding result corresponding to the data to be decoded in the correlation period corresponding to the actual oversampling number, the method further includes: will be provided withComparing the absolute value corresponding to the first type of advanced correlation result corresponding to the first waveform with the absolute value corresponding to the second type of advanced correlation result corresponding to the second waveform, and taking the maximum absolute value as the absolute value of the advanced correlation result; comparing the absolute value corresponding to the first current correlation result corresponding to the first waveform with the absolute value corresponding to the second current correlation result corresponding to the second waveform, and taking the maximum absolute value as the absolute value of the current correlation result; comparing the absolute value corresponding to the first type of delayed correlation result corresponding to the first waveform with the absolute value corresponding to the second type of delayed correlation result corresponding to the second waveform, and taking the maximum absolute value as the absolute value of the delayed correlation result; determining a read address mark according to the maximum value of the absolute value of the advanced correlation result, the absolute value of the current correlation result and the absolute value of the delayed correlation result; obtaining the actual starting point of the data to be decoded of the next relevant period according to any one of the following formulas: a. then=Ao+2-flag, or An=Ao+3-2 flag, wherein AnFor the actual starting point, AoA flag is the read address mark at the end point of the current correlation period, the value of the flag is 0 when the absolute value of the advanced correlation result is maximum, the value of the flag is 1 when the absolute value of the current correlation result is maximum, and the value of the flag is 2 when the absolute value of the delayed correlation result is maximum; and extracting the data to be decoded of the next relevant period from the actual starting point for decoding operation.
Correspondingly, the embodiment of the invention also provides a decoding device for the RFID reader-writer, which comprises: the receiving unit is used for receiving a return signal of the electronic tag; the signal sampling unit is used for obtaining an in-phase signal and an orthogonal signal from the return signal at a preset sampling frequency, wherein the preset sampling frequency is a preset multiple of the return frequency of the return signal; the phase calculation unit is used for obtaining a complex signal corresponding to the return signal according to the data phase of the in-phase signal and the orthogonal signal; the data to be decoded determining unit is used for determining the actual oversampling number of the data to be decoded and the single pilot tone in the complex signal according to the return frequency, the preset sampling frequency, the preset frequency deviation range and the coding type of the return signal; and the decoding unit is used for determining a decoding result corresponding to the data to be decoded in the relevant period corresponding to the actual oversampling number according to the encoding type of the return signal and the actual oversampling number.
Further, the signal sampling unit is further configured to convert an in-phase signal and a quadrature signal in the return signal from an analog domain to a digital domain by sampling through an analog-to-digital converter (ADC); and respectively filtering the in-phase signal and the quadrature signal of the digital domain at the preset sampling frequency.
Further, the phase calculation unit is further configured to calculate the phase based on F = (I + j × Q) × e(-j*Φ)And obtaining a complex signal F corresponding to the return signal, wherein I is the in-phase signal, Q is the quadrature signal, and phi is a channel phase calculation value, wherein phi is approximately equal to atan (Q/I).
Further, the apparatus further comprises: the threshold comparison unit is used for comparing the real part of the complex signal with a preset signal threshold; when the real part of the complex signal is lower than the preset signal threshold, determining that the return signal of the electronic tag is an invalid signal, and ending the decoding operation of the return signal; and when the real part of the complex signal is not lower than the preset signal threshold, determining that the return signal of the electronic tag is an effective signal, and continuing the decoding operation of the return signal.
Further, the unit for determining data to be decoded is also configured to determine the data to be decoded according to Hl=FS/[F0*(1+r)],Hh=FS/[F0*(1-r)]Obtaining the lower limit value H of the oversampling number of the single pilot tone in the complex signallAnd an upper limit value HhWherein F is0For said return frequency, FSSetting the preset sampling frequency as the preset deviation range of the frequency +/-r%; obtaining the value range of the oversampling number of the single pilot tone in the complex signal according to the lower limit value and the upper limit value of the oversampling number; according to the value range of the oversampling number and the coding of the return signalDetermining a code type, wherein a lead code capture coefficient corresponding to each oversampling number in the value range of the oversampling number is determined; taking the lead code capture coefficient corresponding to each oversampling number as the coefficient of the lead code matched filter corresponding to each oversampling number; matching the real part of the complex signal with a lead code matched filter corresponding to each oversampling number to obtain a matched output value corresponding to each oversampling number; taking the oversampling number corresponding to the maximum value in the matching output values as the actual oversampling number of the single pilot tone in the complex signal; and determining a lead code corresponding to the actual oversampling number according to a coding protocol corresponding to the coding type, and taking the data from which the lead code in the complex signal is removed as data to be decoded.
Further, the decoding unit is further configured to determine sampling point values of the first waveform and the second waveform in the correlation period according to the coding type of the return signal and the actual oversampling number; extracting waveform data in the relevant period from the data to be decoded; respectively multiplying and accumulating the waveform data with the sampling point value of the first waveform and the sampling point value of the second waveform to respectively obtain a first correlation result corresponding to the first waveform and a second correlation result corresponding to the second waveform; taking the maximum value of the first type of correlation result and the second type of correlation result as a signal decision result; and determining the waveform corresponding to the signal judgment result as a decoding result corresponding to the data to be decoded in the relevant period.
Further, the decoding unit is further configured to perform a multiply-accumulate operation on the waveform data without delay, the waveform data delayed by one sampling point, and the waveform data delayed by two sampling points, and the sampling point values of the first waveform, so as to obtain a first early correlation result, a first current correlation result, and a first late correlation result corresponding to the first waveform, respectively; acquiring absolute values corresponding to a first type of leading correlation result, a first type of current correlation result and a first type of delaying correlation result corresponding to the first waveform, and taking the maximum absolute value as the first type of correlation result corresponding to the first waveform; respectively carrying out multiplication and accumulation operations on the waveform data without delay, the waveform data delayed by a sampling point and the waveform data delayed by two sampling points and the sampling point value of the second waveform to respectively obtain a second advanced correlation result, a second current correlation result and a second delayed correlation result corresponding to the second waveform; and acquiring absolute values corresponding to a second type of leading correlation result, a second type of current correlation result and a second type of delaying correlation result corresponding to the second type of waveform, and taking the maximum absolute value as the second type of correlation result corresponding to the second type of waveform.
Further, the apparatus further comprises: a starting point calibration unit, configured to compare an absolute value corresponding to a first type of advanced correlation result corresponding to the first waveform with an absolute value corresponding to a second type of advanced correlation result corresponding to the second waveform, and use a maximum absolute value as an advanced correlation result absolute value; comparing the absolute value corresponding to the first current correlation result corresponding to the first waveform with the absolute value corresponding to the second current correlation result corresponding to the second waveform, and taking the maximum absolute value as the absolute value of the current correlation result; comparing the absolute value corresponding to the first type of delayed correlation result corresponding to the first waveform with the absolute value corresponding to the second type of delayed correlation result corresponding to the second waveform, and taking the maximum absolute value as the absolute value of the delayed correlation result; determining a read address mark according to the maximum value of the absolute value of the advanced correlation result, the absolute value of the current correlation result and the absolute value of the delayed correlation result; obtaining the actual starting point A of the data to be decoded of the next relevant period according to any one of the following formulasn=Ao+2-flag, or An=Ao+3-2 flag, wherein AnFor the actual starting point, AoA flag is the read address mark at the end point of the current correlation period, the value of the flag is 0 when the absolute value of the advanced correlation result is maximum, the value of the flag is 1 when the absolute value of the current correlation result is maximum, and the value of the flag is 2 when the absolute value of the delayed correlation result is maximum; extracting the actual starting pointAnd carrying out decoding operation on the data to be decoded in the next relevant period.
Correspondingly, an embodiment of the present invention further provides an RFID reader, where the system includes: the decoding device for the RFID reader as described above.
Accordingly, the embodiment of the present invention also provides a machine-readable storage medium, which stores instructions for causing a machine to execute the decoding method for the RFID reader-writer described above.
According to the technical scheme, an in-phase signal and an orthogonal signal are obtained from a return signal returned by an electronic tag according to a preset sampling frequency, a complex signal corresponding to the return signal is obtained according to the data phase of the in-phase signal and the orthogonal signal, then the actual oversampling number of data to be decoded and single pilot tone in the complex signal is determined according to the return frequency, the preset sampling frequency, a frequency preset deviation range and the coding type of the return signal, and then the decoding result corresponding to the data to be decoded in a correlation period corresponding to the actual oversampling number is determined according to the coding type of the return signal and the actual oversampling number. The embodiment of the invention is suitable for decoding data of different coding types (FM 0/miller2/miller4/miller 8), enhances the universality of decoding, simultaneously captures the signal lead code by utilizing the time domain matching filtering technology to obtain the data to be decoded, and has strong weak signal detection capability. In addition, the in-phase signal and the orthogonal signal are used for phase calculation and rotation, signal energy is concentrated into one path, the signal-to-noise ratio can be improved, processing resources can be saved, and the problem of rapid strong signal conversion caused by relative movement of the RFID reader-writer and the electronic tag can be solved.
Additional features and advantages of embodiments of the invention will be set forth in the detailed description which follows.
Detailed Description
The following detailed description of embodiments of the invention refers to the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating embodiments of the invention, are given by way of illustration and explanation only, not limitation.
Fig. 1 is a schematic flowchart of a decoding method for an RFID reader according to an embodiment of the present invention. The embodiment of the invention is suitable for decoding FM0, miller2, miller4 and miller8 coding type data. As shown in fig. 1, the method comprises the steps of:
and step 110, receiving a return signal of the electronic tag.
In the embodiment of the invention, aiming at passive RFID, after the RFID reader transmits microwave signals to the electronic tag, the electronic tag obtains energy through the electromagnetic induction coil to supply power to the electronic tag for a short time, and returns a return signal to the RFID reader.
And 120, obtaining an in-phase signal and a quadrature signal from the return signal at a preset sampling frequency, wherein the preset sampling frequency is a preset multiple of the return frequency of the return signal.
After receiving the return signal of the electronic tag, respectively sampling by using an Analog to digital converter (ADC), and converting the in-phase signal and the quadrature signal in the return signal from an Analog domain to a digital domain. Then, the in-phase signal and the quadrature signal of the digital domain are filtered respectively at the preset sampling frequency. Since the return frequency of the return signal fluctuates up and down, in order to facilitate subsequent processing of the return signal and accurately extract the actual return frequency of the return signal, the preset sampling frequency is a preset multiple of the return frequency of the return signal, for example, the preset multiple is greater than or equal to 16. In addition, the filtering operation can also filter out low-frequency noise, partial direct current and high-frequency components.
And step 130, obtaining a complex signal corresponding to the return signal according to the data phase of the in-phase signal and the quadrature signal.
The phase calculation and rotation are carried out by utilizing the in-phase signals and the orthogonal signals, so that the signal energy is concentrated into one path, the signal-to-noise ratio can be improved, the processing resource can be saved, and the problem of rapid strong signal conversion caused by relative movement of the RFID reader-writer and the electronic tag can be solved.
In particular, according to F = (I + j × Q) × e(-j*Φ)And obtaining a complex signal F corresponding to the return signal, wherein I is the in-phase signal, Q is the quadrature signal, and phi is a channel phase calculation value, wherein phi is approximately equal to atan (Q/I).
After the phase calculation and the phase rotation, most signals are distributed in the real part of the complex signal, the imaginary part has only a small amount of signals, and the signals of the imaginary part can be ignored in the subsequent processing.
In addition, in order to improve the effectiveness of decoding, the complex signal may be subjected to an effectiveness judgment, thereby determining whether it is an effective signal. For example, the real part of the complex signal is compared to a preset signal threshold. The preset signal threshold may be 3 to 5 times of the set noise power value. And then, when the real part of the complex signal is lower than the preset signal threshold, determining that the return signal of the electronic tag is an invalid signal, and ending the decoding operation of the return signal. And when the real part of the complex signal is not lower than the preset signal threshold, determining that the return signal of the electronic tag is a valid signal, and continuing the following decoding operation of the return signal.
And 140, determining the actual oversampling number of the data to be decoded and the single pilot tone in the complex signal according to the return frequency, the preset sampling frequency, the preset frequency deviation range and the coding type of the return signal.
And determining that the data to be decoded in the complex signal is actually a preamble for capturing a real part in the complex signal, and removing the preamble to obtain the data to be decoded. When the preamble is acquired, the coefficients of the preamble matching filter need to be determined, i.e., the preamble acquisition coefficients need to be determined. Different coding types correspond to different preamble acquisition coefficients. If the encoding type is MILLER encoding, the preamble capture coefficient may be a coefficient formed by leading the preamble "010111" through MILLER encoding or a coefficient formed by leading the preamble part through MILLER encoding; if the encoding type is FM0 encoding, the preamble capture coefficient may be part of the FM0 preamble "1010 v 1" or "1010 v 1". And the lead code capturing adopts a time domain matched filter to process the received signal, and the output time of the correlation peak is the lead code appearance time of the received signal.
First, the preamble acquisition coefficients need to be determined. According to Hl=FS/[F0*(1+r)],Hh=FS/[F0*(1-r)]Obtaining the lower limit value H of the oversampling number of the single pilot tone in the complex signallAnd an upper limit value HhWherein F is0For said return frequency, FSFor the preset sampling frequency, ± r% is the preset deviation range of the frequency determined according to the encoding protocol. Obtaining the value range (H) of the oversampling number of the single pilot tone in the complex signal according to the lower limit value and the upper limit value of the oversampling numberl,Hh). When the oversampling number is calculated, a decimal value exists, and the oversampling number in the value range of the oversampling number is obtained after rounding. In order to cover the frequency deviation range of the return frequency, oversampling a plurality of preamble matching filters are required to be arranged in parallel for preamble acquisition, and the coefficient of each preamble matching filter is a preamble acquisition coefficient. And according to the value range of the oversampling number and the coding type of the return signal, the preamble capture coefficient corresponding to each oversampling number in the value range of the oversampling number can be determined. And then, matching the real part of the complex signal with a lead code matched filter corresponding to each oversampling number to obtain a matched output value corresponding to each oversampling number. And comparing a plurality of over-sampled matched output values, and taking the over-sampled number corresponding to the maximum value in the matched output values as the actual over-sampled number of the single pilot tone in the complex signal. The actual return frequency of the return signal can also be determined from the actual oversampling number, i.e., the ratio of the preset sampling frequency to the actual oversampling number is the actual return frequency. And then, according to the coding protocol corresponding to the coding type, determining the lead code corresponding to the actual oversampling number, and taking the data without the lead code in the complex signal as the data to be decoded.
Taking FM0 encoding type as an example to describe the execution process of step 104, assuming that the return frequency of the return signal is 320KHz and the preset sampling frequency is 6400K, and the frequency preset deviation range is ± 15% according to the encoding protocol, the value range of the oversampling number of the single pilot tone in the complex signal is (6400/(320: 1.15), 6400/(320: 0.85)), that is, the oversampling number includes 8 oversampling numbers in total, that is, the oversampling number includes 17, 18, 19, 20, 21, 22, 23, 24, and 8 preamble matching filters are also arranged in parallel for preamble acquisition.
Then, according to an encoding protocol of the FM0 encoding type, preamble acquisition coefficients corresponding to 8 oversampling numbers are obtained, that is, coefficients of 8 preamble matched filters:
1) the oversampling number of the single pilot tone is 17 for the coefficients of the corresponding preamble matched filter:
11111111111111111_00000000000000000_00000000111111111_00000000000000000_11111111100000000_11111111111111111
2) the oversampling number of the single pilot tone is 18 coefficients of the corresponding preamble matched filter:
111111111111111111_000000000000000000_000000000111111111_000000000000000000_111111111000000000_111111111111111111
3) the oversampling number of the single pilot tone is 19 coefficients of the corresponding preamble matched filter:
1111111111111111111_0000000000000000000_0000000001111111111_0000000000000000000_1111111111000000000_1111111111111111111
4) the oversampling number of the single pilot tone is 20 for the coefficients of the corresponding preamble matched filter:
11111111111111111111_00000000000000000000_00000000001111111111_00000000000000000000_11111111110000000000_11111111111111111111
5) the oversampling number of the single pilot tone is 21, and the coefficient of the corresponding preamble matched filter is:
111111111111111111111_000000000000000000000_000000000011111111111_000000000000000000000_111111111110000000000_111111111111111111111
6) the oversampling number of the single pilot tone is 22 coefficients of the corresponding preamble matched filter:
1111111111111111111111_0000000000000000000000_0000000000011111111111_0000000000000000000000_1111111111100000000000_1111111111111111111111
7) the oversampling number of the single pilot tone is 23 coefficients of the corresponding preamble matched filter:
11111111111111111111111_00000000000000000000000_00000000000011111111111_00000000000000000000000_11111111111100000000000_11111111111111111111111
8) the oversampling number of the single pilot tone is 24 coefficients of the corresponding preamble matched filter:
111111111111111111111111_000000000000000000000000_000000000000011111111111_000000000000000000000000_111111111111000000000000_111111111111111111111111
in addition, in a specific implementation, 0 in the preamble acquisition coefficient is represented by-1.
After the coefficients of the 8 preamble matched filters are determined, the real part of the complex signal can be matched with the 8 preamble matched filters. As shown in fig. 2, a schematic structural diagram of preamble capture and actual oversampling number determination is shown, where 8 preamble matched filters are set in parallel, each preamble matched filter is followed by a corresponding matched output detector, a matched output value corresponding to each oversampling number is obtained by the corresponding matched output detector, a maximum value in the matched output values is obtained by the maximum matched output detector, and the oversampling number corresponding to the maximum value is used as the actual oversampling number of a single pilot tone in the complex signal. Then, according to the coding protocol corresponding to the coding type, the preamble corresponding to the actual oversampling number may be determined, and the data from which the preamble in the complex signal is removed may be used as the data to be decoded.
Step 150, determining a decoding result corresponding to the data to be decoded in the correlation period corresponding to the actual oversampling number according to the encoding type of the return signal and the actual oversampling number.
After obtaining the actual oversampling number, sample values of the first waveform and the second waveform in the correlation period, that is, sample values of waveform 0 and waveform 1 in the correlation period, may be determined according to the coding type of the return signal and the actual oversampling number, where the correlation period is a time period of multiply-accumulate, that is, the time period of multiply-accumulate in fig. 3 and 4.
For the FM0 coding type, the number of sampling point values of one relevant period is the actual oversampling number; for the MILLER2 coding type, the number of sampling point values of one relevant period is 2 times of the actual oversampling number; for the MILLER4 coding type, the number of sampling point values of one relevant period is 4 times of the actual oversampling number; for the MILLER8 coding type, the number of sampling points in a relevant period is 8 times of the actual oversampling number.
In addition, to decode the data to be decoded, the sample values corresponding to the waveform 0 and the waveform 1 are firstly known.
The method for generating the waveform 0 and the waveform 1 will be described by taking FM0 encoding as an example. Let the actual oversampling number of a correlation period be N, if N is an even number, the waveform 1 in a correlation period: the N data sampling point values are all '1'; waveform 0 in one correlation period: the first half of the relevant period has N/2 '1's, and the second half of the relevant period has N/2 '-1's. If N is odd, waveform 1 in one correlation period: the N data sampling point values are all '1'; waveform 0 in one correlation period: the first half of the correlation period has (N-1)/2 "1", and the second half of the correlation period has (N + 1)/2 "-1".
The generation of waveform 0 and waveform 1 is illustrated by using miller2 code as an example. Let the actual number of oversamples for one correlation period be N,
1) if N is even and N/2 is even, waveform 1 in one correlation period: the first 1/4 portion of the correlation period has N/4 "1 s", the second 1/4 portion of the correlation period has N/4 "-1 s", the third 1/4 portion of the correlation period has N/4 "-1 s", and the fourth 1/4 portion of the correlation period has N/4 "1 s"; waveform 0 in one correlation period: the first 1/4 portion of the associated cycle has N/4 "1 s", the second 1/4 portion of the associated cycle has N/4 "-1 s", the third 1/4 portion of the associated cycle has N/4 "1 s", and the fourth 1/4 portion of the associated cycle has N/4 "-1 s".
2) If N is even and N/2 is odd, waveform 1 in one correlation period: the first 1/4 portion of the correlation period has (N-2)/4 "1", the second 1/4 portion of the correlation period has (N + 2)/4 "-1", the third 1/4 portion of the correlation period has (N-2)/4 "-1", the fourth 1/4 portion of the correlation period has (N + 2)/4 "1"; waveform 0 in one correlation period: there are (N-2)/4 "1" s in the first 1/4 portion of the associated cycle, (N + 2)/4 "-1" s in the second 1/4 portion of the associated cycle, (N-2)/4 "1" s in the third 1/4 portion of the associated cycle, and (N + 2)/4 "-1" s in the fourth 1/4 portion of the associated cycle.
3) If N is odd and (N-1)/2 is even, waveform 1 in one correlation period: the first 1/4 portion of the correlation period has (N-1)/4 "1", the second 1/4 portion of the correlation period has (N-1)/4 "-1", the third 1/4 portion of the correlation period has (N-1)/4 "-1", the fourth 1/4 portion of the correlation period has (N + 3)/4 "1"; waveform 0 in one correlation period: there are (N-1)/4 "1" s in the first 1/4 portion of the associated cycle, (N-1)/4 "-1" s in the second 1/4 portion of the associated cycle, (N-1)/4 "1" s in the third 1/4 portion of the associated cycle, and (N + 3)/4 "-1" s in the fourth 1/4 portion of the associated cycle.
4) If N is odd and (N-1)/2 is odd, waveform 1 in one correlation period: the first 1/4 portion of the correlation period has (N-3)/4 "1", the second 1/4 portion of the correlation period has (N + 1)/4 "-1", the third 1/4 portion of the correlation period has (N + 1)/4 "-1", the fourth 1/4 portion of the correlation period has (N + 1)/4 "1"; waveform 0 in one correlation period: there are (N-3)/4 "1" s in the first 1/4 portion of the associated cycle, (N + 1)/4 "-1" s in the second 1/4 portion of the associated cycle, (N + 1)/4 "1" s in the third 1/4 portion of the associated cycle, and (N + 1)/4 "-1" s in the fourth 1/4 portion of the associated cycle.
Similarly, the generation methods of waveform 0 and waveform 1 encoded by miller4 and miller8 can also be obtained under the condition that the actual oversampling number of a correlation period is determined, and will not be described herein again.
After the sampling point values of the first waveform and the second waveform corresponding to each coding type are obtained, correlation matching can be performed on the waveform data in the correlation period in the data to be decoded.
And respectively carrying out multiplication and accumulation operation on the waveform data and the sampling point values of the first waveform and the second waveform to respectively obtain a first correlation result corresponding to the first waveform and a second correlation result corresponding to the second waveform.
Specifically, the correlation processing structure for the first waveform and the correlation processing structure for the second waveform are shown in fig. 3 and 4.
As shown in fig. 3, the waveform data without delay, the waveform data delayed by one sampling point, and the waveform data delayed by two sampling points are multiplied and accumulated with the sampling point value of the first waveform, so as to obtain a first early correlation result, a first current correlation result, and a first late correlation result corresponding to the first waveform, respectively. Then, the absolute values corresponding to the first type of leading correlation result, the first type of current correlation result and the first type of delaying correlation result corresponding to the first type of waveform are obtained, and the maximum absolute value is taken as the first type of correlation result corresponding to the first type of waveform.
As shown in fig. 4, the waveform data without delay, the waveform data delayed by one sampling point, and the waveform data delayed by two sampling points are multiplied and accumulated with the sampling point value of the second waveform, so as to obtain a second advanced correlation result, a second current correlation result, and a second delayed correlation result corresponding to the second waveform, respectively. Then, the absolute values corresponding to the second type of leading correlation result, the second type of current correlation result and the second type of delaying correlation result corresponding to the second type of waveform are obtained, and the maximum absolute value is used as the second type of correlation result corresponding to the second type of waveform.
Since there are "1" and "-1" at the sample point in the waveform, there may be negative values after the multiplication and accumulation, and therefore the absolute value of the correlation result is taken so that the data in the subsequent comparison are all positive values.
And then, taking the maximum value of the first correlation result and the second correlation result as a signal judgment result, and determining a waveform corresponding to the signal judgment result as a decoding result corresponding to the data to be decoded in the correlation period. That is, the decision of data 0 or data 1 is made depending on the first correlation result (corresponding to waveform 0) and the second correlation result (corresponding to waveform 1). If the first correlation result is greater than the second correlation result, the decoding result corresponding to the data to be decoded in the correlation period is determined to be 0, otherwise, if the second correlation result is greater than the first correlation result, the decoding result corresponding to the data to be decoded in the correlation period is determined to be 1, that is, the decoding result of the data to be decoded in the first correlation period after the preamble is obtained. Then, the decoding process is continued again with the data to be decoded in the next correlation period through step 105.
However, due to the accumulated error and the data rate jitter, when the data to be decoded in the correlation period is decoded, the error starting point and the accumulated error may cause data decoding errors, and therefore, after the data to be decoded in each correlation period is decoded, it is necessary to perform error calibration on the actual starting point of the next correlation period.
The structure of implementing the error calibration at the actual starting point is shown in fig. 5, where the absolute value corresponding to the first type of the advanced correlation result corresponding to the first waveform (i.e., the absolute value corresponding to the first type of the advanced correlation result of waveform 0) is compared with the absolute value corresponding to the second type of the advanced correlation result corresponding to the second waveform (i.e., the absolute value corresponding to the second type of the advanced correlation result of waveform 1), and the maximum absolute value is used as the advanced correlation result absolute value, for example, if the absolute value corresponding to the first type of the advanced correlation result of waveform 0 is greater than the absolute value corresponding to the second type of the advanced correlation result of waveform 1, the advanced correlation result absolute value is the absolute value corresponding to the first type of the advanced correlation result of waveform 0, and vice versa.
Comparing the absolute value corresponding to the first current correlation result corresponding to the first waveform (i.e., the absolute value corresponding to the first current correlation result of waveform 0) with the absolute value corresponding to the second current correlation result corresponding to the second waveform (i.e., the absolute value corresponding to the second current correlation result of waveform 1), and taking the largest absolute value as the absolute value of the current correlation result.
Comparing the absolute value corresponding to the first type of delayed correlation result corresponding to the first waveform (i.e., the absolute value corresponding to the first type of delayed correlation result of waveform 0) with the absolute value corresponding to the second type of delayed correlation result corresponding to the second waveform (i.e., the absolute value corresponding to the second type of delayed correlation result of waveform 1), and taking the maximum absolute value as the absolute value of the delayed correlation result.
And then, determining a read address mark according to the maximum value of the advance correlation result absolute value, the current correlation result absolute value and the delay correlation result absolute value, wherein the read address mark takes a value of 0 when the advance correlation result absolute value is maximum, the read address mark takes a value of 1 when the current correlation result absolute value is maximum, and the read address mark takes a value of 2 when the delay correlation result absolute value is maximum. The read address flag shown serves as an input parameter for the generation of the actual starting point. Obtaining the actual starting point of the data to be decoded of the next relevant period according to any one of the following formulas:
An=Ao+2-flag, or An=Ao+3-2*flag,
Wherein A isnFor the actual starting point, AoAnd the flag is the reading address mark as the end point of the current relevant period.
Then, the data to be decoded in the next correlation period is extracted from the actual starting point, and the decoding operation is continued, that is, step 105 is executed to perform correlation matching on the sample value of the first waveform and the sample value of the second waveform corresponding to the data to be decoded in the next correlation period and the encoding type, respectively, so as to determine the decoding result of the data to be decoded in the next correlation period through the matching result.
By the embodiment of the invention, the decoding signal-to-noise ratio of the RFID reader-writer can be greatly improved. Particularly, when the RFID reader is in a scene with serious environmental interference, large multipath fading and the like, the RFID reader has extremely high-sensitivity signal detection capability and excellent decoding capability. In the embodiment of the invention, the sampling deviation can be dynamically adjusted in the decoding stage, so that the decoding error caused by the jitter of the frequency of the return signal of the electronic tag is avoided, and the sampling deviation is dynamically adjusted by changing the read address of the waveform correlation processing structure at the end of one correlation period, so as to determine the actual starting point of the next correlation period. In addition, decoding of data of different encoding types (FM 0/miller2/miller4/miller 8) can be realized by the embodiment of the invention, which is convenient for saving processing resources. And estimating the oversampling number by using a time domain matched filtering technology to provide parameters for the related demodulation. In addition, a signal lead code is captured by using a time domain matched filtering technology to obtain data to be decoded, and the method has strong weak signal detection capability. In the decoding process, the embodiment of the invention utilizes the in-phase signal and the orthogonal signal to perform phase calculation and rotation to generate a complex signal, thereby improving the signal-to-noise ratio, saving processing resources and overcoming the problem of fast strong signal conversion caused by relative movement of the RFID reader and the electronic tag.
Correspondingly, fig. 6 is a schematic structural diagram of a decoding device for an RFID reader according to an embodiment of the present invention. As shown in fig. 6, the apparatus 60 includes: a receiving unit 61 for receiving a return signal of the electronic tag; a signal sampling unit 62, configured to obtain an in-phase signal and a quadrature signal from the return signal at a preset sampling frequency, where the preset sampling frequency is a preset multiple of a return frequency of the return signal; a phase calculation unit 63, configured to obtain a complex signal corresponding to the return signal according to the data phase of the in-phase signal and the quadrature signal; a to-be-decoded data determining unit 64, configured to determine, according to the return frequency, the preset sampling frequency, a frequency preset deviation range, and the coding type of the return signal, an actual oversampling number of the to-be-decoded data and the single pilot tone in the complex signal; and a decoding unit 65, configured to determine, according to the encoding type of the return signal and the actual oversampling number, a decoding result corresponding to the data to be decoded in a correlation period corresponding to the actual oversampling number.
Further, the signal sampling unit is further configured to convert an in-phase signal and a quadrature signal in the return signal from an analog domain to a digital domain by sampling through an analog-to-digital converter (ADC); and respectively filtering the in-phase signal and the quadrature signal of the digital domain at the preset sampling frequency.
Further, the phasesThe bit calculation unit is further configured to calculate the bit value based on F = (I + j Q) × e(-j*Φ)And obtaining a complex signal F corresponding to the return signal, wherein I is the in-phase signal, Q is the quadrature signal, and phi is a channel phase calculation value, wherein phi is approximately equal to atan (Q/I).
Further, as shown in fig. 7, the apparatus further includes: a threshold comparing unit 66, configured to compare the real part of the complex signal with a preset signal threshold; when the real part of the complex signal is lower than the preset signal threshold, determining that the return signal of the electronic tag is an invalid signal, and ending the decoding operation of the return signal; and when the real part of the complex signal is not lower than the preset signal threshold, determining that the return signal of the electronic tag is an effective signal, and continuing the decoding operation of the return signal.
Further, the unit for determining data to be decoded is also configured to determine the data to be decoded according to Hl=FS/[F0*(1+r)],Hh=FS/[F0*(1-r)]Obtaining the lower limit value H of the oversampling number of the single pilot tone in the complex signallAnd an upper limit value HhWherein F is0For said return frequency, FSSetting the preset sampling frequency as the preset deviation range of the frequency +/-r%; obtaining the value range of the oversampling number of the single pilot tone in the complex signal according to the lower limit value and the upper limit value of the oversampling number; determining a lead code capture coefficient corresponding to each oversampling number in the oversampling number value range according to the oversampling number value range and the coding type of the return signal; taking the lead code capture coefficient corresponding to each oversampling number as the coefficient of the lead code matched filter corresponding to each oversampling number; matching the real part of the complex signal with a lead code matched filter corresponding to each oversampling number to obtain a matched output value corresponding to each oversampling number; taking the oversampling number corresponding to the maximum value in the matching output values as the actual oversampling number of the single pilot tone in the complex signal; and determining a lead code corresponding to the actual oversampling number according to a coding protocol corresponding to the coding type, and taking the data from which the lead code in the complex signal is removed as data to be decoded.
Further, the decoding unit is further configured to determine sampling point values of the first waveform and the second waveform in the correlation period according to the coding type of the return signal and the actual oversampling number; extracting waveform data in the relevant period from the data to be decoded; respectively multiplying and accumulating the waveform data with the sampling point value of the first waveform and the sampling point value of the second waveform to respectively obtain a first correlation result corresponding to the first waveform and a second correlation result corresponding to the second waveform; taking the maximum value of the first type of correlation result and the second type of correlation result as a signal decision result; and determining the waveform corresponding to the signal judgment result as a decoding result corresponding to the data to be decoded in the relevant period.
Further, the decoding unit is further configured to perform a multiply-accumulate operation on the waveform data without delay, the waveform data delayed by one sampling point, and the waveform data delayed by two sampling points, and the sampling point values of the first waveform, so as to obtain a first early correlation result, a first current correlation result, and a first late correlation result corresponding to the first waveform, respectively; acquiring absolute values corresponding to a first type of leading correlation result, a first type of current correlation result and a first type of delaying correlation result corresponding to the first waveform, and taking the maximum absolute value as the first type of correlation result corresponding to the first waveform; respectively carrying out multiplication and accumulation operations on the waveform data without delay, the waveform data delayed by a sampling point and the waveform data delayed by two sampling points and the sampling point value of the second waveform to respectively obtain a second advanced correlation result, a second current correlation result and a second delayed correlation result corresponding to the second waveform; and acquiring absolute values corresponding to a second type of leading correlation result, a second type of current correlation result and a second type of delaying correlation result corresponding to the second type of waveform, and taking the maximum absolute value as the second type of correlation result corresponding to the second type of waveform.
Further, as shown in fig. 8, the apparatus further includes: initial point calibration sheetElement 67, configured to compare an absolute value corresponding to a first type of advanced correlation result corresponding to the first waveform with an absolute value corresponding to a second type of advanced correlation result corresponding to the second waveform, and use a maximum absolute value as an advanced correlation result absolute value; comparing the absolute value corresponding to the first current correlation result corresponding to the first waveform with the absolute value corresponding to the second current correlation result corresponding to the second waveform, and taking the maximum absolute value as the absolute value of the current correlation result; comparing the absolute value corresponding to the first type of delayed correlation result corresponding to the first waveform with the absolute value corresponding to the second type of delayed correlation result corresponding to the second waveform, and taking the maximum absolute value as the absolute value of the delayed correlation result; determining the absolute value of the advanced correlation result, the absolute value of the current correlation result and the absolute value of the delayed correlation result as a read address mark; obtaining the actual starting point of the data to be decoded of the next relevant period according to any one of the following formulas: a. then=Ao+2-flag, or An=Ao+3-2 flag, wherein AnFor the actual starting point, AoA flag is the read address mark at the end point of the current correlation period, the value of the flag is 0 when the absolute value of the advanced correlation result is maximum, the value of the flag is 1 when the absolute value of the current correlation result is maximum, and the value of the flag is 2 when the absolute value of the delayed correlation result is maximum; and extracting the data to be decoded of the next relevant period from the actual starting point for decoding operation.
The specific implementation process of the decoding device for the RFID reader-writer refers to the processing process of the decoding method for the RFID reader-writer.
Correspondingly, an embodiment of the present invention further provides an RFID reader, where the system includes: the decoding device for the RFID reader as described above.
Accordingly, the embodiment of the present invention also provides a machine-readable storage medium, which stores instructions for causing a machine to execute the decoding method for the RFID reader-writer described above.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a device includes one or more processors (CPUs), memory, and a bus. The device may also include input/output interfaces, network interfaces, and the like.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip. The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.