[go: up one dir, main page]

CN111819787A - Crystal calibration method, chip and bluetooth headset - Google Patents

Crystal calibration method, chip and bluetooth headset Download PDF

Info

Publication number
CN111819787A
CN111819787A CN202080001624.9A CN202080001624A CN111819787A CN 111819787 A CN111819787 A CN 111819787A CN 202080001624 A CN202080001624 A CN 202080001624A CN 111819787 A CN111819787 A CN 111819787A
Authority
CN
China
Prior art keywords
pulse signal
parameter
count difference
count
chip
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202080001624.9A
Other languages
Chinese (zh)
Other versions
CN111819787B (en
Inventor
林飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Goodix Technology Co Ltd
Original Assignee
Shenzhen Goodix Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Goodix Technology Co Ltd filed Critical Shenzhen Goodix Technology Co Ltd
Publication of CN111819787A publication Critical patent/CN111819787A/en
Application granted granted Critical
Publication of CN111819787B publication Critical patent/CN111819787B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03BGENERATION OF OSCILLATIONS, DIRECTLY OR BY FREQUENCY-CHANGING, BY CIRCUITS EMPLOYING ACTIVE ELEMENTS WHICH OPERATE IN A NON-SWITCHING MANNER; GENERATION OF NOISE BY SUCH CIRCUITS
    • H03B5/00Generation of oscillations using amplifier with regenerative feedback from output to input
    • H03B5/02Details
    • H03B5/04Modifications of generator to compensate for variations in physical values, e.g. power supply, load, temperature
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04RLOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
    • H04R1/00Details of transducers, loudspeakers or microphones
    • H04R1/10Earpieces; Attachments therefor ; Earphones; Monophonic headphones

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Acoustics & Sound (AREA)
  • Signal Processing (AREA)
  • Measuring Frequencies, Analyzing Spectra (AREA)
  • Tests Of Electronic Circuits (AREA)

Abstract

A method, a chip and a Bluetooth headset for crystal calibration are provided. The method comprises the following steps: obtaining a count difference of at least one pulse signal, the at least one pulse signal including a pulse signal generated by the crystal based on at least one parameter of a plurality of parameters, the count difference of each pulse signal of the at least one pulse signal being a difference between system tick count values based on the corresponding pulse signal obtained using two external interrupts triggered by a reference pulse signal; determining a target parameter based on the count difference of the at least one pulse signal; and determining the pulse signal generated based on the target parameter as the pulse signal after crystal calibration. The target parameter is determined through the counting difference value of the at least one pulse signal, so that the automatic calibration of the pulse signals can be realized, the labor cost is reduced, and the calibration efficiency is improved while the complexity of a calibration mechanism is reduced.

Description

晶体校准的方法、芯片和蓝牙耳机Crystal calibration method, chip and bluetooth headset

技术领域technical field

本申请实施例涉及电子领域,并且更具体地,涉及晶体校准的方法、芯片和蓝牙耳机。The embodiments of the present application relate to the field of electronics, and more particularly, to a crystal calibration method, a chip, and a Bluetooth headset.

背景技术Background technique

单片机在运行的时候,需要一个脉冲信号,作为自己执行指令的触发信号。通常情况下,采用与单片机的应用电路外接的晶体以及与所述晶体连接的外部电容配合产生所述脉冲信号。所述晶体具有标称的负载电容值,当所述负载电容值与所述外部电容的真实电容值接近或者相等时,所述晶体产生的脉冲信号的频率是最准的。When the single-chip microcomputer is running, it needs a pulse signal as the trigger signal to execute the instruction by itself. Usually, the pulse signal is generated by using a crystal connected to the application circuit of the single-chip microcomputer and an external capacitor connected to the crystal. The crystal has a nominal load capacitance value. When the load capacitance value is close to or equal to the real capacitance value of the external capacitor, the frequency of the pulse signal generated by the crystal is the most accurate.

但是,同一批次的物料参数不会完全一致,物料参数的波动会导致同一个厂商生产的同一批晶体的负载电容、同一个厂商生产的同一批外部电容的容值等产品参数都会在一定范围内变化,进而导致晶体产生的脉冲信号的频率不够精准。However, the material parameters of the same batch will not be exactly the same. The fluctuation of material parameters will cause the load capacitance of the same batch of crystals produced by the same manufacturer, the capacitance of the same batch of external capacitors produced by the same manufacturer, and other product parameters will be within a certain range. The frequency of the pulse signal generated by the crystal is not accurate enough.

发明内容SUMMARY OF THE INVENTION

提供了一种晶体校准的方法、芯片和蓝牙耳机,能够实现晶体自动校准。Provided are a crystal calibration method, a chip and a Bluetooth headset, which can realize automatic crystal calibration.

第一方面,提供了一种晶体校准的方法,适用于具有晶体的芯片,所述方法包括:In a first aspect, a method for crystal calibration is provided, applicable to a chip having a crystal, the method comprising:

获取至少一个脉冲信号的计数差值,所述至少一个脉冲信号包括所述晶体基于多个参数中的至少一个参数生成的脉冲信号,所述至少一个脉冲信号中每一个脉冲信号的计数差值为利用由参考脉冲信号触发的两次外部中断获取的基于相应脉冲信号的系统滴答计数值之间的差值;Obtaining a count difference value of at least one pulse signal, the at least one pulse signal including a pulse signal generated by the crystal based on at least one parameter in a plurality of parameters, and the count difference value of each pulse signal in the at least one pulse signal is Use the difference between the system tick count values based on the corresponding pulse signal obtained by two external interrupts triggered by the reference pulse signal;

基于所述至少一个脉冲信号的计数差值确定目标参数;determining a target parameter based on the count difference of the at least one pulse signal;

将基于所述目标参数生成的脉冲信号确定为晶体校准后的脉冲信号。The pulse signal generated based on the target parameter is determined as the pulse signal after crystal calibration.

通过所述至少一个脉冲信号的计数差值确定所述目标参数,不仅能够实现脉冲信号的自动校准降低了人力成本,还能够在降低校准机制的复杂度的同时提高校准效率。Determining the target parameter by the count difference of the at least one pulse signal can not only realize automatic calibration of the pulse signal and reduce labor costs, but also improve the calibration efficiency while reducing the complexity of the calibration mechanism.

在一些可能实现的方式中,所述获取至少一个脉冲信号的计数差值,包括:In some possible implementation manners, the acquiring the count difference value of the at least one pulse signal includes:

利用二分法获取所述至少一个脉冲信号的计数差值。The count difference value of the at least one pulse signal is obtained by using a dichotomy method.

通过二分化获取至少一个脉冲信号的计数差值,避免了获取所有的脉冲信号的计数差值,降低了需要获取的计数差值的总量,能够在保证校准准确度的同时,提高校准效率并减少时间成本。Obtaining the count difference of at least one pulse signal through binary differentiation avoids acquiring the count difference of all pulse signals, reducing the total amount of count difference that needs to be obtained, which can improve the calibration efficiency while ensuring the calibration accuracy. Reduce time cost.

在一些可能实现的方式中,所述利用二分法获取所述至少一个脉冲信号的计数差值,包括:In some possible implementation manners, the obtaining the count difference value of the at least one pulse signal by using a dichotomy method includes:

确定多个参数中的最小参数和最大参数;Determine the minimum and maximum parameters among multiple parameters;

基于最小参数和最大参数分别生成第一脉冲信号和第二脉冲信号;generating a first pulse signal and a second pulse signal based on the minimum parameter and the maximum parameter, respectively;

分别获取所述第一脉冲信号的第一计数差值和第二脉冲信号的第二计数差值;respectively acquiring the first count difference of the first pulse signal and the second count difference of the second pulse signal;

其中,基于所述至少一个脉冲信号的计数差值确定目标参数,包括:Wherein, determining the target parameter based on the count difference of the at least one pulse signal includes:

基于所述第一计数差值和所述第二计数差值确定所述目标参数。The target parameter is determined based on the first count difference and the second count difference.

在一些可能实现的方式中,所述基于所述第一计数差值和所述第二计数差值确定所述目标参数,包括:In some possible implementation manners, the determining the target parameter based on the first count difference value and the second count difference value includes:

在所述第一计数差值和所述第二计数差值的平均值等于预设计数差值的情况下,将所述最小参数和所述最大参数的平均值确定为所述目标参数。In the case that the average value of the first count difference value and the second count difference value is equal to the preset count difference value, the average value of the minimum parameter and the maximum parameter is determined as the target parameter.

在一些可能实现的方式中,所述基于所述第一计数差值和所述第二计数差值确定所述目标参数,包括:In some possible implementation manners, the determining the target parameter based on the first count difference value and the second count difference value includes:

在所述第一计数差值和所述第二计数差值的平均值大于所述预设计数差值的情况下,将所述最小参数和所述最大参数的平均值加1确定为第一参数;When the average value of the first count difference value and the second count difference value is greater than the preset count difference value, adding 1 to the average value of the minimum parameter and the maximum parameter is determined as the first count parameter;

基于所述第一参数生成第三脉冲信号;generating a third pulse signal based on the first parameter;

获取所述第三脉冲信号的第三计数差值;acquiring a third count difference of the third pulse signal;

基于所述第三计数差值和所述第二计数差值确定所述目标参数。The target parameter is determined based on the third difference count value and the second difference count value.

在一些可能实现的方式中,所述基于所述第一计数差值和所述第二计数差值确定所述目标参数,包括:In some possible implementation manners, the determining the target parameter based on the first count difference value and the second count difference value includes:

在所述第一计数差值和所述第二计数差值的平均值小于所述预设计数差值的情况下,将所述最小参数和所述最大参数的平均值减一确定为第二参数;In the case where the average value of the first count difference value and the second count difference value is smaller than the preset count difference value, subtract one from the average value of the minimum parameter and the maximum parameter to determine the second count. parameter;

基于所述第二参数生成第四脉冲信号;generating a fourth pulse signal based on the second parameter;

获取所述第四脉冲信号的第四计数差值;obtaining the fourth count difference of the fourth pulse signal;

基于所述第四计数差值和所述第一计数差值确定所述目标参数。The target parameter is determined based on the fourth count difference and the first count difference.

在一些可能实现的方式中,所述获取至少一个脉冲信号的计数差值,包括:In some possible implementation manners, the acquiring the count difference value of the at least one pulse signal includes:

获取所述晶体基于所述多个参数分别生成的多个脉冲信号;acquiring a plurality of pulse signals respectively generated by the crystal based on the plurality of parameters;

获取所述多个脉冲信号对应的多个计数差值;acquiring multiple count differences corresponding to the multiple pulse signals;

其中,所述基于所述至少一个脉冲信号的计数差值确定目标参数,包括:Wherein, determining the target parameter based on the count difference of the at least one pulse signal includes:

利用二分法,获取所述多个计数差值中的与预设计数差值最接近的目标计数差值;Using the dichotomy method, obtain the target count difference value that is closest to the preset count difference value among the plurality of count difference values;

将所述目标计数差值对应的参数确定为所述目标参数。A parameter corresponding to the target count difference value is determined as the target parameter.

通过二分法获取目标计数差值,避免了遍历式的比较所述预设计数差值与每一个脉冲信号的计数差值,降低了芯片的计算量,提升了校准效率并减小了时间成本。Obtaining the target count difference by the dichotomy method avoids ergodic comparison of the preset count difference and the count difference of each pulse signal, reduces the calculation amount of the chip, improves the calibration efficiency and reduces the time cost.

在一些可能实现的方式中,所述方法还包括:In some possible implementations, the method further includes:

按照升序或降序对所述多个计数差值进行排序。The plurality of count differences are sorted in ascending or descending order.

在一些可能实现的方式中,所述多个参数的参数数值随着脉冲信号的频率的增大而减小。In some possible implementations, the parameter values of the plurality of parameters decrease as the frequency of the pulse signal increases.

通过定义所述多个参数的特性,能够使得获取的差值计数按照由大到小或由小到大的顺序自动排序,避免了获取所述多个计数差值后重新对所述多个计数差值重新排序的步骤,在通过二分法获取目标参数或目标计数差值的基础上,有效降低了校准脉冲信号的时间成本。By defining the characteristics of the multiple parameters, the acquired difference counts can be automatically sorted in the order from large to small or from small to large, which avoids re-counting the multiple counts after acquiring the multiple count differences. The step of reordering the difference values effectively reduces the time cost of calibrating the pulse signal on the basis of obtaining the target parameter or target count difference value through the dichotomy method.

在一些可能实现的方式中,所述多个参数的参数数值与脉冲信号的频率成反比。In some possible implementations, the parameter values of the plurality of parameters are inversely proportional to the frequency of the pulse signal.

在一些可能实现的方式中,所述获取至少一个脉冲信号的计数差值,包括:In some possible implementation manners, the acquiring the count difference value of the at least one pulse signal includes:

按照参数值升序或降序的顺序,依次获取至少一个脉冲信号的计数差值。According to the ascending or descending order of parameter values, the count difference value of at least one pulse signal is obtained in sequence.

在一些可能实现的方式中,所述方法还包括:In some possible implementations, the method further includes:

利用通用串行总线USB转串口和通用异步收发传输器UART集线器HUB接收测试设备发送的校准信令,所述校准信令用于触发所述芯片进行晶体校准。The calibration signaling sent by the test equipment is received by using the universal serial bus USB to serial port and the universal asynchronous transceiver UART hub HUB, and the calibration signaling is used to trigger the chip to perform crystal calibration.

在一些可能实现的方式中,所述校准信令包括所述多个参数。In some possible implementations, the calibration signaling includes the plurality of parameters.

在一些可能实现的方式中,所述方法还包括:In some possible implementations, the method further includes:

将所述多个参数存储至寄存器,以便通过控制所述寄存器向所述晶体发送所述多个参数。The plurality of parameters are stored in a register to transmit the plurality of parameters to the crystal by controlling the register.

通过寄存器触发晶体生成待校准的脉冲信号,即寄存器负责并控制晶体生成待校准信号的操作,降低了芯片的工作负荷,有效提高了芯片进行脉冲信号校准的工作效率。The crystal is triggered by the register to generate the pulse signal to be calibrated, that is, the register is responsible for and controls the operation of the crystal to generate the signal to be calibrated, which reduces the workload of the chip and effectively improves the work efficiency of the chip for pulse signal calibration.

在一些可能实现的方式中,所述方法还包括:In some possible implementations, the method further includes:

将校准结果存储至所述寄存器,所述校准结果用于指示所述目标参数。A calibration result is stored in the register, and the calibration result is used to indicate the target parameter.

在一些可能实现的方式中,所述方法还包括:In some possible implementations, the method further includes:

利用通用串行总线USB转串口和通用异步收发传输器UART集线器HUB向测试设备发送校准结果和/或所述至少一个脉冲信号的计数差值,所述校准结果用于指示所述目标参数,所述至少一个脉冲信号的计数差值用于所述测试设备在显示界面与预设计数差值进行比较。The calibration result and/or the count difference of the at least one pulse signal are sent to the test equipment by using the universal serial bus USB to serial port and the universal asynchronous transceiver UART hub HUB, the calibration result is used to indicate the target parameter, so The count difference value of the at least one pulse signal is used for the test device to compare with a preset count difference value on the display interface.

通过向测试设备发送所述至少一个脉冲信号的计数差值,使得用户能够在所述测试设备的显示界面上能够观察到所述至少一个脉冲信号的计数差值中的每一个计数差值和所述预设计数差值之间的对应关系,便于用户进行人工的调整目标计数差值,以实现自动校准配合人工校准的校准机制。类似地,通过向测试设备发送所述校准结果,有便于设计人员进行批量校准以及调整参数设计。By sending the count difference of the at least one pulse signal to the testing device, the user can observe each count difference and all the count differences of the at least one pulse signal on the display interface of the testing device. The corresponding relationship between the preset count difference values is convenient for the user to manually adjust the target count difference value, so as to realize the calibration mechanism of automatic calibration and manual calibration. Similarly, by sending the calibration results to the test equipment, it is convenient for designers to perform batch calibrations and adjust parameter designs.

在一些可能实现的方式中,所述获取至少一个脉冲信号的计数差值,包括:In some possible implementation manners, the acquiring the count difference value of the at least one pulse signal includes:

获取所述至少一个脉冲信号中每一个脉冲信号的多次计数差值;Acquiring multiple count differences of each pulse signal in the at least one pulse signal;

将所述至少一个脉冲信号中每一个脉冲信号的多次计数差值中的在时间上靠后的至少一次计数差值,确定为所述相应脉冲信号的计数差值。At least one count difference that is later in time among the multiple count differences of each pulse signal in the at least one pulse signal is determined as the count difference of the corresponding pulse signal.

由此,能够准确获取每一个脉冲信号对应的计数差值,相应的,能够提高脉冲信号的校准精度。换言之,通过对所述至少一个脉冲信号中每一个脉冲信号进行测试后,再获取每一个脉冲信号对应的计数差值,能够避免在系统不稳定或晶体不稳定的情况下测量的脉冲信号的计数差值不准确,能够提高计数差值的准确度和脉冲信号的校准精度。In this way, the count difference value corresponding to each pulse signal can be accurately obtained, and accordingly, the calibration accuracy of the pulse signal can be improved. In other words, by testing each pulse signal in the at least one pulse signal, and then obtaining the count difference value corresponding to each pulse signal, it is possible to avoid the counting of pulse signals measured when the system is unstable or the crystal is unstable. The difference value is inaccurate, which can improve the accuracy of the count difference value and the calibration accuracy of the pulse signal.

在一些可能实现的方式中,所述方法还包括:In some possible implementations, the method further includes:

接收利用已校准应用系统生成的所述参考脉冲信号。The reference pulse signal generated using the calibrated application system is received.

通过应用系统触发已校准芯片产生所述参考脉冲信号,能够在获取所述参考脉冲信号的基础上,简化所述芯片的结构并降低硬件成本。Triggering the calibrated chip by the application system to generate the reference pulse signal can simplify the structure of the chip and reduce the hardware cost on the basis of acquiring the reference pulse signal.

在一些可能实现的方式中,所述参考脉冲信号为脉冲宽度调制PWM信号。In some possible implementations, the reference pulse signal is a pulse width modulated PWM signal.

在一些可能实现的方式中,所述芯片为蓝牙低功耗BLE芯片。In some possible implementation manners, the chip is a Bluetooth low energy BLE chip.

第二方面,提供了一种芯片,所述芯片包括:In a second aspect, a chip is provided, and the chip includes:

晶体,用于基于多个参数中的至少一个参数生成的至少一个脉冲信号;a crystal for generating at least one pulsed signal based on at least one of the plurality of parameters;

处理单元,所述处理单元连接至所述晶体,所述处理单元用于:a processing unit connected to the crystal for:

获取所述至少一个脉冲信号的计数差值,所述至少一个脉冲信号中每一个脉冲信号的计数差值为利用由参考脉冲信号触发的两次外部中断获取的基于相应脉冲信号的系统滴答计数值之间的差值;Obtain the count difference value of the at least one pulse signal, and the count difference value of each pulse signal in the at least one pulse signal is the system tick count value based on the corresponding pulse signal obtained by using two external interrupts triggered by the reference pulse signal difference between;

基于所述至少一个脉冲信号的计数差值确定目标参数;determining a target parameter based on the count difference of the at least one pulse signal;

将基于所述目标参数生成的脉冲信号确定为晶体校准后的脉冲信号。The pulse signal generated based on the target parameter is determined as the pulse signal after crystal calibration.

在一些可能实现的方式中,所述处理单元具体用于:In some possible implementations, the processing unit is specifically used for:

利用二分法获取所述至少一个脉冲信号的计数差值。The count difference value of the at least one pulse signal is obtained by using a dichotomy method.

在一些可能实现的方式中,所述处理单元更具体用于:In some possible implementations, the processing unit is more specifically used to:

确定多个参数中的最小参数和最大参数;Determine the minimum and maximum parameters among multiple parameters;

基于最小参数和最大参数分别生成第一脉冲信号和第二脉冲信号;generating a first pulse signal and a second pulse signal based on the minimum parameter and the maximum parameter, respectively;

分别获取所述第一脉冲信号的第一计数差值和第二脉冲信号的第二计数差值;respectively acquiring the first count difference of the first pulse signal and the second count difference of the second pulse signal;

基于所述第一计数差值和所述第二计数差值确定所述目标参数。The target parameter is determined based on the first count difference and the second count difference.

在一些可能实现的方式中,所述处理单元更具体用于:In some possible implementations, the processing unit is more specifically used to:

在所述第一计数差值和所述第二计数差值的平均值等于预设计数差值的情况下,将所述最小参数和所述最大参数的平均值确定为所述目标参数。In the case that the average value of the first count difference value and the second count difference value is equal to the preset count difference value, the average value of the minimum parameter and the maximum parameter is determined as the target parameter.

在一些可能实现的方式中,所述处理单元更具体用于:In some possible implementations, the processing unit is more specifically used to:

在所述第一计数差值和所述第二计数差值的平均值大于所述预设计数差值的情况下,将所述最小参数和所述最大参数的平均值加1确定为第一参数;When the average value of the first count difference value and the second count difference value is greater than the preset count difference value, adding 1 to the average value of the minimum parameter and the maximum parameter is determined as the first count parameter;

基于所述第一参数生成第三脉冲信号;generating a third pulse signal based on the first parameter;

获取所述第三脉冲信号的第三计数差值;acquiring a third count difference of the third pulse signal;

基于所述第三计数差值和所述第二计数差值确定所述目标参数。The target parameter is determined based on the third difference count value and the second difference count value.

在一些可能实现的方式中,所述处理单元更具体用于:In some possible implementations, the processing unit is more specifically used to:

在所述第一计数差值和所述第二计数差值的平均值小于所述预设计数差值的情况下,将所述最小参数和所述最大参数的平均值减一确定为第二参数;In the case where the average value of the first count difference value and the second count difference value is smaller than the preset count difference value, subtract one from the average value of the minimum parameter and the maximum parameter to determine the second count. parameter;

基于所述第二参数生成第四脉冲信号;generating a fourth pulse signal based on the second parameter;

获取所述第四脉冲信号的第四计数差值;obtaining the fourth count difference of the fourth pulse signal;

基于所述第四计数差值和所述第一计数差值确定所述目标参数。The target parameter is determined based on the fourth count difference and the first count difference.

在一些可能实现的方式中,所述处理单元具体用于:In some possible implementations, the processing unit is specifically used for:

获取所述晶体基于所述多个参数分别生成的多个脉冲信号;acquiring a plurality of pulse signals respectively generated by the crystal based on the plurality of parameters;

获取所述多个脉冲信号对应的多个计数差值;acquiring multiple count differences corresponding to the multiple pulse signals;

利用二分法,获取所述多个计数差值中的与预设计数差值最接近的目标计数差值;Using the dichotomy method, obtain the target count difference value that is closest to the preset count difference value among the plurality of count difference values;

将所述目标计数差值对应的参数确定为所述目标参数。A parameter corresponding to the target count difference value is determined as the target parameter.

在一些可能实现的方式中,所述处理单元还用于:In some possible implementations, the processing unit is also used for:

按照升序或降序对所述多个计数差值进行排序。The plurality of count differences are sorted in ascending or descending order.

在一些可能实现的方式中,所述多个参数的参数数值随着脉冲信号的频率的增大而减小。In some possible implementations, the parameter values of the plurality of parameters decrease as the frequency of the pulse signal increases.

在一些可能实现的方式中,所述多个参数的参数数值与脉冲信号的频率成反比。In some possible implementations, the parameter values of the plurality of parameters are inversely proportional to the frequency of the pulse signal.

在一些可能实现的方式中,所述处理单元具体用于:In some possible implementations, the processing unit is specifically used for:

按照参数值升序或降序的顺序,依次获取至少一个脉冲信号的计数差值。According to the ascending or descending order of parameter values, the count difference value of at least one pulse signal is obtained in sequence.

在一些可能实现的方式中,所述芯片还包括:In some possible implementations, the chip further includes:

通用串行总线USB转串口和通用异步收发传输器UART集线器HUB,所述USB转串口通过所述UART HUB连接至所述处理单元,所述处理单元通过所述USB转串口和所述UARTHUB接收测试设备发送的校准信令,所述校准信令用于触发所述芯片进行晶体校准。Universal serial bus USB-to-serial and universal asynchronous transceiver UART hub HUB, the USB-to-serial is connected to the processing unit through the UART HUB, and the processing unit receives the test through the USB-to-serial and the UARTHUB Calibration signaling sent by the device, where the calibration signaling is used to trigger the chip to perform crystal calibration.

在一些可能实现的方式中,所述校准信令包括所述多个参数。In some possible implementations, the calibration signaling includes the plurality of parameters.

在一些可能实现的方式中,所述芯片还包括:In some possible implementations, the chip further includes:

寄存器,所述处理单元通过所述寄存器连接至所述晶体,所述处理单元用于将所述多个参数存储至寄存器,以便通过控制所述寄存器向所述晶体发送所述多个参数。a register, the processing unit is connected to the crystal through the register, and the processing unit is configured to store the plurality of parameters to the register so as to send the plurality of parameters to the crystal by controlling the register.

在一些可能实现的方式中,所述处理单元还用于将校准结果存储至所述寄存器,所述校准结果用于指示所述目标参数。In some possible implementations, the processing unit is further configured to store a calibration result in the register, where the calibration result is used to indicate the target parameter.

在一些可能实现的方式中,所述芯片还包括:In some possible implementations, the chip further includes:

通用串行总线USB转串口和通用异步收发传输器UART集线器HUB,所述USB转串口通过所述UART HUB连接至所述处理单元,所述处理单元通过所述USB转串口和所述UARTHUB向测试设备发送校准结果和/或所述至少一个脉冲信号的计数差值,所述校准结果用于指示所述目标参数,所述至少一个脉冲信号的计数差值用于所述测试设备在显示界面与预设计数差值进行比较。Universal serial bus USB to serial port and universal asynchronous transceiver UART hub HUB, the USB to serial port is connected to the processing unit through the UART HUB, and the processing unit passes the USB to serial port and the UARTHUB to test The device sends a calibration result and/or a count difference value of the at least one pulse signal, the calibration result is used to indicate the target parameter, and the count difference value of the at least one pulse signal is used by the test device to communicate with the test device on the display interface. The preset count difference is compared.

在一些可能实现的方式中,所述处理单元具体用于:In some possible implementations, the processing unit is specifically used for:

获取所述至少一个脉冲信号中每一个脉冲信号的多次计数差值;Acquiring multiple count differences of each pulse signal in the at least one pulse signal;

将所述至少一个脉冲信号中每一个脉冲信号的多次计数差值中的在时间上靠后的至少一次计数差值,确定为所述相应脉冲信号的计数差值。At least one count difference that is later in time among the multiple count differences of each pulse signal in the at least one pulse signal is determined as the count difference of the corresponding pulse signal.

在一些可能实现的方式中,所述处理单元具体用于:In some possible implementations, the processing unit is specifically used for:

接收利用已校准应用系统生成的所述参考脉冲信号。The reference pulse signal generated using the calibrated application system is received.

在一些可能实现的方式中,所述参考脉冲信号为脉冲宽度调制PWM信号。In some possible implementations, the reference pulse signal is a pulse width modulated PWM signal.

在一些可能实现的方式中,所述芯片为蓝牙低功耗BLE芯片。In some possible implementation manners, the chip is a Bluetooth low energy BLE chip.

第三方面,提供了一种蓝牙耳机,包括:In a third aspect, a Bluetooth headset is provided, including:

第二方面或第二方面中任一种可能实现的方式中所述的芯片。The chip described in the second aspect or any possible implementation manner of the second aspect.

附图说明Description of drawings

图1是本申请实施例的系统构架的示意图。FIG. 1 is a schematic diagram of a system architecture of an embodiment of the present application.

图2是本申请实施例的晶体校准的方法的示意性流程图。FIG. 2 is a schematic flowchart of a method for crystal calibration according to an embodiment of the present application.

图3是本申请实施例的晶体校准的方法的另一示意性流程图。FIG. 3 is another schematic flowchart of a method for crystal calibration according to an embodiment of the present application.

图4是本申请实施例的芯片的示意性框图。FIG. 4 is a schematic block diagram of a chip according to an embodiment of the present application.

具体实施方式Detailed ways

下面将结合附图,对本申请实施例中的技术方案进行描述。The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings.

本申请实施例中涉及的方法可以应用于各种晶体(又称为谐振器),也可以应用于具有晶体的各种芯片或电子设备。例如在封装内部添加IC组成振荡电路的晶体元件。所述方法也可以应用于晶振(又称为振荡器)。所述晶体也可以称为无源晶振,所述晶振也可称为有源晶振。例如,晶振可以理解为所述晶体与所述晶体相连的电容的组合器件。The methods involved in the embodiments of the present application can be applied to various crystals (also called resonators), and can also be applied to various chips or electronic devices having crystals. For example, adding an IC to form a crystal element of an oscillator circuit inside the package. The method can also be applied to crystal oscillators (also known as oscillators). The crystal can also be called a passive crystal oscillator, and the crystal oscillator can also be called an active crystal oscillator. For example, a crystal oscillator can be understood as a combination device of the crystal and the capacitor connected to the crystal.

又例如,所述芯片可以是单片机(Single-Chip Microcomputer)或集成电路芯片。例如,所述芯片可以是采用超大规模集成电路技术把具有数据处理能力的中央处理器(Central Processing Unit,CPU)、随机存储器(Random Access Memory,RAM)、只读存储器(Read Only Memory,ROM)、多种I/O口和中断系统、将定时器/计数器等功能(可能还包括显示驱动电路、脉宽调制电路、模拟多路转换器、A/D转换器等电路)集成到一块硅片上构成的一个小而完善的微型计算机系统。For another example, the chip may be a single-chip (Single-Chip Microcomputer) or an integrated circuit chip. For example, the chip may be a central processing unit (Central Processing Unit, CPU), a random access memory (Random Access Memory, RAM), a read only memory (Read Only Memory, ROM) with data processing capabilities using VLSI technology. , a variety of I/O ports and interrupt systems, integrate timer/counter and other functions (may also include display driver circuit, pulse width modulation circuit, analog multiplexer, A/D converter and other circuits) into a single silicon chip A small but complete microcomputer system composed of

其中,晶体可以通过与所述晶体相连的电容的配合生成脉冲信号。本实施例中,可以将与晶体相连的电容集成到芯片内部,并且将电容值的大小做成可配置的状态。例如,将电容值做成配置的多个用于表示电容值的参数,使得芯片中的晶体可以基于所述多个参数分别生成多个脉冲信号。例如,芯片中的晶体可以基于配置的多个参数分别生成多个频率的脉冲信号。此时,用户可以通过修改电容值(即修改配置的参数)的大小对脉冲信号的频率进行调整。由于每一个电路中元器件的一致性的问题,每一个产品在投入使用之前都需要单独设置一个最佳的电容值,使得脉冲信号的频率符合应用需求。本申请实施例的涉及的晶体校准可以指芯片在投入使用之前获取这个最佳电容值(或者最佳参数)的过程。当然,上述晶体校准可以包括修复后的校准或测试,以确定产品是否按照原始产品规格执行或运行其功能。Wherein, the crystal can generate the pulse signal through the cooperation of the capacitor connected with the crystal. In this embodiment, the capacitor connected to the crystal can be integrated into the chip, and the value of the capacitor can be made into a configurable state. For example, the capacitance value is configured as a plurality of parameters for representing the capacitance value, so that the crystal in the chip can respectively generate a plurality of pulse signals based on the plurality of parameters. For example, a crystal in a chip can generate pulse signals of multiple frequencies, respectively, based on multiple parameters configured. At this time, the user can adjust the frequency of the pulse signal by modifying the capacitance value (that is, modifying the configured parameter). Due to the consistency of the components in each circuit, each product needs to be individually set with an optimal capacitance value before it is put into use, so that the frequency of the pulse signal meets the application requirements. The crystal calibration involved in the embodiments of the present application may refer to the process of obtaining the optimum capacitance value (or optimum parameter) before the chip is put into use. Of course, the above-described crystal calibration may include post-repair calibration or testing to determine whether the product performs or functions according to the original product specifications.

图1是本申请实施例的系统构架的示意性框图。FIG. 1 is a schematic block diagram of a system architecture of an embodiment of the present application.

如图1所示,所述系统构架100可以包括测试设备110、中间设备或系统120以及芯片130。其中,所述测试设备110可以用于负责整个校准流程的启动或触发,例如,将用于生成脉冲信号的参数下发给中间设备或系统120,以便所述中间设备或系统将其转发给所述芯片130。所述测试设备110还可以用于显示校准结果。所述中间设备或系统120还可以用于生成参考脉冲信号。所述芯片130可以基于所述中间设备或系统120生成的参考脉冲信号和芯片130中的晶体生成的待校准的脉冲信号进行比较,以确定校准结果。所述芯片130还可以将校准结果通过中间设备或系统120发送给测试设备110,以便所述测试设备110显示所述校准结果。As shown in FIG. 1 , the system architecture 100 may include a test device 110 , an intermediate device or system 120 , and a chip 130 . The testing device 110 can be used to start or trigger the entire calibration process, for example, to deliver the parameters used to generate the pulse signal to the intermediate device or system 120, so that the intermediate device or system can forward it to the The chip 130 is described above. The test equipment 110 may also be used to display calibration results. The intermediate device or system 120 may also be used to generate a reference pulse signal. The chip 130 may compare the reference pulse signal generated by the intermediate device or system 120 with the pulse signal to be calibrated generated by the crystal in the chip 130 to determine the calibration result. The chip 130 can also send the calibration result to the testing device 110 through the intermediate device or system 120, so that the testing device 110 can display the calibration result.

所述测试设备110也可以称为校准工具或测试平台。例如,所述测试设备可以是个人计算机或者个人电脑(Personal Computer,PC)。比如传统的台式电脑、DIY电脑、笔记本电脑、以及近年来开始流行的平板电脑、一体机电脑、超级本、掌上电脑、嵌入式计算机等等。The test equipment 110 may also be referred to as a calibration tool or test bench. For example, the testing device may be a personal computer or a personal computer (Personal Computer, PC). For example, traditional desktop computers, DIY computers, notebook computers, and tablet computers, all-in-one computers, ultrabooks, PDAs, embedded computers, etc. that have become popular in recent years.

在本申请的一些实施例中,所述测试设备110可以包括通用异步收发传输器(Universal Asynchronous Receiver/Transmitter,UART)111。所述UART111将要传输的信息或数据在串行通信与并行通信之间加以转换。例如,将并行输入信号转成串行输出信号的芯片,所述UART 111可以被集成于所述测试设备110的通讯接口的连结上。所述测试设备110可以通过所述UART 111向所述中间设备或系统120发送参考脉冲信号触发命令,所述参考脉冲信号触发命令用于触发所述中间设备或系统120生成至少一个参考脉冲信号。例如,所述参考脉冲信号触发命令用于触发所述中间设备或系统120生成参考脉冲信号。In some embodiments of the present application, the testing device 110 may include a Universal Asynchronous Receiver/Transmitter (UART) 111 . The UART 111 converts the information or data to be transmitted between serial communication and parallel communication. For example, the UART 111 can be integrated into the connection of the communication interface of the test equipment 110 for a chip that converts a parallel input signal into a serial output signal. The testing device 110 may send a reference pulse signal trigger command to the intermediate device or system 120 through the UART 111, where the reference pulse signal trigger command is used to trigger the intermediate device or system 120 to generate at least one reference pulse signal. For example, the reference pulse signal trigger command is used to trigger the intermediate device or system 120 to generate a reference pulse signal.

所述中间设备或系统120可以是独立于所述测试设备110和芯片130的物理设备,也可以是集成在所述测试设备110或芯片上的装置或应用程序。The intermediate device or system 120 may be a physical device independent of the test device 110 and the chip 130 , or may be an apparatus or an application program integrated on the test device 110 or the chip.

在本申请的一些实施例中,所述中间设备或系统120还可以包括应用系统121,用于生成参考脉冲信号。例如,所述应用系统121可以生成16路参考脉冲信号。例如,所述参考脉冲信号可以为时钟信号(clock signal,CLK),即CLK…CLK16。可选地,所述中间设备或系统120可以包括通用串行总线(Universal Serial Bus,USB)转串口122,用于将所述测试设备110的USB接口转换成通用串口,便于快速接收所述测试设备110发送的信息或数据。例如,所述USB转串口122可以将一路串口转换成4路串口。可选地,所述测试设备还可以包括通用异步收发传输器集线器(Universal Asynchronous Receiver/TransmitterHub,UARTHUB)123,所述UARTHUB 123可以用于将接收到的信号分成多路串口。例如,所述UARTHUB 123可以用于将接收到的4路串口转换层16路串口。即所述UARTHUB 123可以连接至UART 1…UART 16串口。例如,所述中间设备或系统120可以通过所述UART 1…UART 16串口将待发送的信息广播给芯片130。In some embodiments of the present application, the intermediate device or system 120 may further include an application system 121 for generating a reference pulse signal. For example, the application system 121 can generate 16 reference pulse signals. For example, the reference pulse signal may be a clock signal (clock signal, CLK), ie CLK . . . CLK16. Optionally, the intermediate device or system 120 may include a universal serial bus (Universal Serial Bus, USB) to serial port 122, which is used to convert the USB interface of the test device 110 into a universal serial port, which is convenient for quickly receiving the test. Information or data sent by device 110 . For example, the USB to serial port 122 can convert one serial port into four serial ports. Optionally, the test equipment may further include a Universal Asynchronous Receiver/TransmitterHub (UARTHUB) 123, and the UARTHUB 123 may be used to divide the received signal into multiple serial ports. For example, the UARTHUB 123 can be used to convert the received 4-channel serial port into 16-channel serial port of the layer. That is, the UARTHUB 123 can be connected to the UART1...UART16 serial ports. For example, the intermediate device or system 120 may broadcast the information to be sent to the chip 130 through the serial ports of UART 1 . . . UART 16 .

串口也可称为串行接口、串行通信接口或串行通讯接口(例如COM接口),是采用串行通信方式的扩展接口。串行接口(Serial Interface)将数据一位一位地顺序传送,其通信线路简单,可以实现双向通信(可以直接利用电话线作为传输线)。A serial port can also be called a serial interface, a serial communication interface or a serial communication interface (such as a COM interface), and is an extended interface using a serial communication method. Serial Interface (Serial Interface) sequentially transmits data bit by bit, its communication line is simple, and can realize two-way communication (the telephone line can be directly used as a transmission line).

所述芯片130可以称为待测设备(Device Under Test,DUT),所述待测设备也称为被测设备(EUT)和被测单元(UUT)。所述待测设备可以是在首次制造时或在其生命周期后期进行测试的制造产品。上述芯片130可以是包括晶体或晶振的任意类型的芯片。例如,所述芯片130可以是蓝牙低功耗(Bluetooth Low Energy,BLE)芯片,所述BLE芯片也可以称为低功耗蓝牙芯片。The chip 130 may be referred to as a device under test (Device Under Test, DUT), which is also referred to as a device under test (EUT) and a unit under test (UUT). The device under test may be a manufactured product that is tested at the time of first manufacture or later in its life cycle. The above-mentioned chip 130 may be any type of chip including a crystal or a crystal oscillator. For example, the chip 130 may be a Bluetooth Low Energy (Bluetooth Low Energy, BLE) chip, and the BLE chip may also be referred to as a Bluetooth low energy chip.

在本申请的一些实施例中,所述芯片130可以包括晶体131,所述晶体131用于生成脉冲信号,以便所述芯片130能够正常运行。可选地,所述芯片130还可以包括处理单元132,所述处理单元可以用于进行晶体校准过程,即判断待校准的脉冲信号是否能够达到预期的频率,或比较待校准的脉冲信号和参考脉冲信号。可选地,所述芯片130还可以包括寄存器133,所述寄存器133用于存储用于生成脉冲信号的参数。在校准过程中,所述处理单元132可以通过控制所述寄存器133将待校准的参数发送至所述晶体,以便所述晶体生成相应的脉冲信号。In some embodiments of the present application, the chip 130 may include a crystal 131 for generating a pulse signal, so that the chip 130 can operate normally. Optionally, the chip 130 may further include a processing unit 132, and the processing unit may be used to perform a crystal calibration process, that is, to determine whether the pulse signal to be calibrated can reach an expected frequency, or to compare the pulse signal to be calibrated with a reference Pulse signal. Optionally, the chip 130 may further include a register 133 for storing parameters for generating the pulse signal. During the calibration process, the processing unit 132 may send the parameters to be calibrated to the crystal by controlling the register 133, so that the crystal generates a corresponding pulse signal.

需要说明的是,在图1的框架中,所述中间设备或系统120可以同时生成16路参考信号(即CLK1…CLK16),所述中间设备或系统120也可以通过16路串口(UART 1…UART 16串口)发送信息或数据。换言之,图1所示的框架100可以用于同时对16个芯片进行校准,其中芯片130可以是所述16个芯片中的一个。当然,实际操作中,可以根据需求对一个或多个芯片进行校准,也可以设置小于16路或大于16路的参考脉冲信号(或UART串口),本申请实施例对此不做限定。It should be noted that, in the framework of FIG. 1 , the intermediate device or system 120 can simultaneously generate 16 reference signals (ie CLK1...CLK16), and the intermediate device or system 120 can also generate 16 serial ports (UART 1... UART 16 serial port) to send information or data. In other words, the frame 100 shown in FIG. 1 can be used to calibrate 16 chips simultaneously, wherein the chip 130 can be one of the 16 chips. Of course, in actual operation, one or more chips may be calibrated according to requirements, and reference pulse signals (or UART serial ports) with less than 16 channels or more than 16 channels may also be set, which is not limited in this embodiment of the present application.

图2是本身实施例的晶体校准的方法200的示意性流程图。所述方法200适用于图1所示的晶体131或芯片130,也适用于系统框架100,为便于理解,下面以所述方法200的执行主体为芯片为例对所述方法进行说明。例如蓝牙低功耗(Bluetooth Low Energy,BLE)芯片。FIG. 2 is a schematic flow diagram of a method 200 of crystal calibration according to an embodiment of the present invention. The method 200 is applicable to the crystal 131 or the chip 130 shown in FIG. 1 , and is also applicable to the system frame 100 . For ease of understanding, the method 200 is described below by taking an example where the execution body of the method 200 is a chip. For example, a Bluetooth Low Energy (Bluetooth Low Energy, BLE) chip.

如图2所示,上所述方法200可以包括:As shown in FIG. 2, the above-described method 200 may include:

S210,获取至少一个脉冲信号的计数差值,所述至少一个脉冲信号包括所述晶体基于多个参数中的至少一个参数生成的脉冲信号,所述至少一个脉冲信号中每一个脉冲信号的计数差值为利用由参考脉冲信号触发的两次外部中断获取的基于相应脉冲信号的系统滴答计数值之间的差值。S210: Acquire a count difference value of at least one pulse signal, where the at least one pulse signal includes a pulse signal generated by the crystal based on at least one parameter among multiple parameters, and the count difference of each pulse signal in the at least one pulse signal The value is the difference between the system tick count values based on the corresponding pulse signal obtained using two external interrupts triggered by the reference pulse signal.

S220,基于所述至少一个脉冲信号的计数差值确定目标参数。S220: Determine a target parameter based on the count difference of the at least one pulse signal.

S230,将基于所述目标参数生成的脉冲信号确定为晶体校准后的脉冲信号。S230: Determine the pulse signal generated based on the target parameter as the pulse signal after crystal calibration.

简言之,芯片中的晶体基于获取到的至少一个参数分别生成至少一个脉冲信号后,所述芯片的处理单元可以通过比较所述至少一个脉冲信号和参考脉冲信号,确定出所述至少一个脉冲信号的计数差值(即所述至少一个脉冲信号中的每一个脉冲信号为时钟信号,通过所述参考脉冲信号触发的两次外部中断获取系统滴答计数器输出的两个计数值,并将所述两个计数值的差值作为同一个脉冲信号的计数差值),然后基于所述至少一个脉冲信号的计数差值,确定出校准结果(即所述目标参数)。其中,所述晶体基于所述目标参数生成的脉冲信号的频率最符合预期频率。所述校准结果可以用于指示所述目标参数或基于所述目标参数生成的脉冲信号,或所述校准结果还可用于指示所述目标参数对应的计数差值。In short, after the crystal in the chip generates at least one pulse signal based on the acquired at least one parameter, the processing unit of the chip can determine the at least one pulse signal by comparing the at least one pulse signal with the reference pulse signal. The count difference value of the signal (that is, each pulse signal in the at least one pulse signal is a clock signal, the two count values output by the system tick counter are acquired through two external interrupts triggered by the reference pulse signal, and the The difference between the two count values is used as the count difference of the same pulse signal), and then a calibration result (ie, the target parameter) is determined based on the count difference of the at least one pulse signal. Wherein, the frequency of the pulse signal generated by the crystal based on the target parameter best matches the expected frequency. The calibration result may be used to indicate the target parameter or a pulse signal generated based on the target parameter, or the calibration result may also be used to indicate a count difference value corresponding to the target parameter.

通过所述至少一个脉冲信号的计数差值确定所述目标参数,不仅能够实现脉冲信号的自动校准降低了人力成本,还能够在降低校准机制的复杂度的同时提高校准效率。Determining the target parameter by the count difference of the at least one pulse signal can not only realize automatic calibration of the pulse signal and reduce labor costs, but also improve the calibration efficiency while reducing the complexity of the calibration mechanism.

其中,所述参考脉冲信号可以是如图1所示的应用系统121触发已校准的其他芯片生成的脉冲信号。The reference pulse signal may be a pulse signal generated by triggering other calibrated chips by the application system 121 as shown in FIG. 1 .

在本申请的一些实施例中,所述方法200还可包括:In some embodiments of the present application, the method 200 may further include:

所述芯片接收利用已校准应用系统生成的所述参考脉冲信号。The chip receives the reference pulse signal generated using a calibrated application system.

当然,本申请实施例不限于此。例如,在其他可替代实施例中,还可以通过集成有现场可编程逻辑门阵列(Field Programmable Gate Array,FPGA)或复杂可编程逻辑器件(Complex Programmable Logic Device,CPLD)的硬件电路提供一个高精度的参考脉冲信号。Of course, the embodiments of the present application are not limited to this. For example, in other alternative embodiments, a high precision can also be provided by a hardware circuit integrated with a Field Programmable Gate Array (FPGA) or a Complex Programmable Logic Device (CPLD). the reference pulse signal.

所述参考脉冲信号可以是任意精准度达到条件的脉冲信号。例如,所述参考脉冲信号可以是脉冲宽度调制(Pulse Width Modulation,PWM)信号。可以通过模拟控制方式调制信号,以生成所述PWM信号。例如,可以通过调制脉冲的宽度等效出所需要的波形(包含形状以及幅值),进而对模拟信号电平进行数字编码,生成可以用于发送的信息或数据。例如,可以通过调节占空比的变化调节信号、能量等的变化。占空比可以是指在一个周期内,信号处于高电平的时间占据整个信号周期的百分比,例如方波的占空比就是50%。The reference pulse signal may be any pulse signal whose accuracy is met. For example, the reference pulse signal may be a pulse width modulation (Pulse Width Modulation, PWM) signal. The signal can be modulated by analog control to generate the PWM signal. For example, the required waveform (including shape and amplitude) can be equivalently obtained by modulating the width of the pulse, and then the analog signal level can be digitally encoded to generate information or data that can be used for transmission. For example, changes in signal, energy, etc. can be adjusted by adjusting for changes in duty cycle. The duty cycle may refer to the percentage of the entire signal cycle when the signal is at a high level in one cycle, for example, the duty cycle of a square wave is 50%.

在本申请的一些实施例中,可以直接通过芯片的内部模块生成PWM信号。例如,可以通过图1所示的芯片130或应用系统121生成PWM信号。例如,所述芯片130的I/O接口可以设置有集成模块。换言之,所述芯片130可以设置有带PWM信号输出的功能模块在程序。其中,I/O接口可以是所述芯片130与被控对象进行信息交换的纽带。所述芯片130可以通过I/O接口与外部设备进行数据交换。所述I/O接口可以是可编程接口,即所述I/O接口的工作方式可由程序进行控制。In some embodiments of the present application, the PWM signal may be directly generated by an internal module of the chip. For example, the PWM signal may be generated by the chip 130 or the application system 121 shown in FIG. 1 . For example, the I/O interface of the chip 130 may be provided with an integrated module. In other words, the chip 130 may be provided with function modules with PWM signal output in the program. The I/O interface may be a link between the chip 130 and the controlled object to exchange information. The chip 130 can exchange data with external devices through the I/O interface. The I/O interface can be a programmable interface, that is, the working mode of the I/O interface can be controlled by a program.

下面对本申请实施例中芯片获取至少一个脉冲信号的计数差值的方法进行说明。The method for obtaining the count difference of at least one pulse signal by the chip in the embodiment of the present application will be described below.

在本申请的一些实施例中,应用系统121在进行晶体校准之前可以是已使用频谱仪校准的系统,时钟频率准确度已经达到比标准协议(例如BLE标准协议)更精确的状态。实际操作中,所述应用系统121可以产生一个精准的一定频率(例如40Hz)的PWM信号给芯片130。芯片130通过一个可作为外部中断输入的I/O接口去采样应用系统121产生的PWM信号。校准的过程可以在芯片130内执行,由应用系统121产生的PWM信号驱动。In some embodiments of the present application, the application system 121 may be a system that has been calibrated using a spectrum analyzer before crystal calibration, and the clock frequency accuracy has reached a state that is more accurate than a standard protocol (eg, a BLE standard protocol). In actual operation, the application system 121 can generate a precise PWM signal of a certain frequency (eg, 40 Hz) to the chip 130 . The chip 130 samples the PWM signal generated by the application system 121 through an I/O interface that can be used as an external interrupt input. The calibration process can be performed in the chip 130 and driven by the PWM signal generated by the application system 121 .

以利用遍历的方式获取所述多个脉冲信号对应的多个计数差值为例,结合图1来说,当测试设备110发送串口指令启动校准流程时,芯片130往寄存器133中写入一个参数(即用于生成脉冲信号的参数)。例如,所述参数可以是偏置值。又例如,所述偏置值的初始值可以是0。然后,所述芯片130可以计算两次外部中断之间系统嘀嗒时钟计数的差值并记录(假设系统嘀嗒时钟的时钟频率设置为64M,如果晶体已被校准的情况下系统嘀嗒时钟的时钟频率会无限接近64M,当系统嘀嗒时钟的频率为64M时,40Hz的PWM信号触发的两次外部中断之间系统嘀嗒计数值的差值应该为1600000,即预设计数差值可以为1600000),之后参数+1并写入寄存器133,再次计算两次外部中断之间系统嘀嗒时钟计数的差值并记录,遍历完所有晶体校准的参数,找出系统嘀嗒计数值的差值最接近1600000对应的参数,即为晶体校准的目标参数(可以用于体现校准结果)。Taking the method of traversing to obtain multiple count differences corresponding to the multiple pulse signals as an example, with reference to FIG. 1 , when the test equipment 110 sends a serial port command to start the calibration process, the chip 130 writes a parameter into the register 133 (ie the parameters used to generate the pulse signal). For example, the parameter may be an offset value. For another example, the initial value of the offset value may be 0. Then, the chip 130 can calculate and record the difference of the system tick clock count between two external interrupts (assuming the clock frequency of the system tick clock is set to 64M, if the crystal has been calibrated, the clock frequency of the system tick clock will be Infinitely close to 64M, when the frequency of the system tick clock is 64M, the difference between the two external interrupts triggered by the 40Hz PWM signal should be 1600000, that is, the preset count difference can be 1600000), after the parameter +1 and write to register 133, calculate and record the difference of the system tick clock count between two external interrupts again, after traversing all crystal calibration parameters, find out the difference of the system tick count value that is closest to the parameter corresponding to 1600000, It is the target parameter of crystal calibration (can be used to reflect the calibration result).

需要说明的是,寄存器可以基于所述目标参数触发晶体生成校准后的脉冲信号,例如,寄存器可以基于所述目标参数将与所述晶体连接的电容器的电容值修改(或调整)为所述目标参数对应的电容值,以生成校准后的脉冲信号。换言之,上述多个参数分别对应已配置的多个电容值。例如,所述多个参数与所述多个电容值一一对应。在所述多个参数中选择出所述目标参数作为最优参数,使得基于所述目标参数对应的电容值生成的脉冲信号为最符合预期(即最精准)的脉冲信号。It should be noted that the register can trigger the crystal to generate a calibrated pulse signal based on the target parameter. For example, the register can modify (or adjust) the capacitance value of the capacitor connected to the crystal to the target based on the target parameter. The capacitance value corresponding to the parameter to generate the calibrated pulse signal. In other words, the above-mentioned parameters correspond to the configured capacitance values respectively. For example, the plurality of parameters are in one-to-one correspondence with the plurality of capacitance values. The target parameter is selected from the plurality of parameters as the optimal parameter, so that the pulse signal generated based on the capacitance value corresponding to the target parameter is the most expected (ie the most accurate) pulse signal.

上述过程中,采用遍历的方法去测试每一个可能的参数,然后选出优的参数作为校准结果。本申请为例降低时间成本,减少参数或计数差值的采样数,可以只通过所述至少一个脉冲信号的计数差值确定所述目标参数,不仅能够实现脉冲信号的自动校准降低了人力成本,还能够在降低校准机制的复杂度的同时提高校准效率。In the above process, the traversal method is used to test each possible parameter, and then the optimal parameter is selected as the calibration result. For example, in the present application, the time cost is reduced, and the number of samples of parameters or count difference values can be reduced. The target parameter can be determined only by the count difference value of the at least one pulse signal, which can not only realize the automatic calibration of the pulse signal, but also reduce the labor cost. It is also possible to improve calibration efficiency while reducing the complexity of the calibration mechanism.

在本申请的一些实施例中,所述S210可包括:In some embodiments of the present application, the S210 may include:

利用二分法获取所述至少一个脉冲信号的计数差值。The count difference value of the at least one pulse signal is obtained by using a dichotomy method.

例如,可以先利用二分法从所述多个参数中获取至少一个采样参数,然后基于所述至少一个采样参数分别生成的所述至少一个脉冲信号,获取至少一个脉冲信号的计数差值。For example, at least one sampling parameter may be obtained from the plurality of parameters by first using a dichotomy method, and then the count difference value of the at least one pulse signal may be obtained based on the at least one pulse signal respectively generated by the at least one sampling parameter.

换言之,芯片可以基于二分法对多个参数进行采样,然后基于采样的参数生成脉冲信号,再基于脉冲信号的计数差值进行晶体校准。或者说,所述芯片可以基于二分法对所述多个参数进行采样,然后获取的脉冲信号的计数差值确定是否继续进行采样。In other words, the chip can sample multiple parameters based on the dichotomy method, then generate a pulse signal based on the sampled parameters, and then perform crystal calibration based on the count difference of the pulse signal. In other words, the chip may sample the plurality of parameters based on the dichotomy method, and then determine whether to continue sampling based on the count difference of the obtained pulse signal.

在本申请的一些实施例中,芯片可以先确定多个参数中的最小参数和最大参数;再基于最小参数和最大参数分别生成第一脉冲信号和第二脉冲信号;然后分别获取所述第一脉冲信号的第一计数差值和第二脉冲信号的第二计数差值;此时所述芯片可以基于所述第一计数差值和所述第二计数差值确定所述目标参数。In some embodiments of the present application, the chip may first determine the minimum parameter and the maximum parameter among the multiple parameters; then generate the first pulse signal and the second pulse signal respectively based on the minimum parameter and the maximum parameter; and then obtain the first pulse signal respectively The first count difference of the pulse signal and the second count difference of the second pulse signal; at this time, the chip may determine the target parameter based on the first count difference and the second count difference.

例如,所述芯片可以通过比较预设计数差值和所述第一计数差值和所述第二计数差值的平均值,确定所述目标参数。For example, the chip may determine the target parameter by comparing a preset count difference value and an average value of the first count difference value and the second count difference value.

其中,所述预设计数差值可以是基于预设的脉冲信号对应的计数差值,即所述预设计数差值可以为利用由参考脉冲信号触发的两次外部中断获取的基于已校准的脉冲信号的系统滴答计数值之间的差值。所述预设计数差值可以是预先设定好的计数差值,也可以是预先测量的计数差值,当然,也可以是在校准过程中测量的计数差值,本申请实施例对此不做限定。The preset count difference value may be a count difference value corresponding to a preset pulse signal, that is, the preset count difference value may be a calibrated-based difference value obtained by using two external interrupts triggered by a reference pulse signal. The difference between the system tick count values of the pulsed signal. The preset count difference value may be a preset count difference value, or a pre-measured count difference value. Of course, it may also be a count difference value measured during the calibration process, which is not the case in this embodiment of the present application. Do limit.

换言之,所述芯片可以先在所述多个参数中将最大参数和最小参数作为采样参数,以基于所述采样参数获取脉冲信号,再基于所述第一计数差值和所述第二计数的平均值,确定是否需要继续在所述多个参数中获取采样参数。In other words, the chip can first use the maximum parameter and the minimum parameter as sampling parameters among the plurality of parameters, so as to obtain a pulse signal based on the sampling parameters, and then based on the difference between the first count and the second count The average value is used to determine whether it is necessary to continue to acquire sampling parameters from the plurality of parameters.

例如,在所述第一计数差值和所述第二计数差值的平均值等于预设计数差值的情况下,可以将所述最小参数和所述最大参数的平均值确定为所述目标参数。换言之,所述芯片在获取所述第一计数差值和所述第二计数差值之后,不需要再获取采样参数。For example, in the case that the average value of the first count difference value and the second count difference value is equal to a preset count difference value, the average value of the minimum parameter and the maximum parameter may be determined as the target parameter. In other words, the chip does not need to acquire sampling parameters after acquiring the first count difference and the second count difference.

又例如,在所述第一计数差值和所述第二计数差值的平均值大于所述预设计数差值的情况下,可以将所述最小参数和所述最大参数的平均值加1确定为第一参数;基于所述第一参数生成第三脉冲信号;获取所述第三脉冲信号的第三计数差值;基于所述第三计数差值和所述第二计数差值确定所述目标参数。换言之,所述芯片在获取所述第一计数差值和所述第二计数差值之后,还需要利用二分法将所述第一参数作为采样参数,以获取所述第三脉冲信号。可选地,所述多个参数为连续参数。可选地,所述多个参数包括所述第一参数。可选地,在所述多个参数中,所述多个参数的参数数值随脉冲信号的计数差值的增大而减小;或者,所述多个参数的参数数值随脉冲信号的计数差值的减小而增大。For another example, in the case where the average value of the first count difference value and the second count difference value is greater than the preset count difference value, the average value of the minimum parameter and the maximum parameter may be increased by 1 determine a first parameter; generate a third pulse signal based on the first parameter; obtain a third count difference value of the third pulse signal; determine the third count difference value based on the third count difference value and the second count difference value the target parameters. In other words, after the chip obtains the first count difference value and the second count difference value, the chip also needs to use the dichotomy method to use the first parameter as a sampling parameter to obtain the third pulse signal. Optionally, the plurality of parameters are continuous parameters. Optionally, the plurality of parameters include the first parameter. Optionally, among the plurality of parameters, the parameter values of the plurality of parameters decrease as the count difference of the pulse signal increases; or, the parameter values of the plurality of parameters decrease with the count difference of the pulse signal. increases as the value decreases.

利用二分法在所述多个参数中确定采样参数,能够在保证校准精度的情况下,减少采样参数,即减少需要生成的脉冲信号,也减小了需要测量的计数差值,能够有效提高校准效率并缩小校准时间。Using the dichotomy method to determine the sampling parameters among the plurality of parameters can reduce the sampling parameters under the condition of ensuring the calibration accuracy, that is, reduce the pulse signal that needs to be generated, and also reduce the count difference value that needs to be measured, which can effectively improve the calibration efficiency and reduce calibration time.

又例如,在所述第一计数差值和所述第二计数差值的平均值小于所述预设计数差值的情况下,可以将所述最小参数和所述最大参数的平均值减一确定为第二参数;基于所述第二参数生成第四脉冲信号;获取所述第四脉冲信号的第四计数差值;基于所述第四计数差值和所述第一计数差值确定所述目标参数。换言之,所述芯片在获取所述第一计数差值和所述第二计数差值之后,还需要利用二分法将所述第二参数作为采样参数,以获取所述第四脉冲信号。可选地,所述多个参数为连续参数。可选地,所述多个参数包括所述第二参数。可选地,在所述多个参数中,所述多个参数的参数数值随脉冲信号的计数差值的增大而减小;或者,所述多个参数的参数数值随脉冲信号的计数差值的减小而增大。For another example, in the case that the average value of the first count difference value and the second count difference value is smaller than the preset count difference value, the average value of the minimum parameter and the maximum parameter may be reduced by one determine a second parameter; generate a fourth pulse signal based on the second parameter; obtain a fourth count difference of the fourth pulse signal; determine the fourth count difference based on the fourth count difference and the first count difference the target parameters. In other words, after the chip obtains the first count difference value and the second count difference value, the chip also needs to use the dichotomy method to use the second parameter as a sampling parameter to obtain the fourth pulse signal. Optionally, the plurality of parameters are continuous parameters. Optionally, the plurality of parameters include the second parameter. Optionally, among the plurality of parameters, the parameter values of the plurality of parameters decrease as the count difference of the pulse signal increases; or, the parameter values of the plurality of parameters decrease with the count difference of the pulse signal. increases as the value decreases.

利用二分法在所述多个参数中确定采样参数,能够在保证校准精度的情况下,减少采样参数,即减少需要生成的脉冲信号,也减小了需要测量的计数差值,能够有效提高校准效率并缩小校准时间。Using the dichotomy method to determine the sampling parameters among the plurality of parameters can reduce the sampling parameters under the condition of ensuring the calibration accuracy, that is, reduce the pulse signal that needs to be generated, and also reduce the count difference value that needs to be measured, which can effectively improve the calibration efficiency and reduce calibration time.

综上所述,利用二分化获取至少一个脉冲信号的计数差值,避免了获取所有的脉冲信号的计数差值,降低了需要获取的计数差值的总量,能够在保证校准准确度的同时,提高校准效率并减少时间成本。In summary, the use of binary differentiation to obtain the count difference of at least one pulse signal avoids obtaining the count difference of all pulse signals, reduces the total amount of count difference that needs to be obtained, and can ensure the calibration accuracy at the same time. , improve calibration efficiency and reduce time cost.

图3是本申请实施例的晶体校准的方法300的示意性流程图。FIG. 3 is a schematic flowchart of a method 300 for crystal calibration according to an embodiment of the present application.

如图3所示,所述方法300可包括以下中的部分或全部内容:As shown in FIG. 3, the method 300 may include some or all of the following:

S310,芯片获取最小参数和最大参数。S310, the chip obtains the minimum parameter and the maximum parameter.

S320,所述芯片基于所述最小参数和所述最大参数分别生成第一脉冲信号和第二脉冲信号,并判断是否已经通过参考脉冲信号触发所述第一脉冲信号和所述第二脉冲信号外部中断?S320, the chip generates a first pulse signal and a second pulse signal based on the minimum parameter and the maximum parameter, respectively, and determines whether the first pulse signal and the second pulse signal have been triggered externally by a reference pulse signal interrupted?

S330,若通过参考脉冲信号已分别触发所述第一脉冲信号和所述第二脉冲信号外部中断,所述芯片获取所述第一脉冲信号的计数差值和所述第二脉冲信号的计数差值。若没有通过参考脉冲信号触发所述第一脉冲信号或所述第二脉冲信号外部中断,返回到S320并执行。S330, if the external interrupt of the first pulse signal and the second pulse signal have been triggered respectively by the reference pulse signal, the chip obtains the count difference of the first pulse signal and the count difference of the second pulse signal value. If the external interrupt of the first pulse signal or the second pulse signal is not triggered by the reference pulse signal, return to S320 and execute.

S340,所述芯片是否已获取所述第一脉冲信号的5次计数差值和所述第二脉冲信号的5次计数差值?S340. Has the chip obtained the difference between the counts of the first pulse signal and the count of the second pulse signal for five times?

S350,若所述芯片已获取所述第一脉冲信号的5次计数差值和所述第二脉冲信号的5次计数差值,所述芯片将所述第一脉冲信号的5次计数差值中的后3次计数差值的平均值,确定为所述第一脉冲信号对应的第一计数差值;将所述第二脉冲信号的5次计数差值中的后3次计数差值的平均值,确定为所述第二脉冲信号对应的第二计数差值。若所述芯片没有获取所述第一脉冲信号的5次计数差值或所述第二脉冲信号的5次计数差值,返回到S320并执行。S350, if the chip has obtained the difference between the five counts of the first pulse signal and the five counts of the second pulse signal, the chip calculates the difference between the five counts of the first pulse signal The average value of the last 3 count differences in the first pulse signal is determined as the first count difference corresponding to the first pulse signal; The average value is determined as the second count difference value corresponding to the second pulse signal. If the chip does not acquire the 5 count difference of the first pulse signal or the 5 count difference of the second pulse signal, return to S320 and execute.

S360,所述最小参数是否小于所述最大参数?S360, is the minimum parameter smaller than the maximum parameter?

S390,若所述最小参数等于所述最大参数,所述芯片将所述最小参数或所述最大参数确定为目标参数。S390, if the minimum parameter is equal to the maximum parameter, the chip determines the minimum parameter or the maximum parameter as a target parameter.

S370,若所述最小参数小于所述最大参数,判断所述第一计数差值和所述第二计数差值的平均值是否等于预设计数差值?S370, if the minimum parameter is smaller than the maximum parameter, determine whether the average value of the first count difference and the second count difference is equal to a preset count difference?

S371,若所述第一计数差值和所述第二计数差值的平均值等于预设计数差值,所述芯片将所述最小参数和所述最大参数的平均值确定为目标参数。S371 , if the average value of the first count difference value and the second count difference value is equal to a preset count difference value, the chip determines the average value of the minimum parameter and the maximum parameter as a target parameter.

S380,若所述第一计数差值和所述第二计数差值的平均值不等于预设计数差值,判断所述第一计数差值和所述第二计数差值的平均值是否大于所述预设计数差值?S380, if the average value of the first count difference value and the second count difference value is not equal to the preset count difference value, determine whether the average value of the first count difference value and the second count difference value is greater than The preset count difference?

S381,若所述第一计数差值和所述第二计数差值的平均值大于所述预设计数差值,所述芯片将所述最小参数和所述最大参数的平均值加1重新确定为最小参数,返回到S320并执行。S381, if the average value of the first count difference value and the second count difference value is greater than the preset count difference value, the chip adds 1 to the average value of the minimum parameter and the maximum parameter to re-determine is the minimum parameter, return to S320 and execute.

S382,若所述第一计数差值和所述第二计数差值的平均值小于所述预设计数差值,所述芯片将所述最小参数和所述最大参数的平均值减1重新确定为所述最大参数,返回到S320并执行。S382, if the average value of the first count difference value and the second count difference value is less than the preset count difference value, the chip decrements the average value of the minimum parameter and the maximum parameter by 1 to re-determine For the maximum parameter, return to S320 and execute.

S390,校准结束。S390, the calibration ends.

在本申请的另一些实施例中,所述S210可包括:In other embodiments of the present application, the S210 may include:

获取所述晶体基于所述多个参数分别生成的多个脉冲信号;acquiring a plurality of pulse signals respectively generated by the crystal based on the plurality of parameters;

此时,所述芯片可以先获取所述多个脉冲信号对应的多个计数差值;然后利用二分法,获取所述多个计数差值中的与预设计数差值最接近的目标计数差值;最后将所述目标计数差值对应的参数确定为所述目标参数。At this time, the chip can first obtain a plurality of count differences corresponding to the plurality of pulse signals; and then obtain the target count difference that is closest to the preset count difference among the plurality of count differences by using the dichotomy method value; finally, the parameter corresponding to the target count difference value is determined as the target parameter.

通过二分法获取目标计数差值,避免了遍历式的比较所述预设计数差值与每一个脉冲信号的计数差值,降低了芯片的计算量,提升了校准效率并减小了时间成本。Obtaining the target count difference by the dichotomy method avoids ergodic comparison of the preset count difference and the count difference of each pulse signal, reduces the calculation amount of the chip, improves the calibration efficiency and reduces the time cost.

在本申请的一些实施例中,所述方法200还可包括:In some embodiments of the present application, the method 200 may further include:

按照升序或降序对所述多个计数差值进行排序。The plurality of count differences are sorted in ascending or descending order.

换言之,芯片获取所述多个计数差值后,将所述多个计数差值按照升序或降序排列,然后基于排列好的一组计数差值,利用二分法找到与所述预设计数差值最接近的目标计数差值。In other words, after acquiring the plurality of count differences, the chip arranges the plurality of count differences in ascending or descending order, and then uses a dichotomy method to find the difference from the preset count based on a set of arranged count differences. The closest target count difference.

例如,芯片可以先将所述多个计数差值组成的集合,确定为第一差值集合;然后在所述第一差值集合内,利用二分法确定所述目标计数差值。所述第一差值集合内的计数差值按升序或降序排序。For example, the chip may first determine the set composed of the multiple count differences as the first difference set; then, within the first difference set, use the dichotomy method to determine the target count difference. The count differences in the first difference set are sorted in ascending or descending order.

此时,所述芯片可以先确定所述第一差值集合内的中间位置的计数差值;在所述中间位置的计数差值等于所述预设计数差值的情况下,将所述中间位置的计数差值确定为所述目标计数差值。在所述中间位置的计数差值小于所述预设计数差值的情况下,若所述第一差值集合按升序排序,在所述第一差值集合的后半段中确定所述目标计数差值,若所述第一差值结合按降序排序,在所述第一差值集合的前半段中确定所述目标计数差值。在所述中间位置的计数差值大于所述预设计数差值的情况下,若所述第一差值集合按升序排序,在所述第一差值集合的前半段中确定所述目标计数差值,若所述第一差值结合按降序排序,在所述第一差值集合的后半段中确定所述目标计数差值。At this time, the chip may first determine the count difference value of the middle position in the first difference value set; in the case that the count difference value of the middle position is equal to the preset count difference value, set the count difference value of the middle position The count difference value of the position is determined as the target count difference value. In the case that the count difference value at the intermediate position is smaller than the preset count difference value, if the first difference value set is sorted in ascending order, the target is determined in the second half of the first difference value set The count difference value, if the first difference value combination is sorted in descending order, the target count difference value is determined in the first half of the first difference value set. In the case where the count difference value at the middle position is greater than the preset count difference value, if the first difference value set is sorted in ascending order, the target count is determined in the first half of the first difference value set The difference value, if the first difference value combination is sorted in descending order, the target count difference value is determined in the second half of the first difference value set.

在本申请的一些实施例中,所述多个参数的参数数值随着脉冲信号的频率的增大而减小。In some embodiments of the present application, the parameter values of the plurality of parameters decrease as the frequency of the pulse signal increases.

例如,所述多个参数的参数数值与脉冲信号的频率成反比。For example, the parameter values of the plurality of parameters are inversely proportional to the frequency of the pulse signal.

换言之,所述多个参数的参数数值随着脉冲信号的计数差值的增大而减小。例如,所述多个参数的参数数值与脉冲信号的计数差值成反比。In other words, the parameter values of the plurality of parameters decrease as the count difference of the pulse signal increases. For example, the parameter values of the plurality of parameters are inversely proportional to the count difference of the pulse signal.

通过定义所述多个参数的特性,能够使得获取的差值计数按照由大到小或由小到大的顺序自动排序,避免了获取所述多个计数差值后重新对所述多个计数差值重新排序的步骤,在通过二分法获取目标参数或目标计数差值的基础上,有效降低了校准脉冲信号的时间成本。By defining the characteristics of the multiple parameters, the acquired difference counts can be automatically sorted in the order from large to small or from small to large, which avoids re-counting the multiple counts after acquiring the multiple count differences. The step of reordering the difference values effectively reduces the time cost of calibrating the pulse signal on the basis of obtaining the target parameter or target count difference value through the dichotomy method.

换言之,将所述多个参数的参数数值随着脉冲信号的频率的增大而减小,使得所述多个参数的参数数值随脉冲信号的计数差值的增大而减小,或者使得所述多个参数的参数数值随脉冲信号的计数差值的减小而增大,以便所述芯片利用二分法确定所述目标参数或目标计数差值。In other words, the parameter values of the plurality of parameters are decreased as the frequency of the pulse signal increases, so that the parameter values of the plurality of parameters decrease as the count difference of the pulse signal increases, or all The parameter values of the plurality of parameters increase as the count difference value of the pulse signal decreases, so that the chip determines the target parameter or the target count difference value by using a dichotomy method.

在本申请的一些实施例中,所述S210可包括:In some embodiments of the present application, the S210 may include:

按照参数值升序或降序的顺序,依次获取至少一个脉冲信号的计数差值。According to the ascending or descending order of parameter values, the count difference value of at least one pulse signal is obtained in sequence.

在本申请的一些实施例中,所述方法200还可包括:In some embodiments of the present application, the method 200 may further include:

利用USB转串口和UART HUB接收测试设备发送的校准信令,所述校准信令用于触发所述芯片进行晶体校准。The calibration signaling sent by the test equipment is received by using the USB to serial port and the UART HUB, and the calibration signaling is used to trigger the chip to perform crystal calibration.

在本申请的一些实施例中,所述校准信令包括所述多个参数。In some embodiments of the present application, the calibration signaling includes the plurality of parameters.

在本申请的一些实施例中,所述方法200还可包括:In some embodiments of the present application, the method 200 may further include:

将所述多个参数存储至寄存器,以便通过控制所述寄存器向所述晶体发送所述多个参数。The plurality of parameters are stored in a register to transmit the plurality of parameters to the crystal by controlling the register.

通过寄存器触发晶体生成待校准的脉冲信号,即寄存器负责并控制晶体生成待校准信号的操作,降低了芯片的工作负荷,有效提高了芯片进行脉冲信号校准的工作效率。The crystal is triggered by the register to generate the pulse signal to be calibrated, that is, the register is responsible for and controls the operation of the crystal to generate the signal to be calibrated, which reduces the workload of the chip and effectively improves the work efficiency of the chip for pulse signal calibration.

在本申请的一些实施例中,所述方法200还可包括:In some embodiments of the present application, the method 200 may further include:

将校准结果存储至所述寄存器,所述校准结果用于指示所述目标参数。A calibration result is stored in the register, and the calibration result is used to indicate the target parameter.

在本申请的一些实施例中,所述方法200还可包括:In some embodiments of the present application, the method 200 may further include:

利用USB转串口和UART HUB向测试设备发送校准结果和/或所述至少一个脉冲信号的计数差值,所述校准结果用于指示所述目标参数,所述至少一个脉冲信号的计数差值用于所述测试设备在显示界面与预设计数差值进行比较。Send the calibration result and/or the count difference value of the at least one pulse signal to the test equipment by using the USB to serial port and the UART HUB, where the calibration result is used to indicate the target parameter, and the count difference value of the at least one pulse signal is used as The test device compares with the preset count difference on the display interface.

通过向测试设备发送所述至少一个脉冲信号的计数差值,使得用户能够在所述测试设备的显示界面上能够观察到所述至少一个脉冲信号的计数差值中的每一个计数差值和所述预设计数差值之间的对应关系,便于用户进行人工的调整目标计数差值,以实现自动校准配合人工校准的校准机制。类似地,通过向测试设备发送所述校准结果,有便于设计人员进行批量校准以及调整参数设计。By sending the count difference of the at least one pulse signal to the testing device, the user can observe each count difference and all the count differences of the at least one pulse signal on the display interface of the testing device. The corresponding relationship between the preset count difference values is convenient for the user to manually adjust the target count difference value, so as to realize the calibration mechanism of automatic calibration and manual calibration. Similarly, by sending the calibration results to the test equipment, it is convenient for designers to perform batch calibrations and adjust parameter designs.

在本申请的一些实施例中,所述S210可包括:In some embodiments of the present application, the S210 may include:

获取所述至少一个脉冲信号中每一个脉冲信号的多次计数差值;Acquiring multiple count differences of each pulse signal in the at least one pulse signal;

将所述至少一个脉冲信号中每一个脉冲信号的多次计数差值中的在时间上靠后的至少一次计数差值,确定为所述相应脉冲信号的计数差值。At least one count difference that is later in time among the multiple count differences of each pulse signal in the at least one pulse signal is determined as the count difference of the corresponding pulse signal.

由此,能够准确获取每一个脉冲信号对应的计数差值,相应的,能够提高脉冲信号的校准精度。换言之,通过对所述至少一个脉冲信号中每一个脉冲信号进行测试后,再获取每一个脉冲信号对应的计数差值,能够避免在系统不稳定或晶体不稳定的情况下测量的脉冲信号的计数差值不准确,能够提高计数差值的准确度和脉冲信号的校准精度。In this way, the count difference value corresponding to each pulse signal can be accurately obtained, and accordingly, the calibration accuracy of the pulse signal can be improved. In other words, by testing each pulse signal in the at least one pulse signal, and then obtaining the count difference value corresponding to each pulse signal, it is possible to avoid the counting of pulse signals measured when the system is unstable or the crystal is unstable. The difference value is inaccurate, which can improve the accuracy of the count difference value and the calibration accuracy of the pulse signal.

此外,本申请还提供了一种可用于执行上述方法200或300芯片。In addition, the present application also provides a chip that can be used to execute the above method 200 or 300 .

图4是本申请实施例的芯片400的示意性框图。所述芯片400可以是图1所示的芯片130。FIG. 4 is a schematic block diagram of a chip 400 according to an embodiment of the present application. The chip 400 may be the chip 130 shown in FIG. 1 .

如图4所示,所述芯片400可包括:As shown in FIG. 4 , the chip 400 may include:

晶体410,用于基于多个参数分别生成的多个脉冲信号;a crystal 410 for generating a plurality of pulse signals based on a plurality of parameters;

处理单元420,所述处理单元420连接至所述晶体410,所述处理单元420用于:A processing unit 420, which is connected to the crystal 410, is used to:

获取所述晶体410基于多个参数中的至少一个参数生成的至少一个脉冲信号;acquiring at least one pulse signal generated by the crystal 410 based on at least one parameter among the plurality of parameters;

获取至少一个脉冲信号的计数差值,所述至少一个脉冲信号中每一个脉冲信号的计数差值为利用由参考脉冲信号触发的两次外部中断获取的基于相应脉冲信号的系统滴答计数值之间的差值;Obtaining a count difference value of at least one pulse signal, where the count difference value of each pulse signal in the at least one pulse signal is between the system tick count values based on the corresponding pulse signal obtained by using two external interrupts triggered by the reference pulse signal difference;

基于所述至少一个脉冲信号的计数差值确定目标参数;determining a target parameter based on the count difference of the at least one pulse signal;

将基于所述目标参数生成的脉冲信号确定为晶体410校准后的脉冲信号。The pulse signal generated based on the target parameter is determined as the pulse signal after calibration of the crystal 410 .

在本申请的一些实施例中,所述处理单元420具体用于:In some embodiments of the present application, the processing unit 420 is specifically configured to:

利用二分法获取所述至少一个脉冲信号的计数差值。The count difference value of the at least one pulse signal is obtained by using a dichotomy method.

在本申请的一些实施例中,所述处理单元420更具体用于:In some embodiments of the present application, the processing unit 420 is more specifically used for:

确定多个参数中的最小参数和最大参数;Determine the minimum and maximum parameters among multiple parameters;

基于最小参数和最大参数分别生成第一脉冲信号和第二脉冲信号;generating a first pulse signal and a second pulse signal based on the minimum parameter and the maximum parameter, respectively;

分别获取所述第一脉冲信号的第一计数差值和第二脉冲信号的第二计数差值;respectively acquiring the first count difference of the first pulse signal and the second count difference of the second pulse signal;

基于所述第一计数差值和所述第二计数差值确定所述目标参数。The target parameter is determined based on the first count difference and the second count difference.

在本申请的一些实施例中,所述处理单元420更具体用于:In some embodiments of the present application, the processing unit 420 is more specifically used for:

在所述第一计数差值和所述第二计数差值的平均值等于预设计数差值的情况下,将所述最小参数和所述最大参数的平均值确定为所述目标参数。In the case that the average value of the first count difference value and the second count difference value is equal to the preset count difference value, the average value of the minimum parameter and the maximum parameter is determined as the target parameter.

在本申请的一些实施例中,所述处理单元420更具体用于:In some embodiments of the present application, the processing unit 420 is more specifically used for:

在所述第一计数差值和所述第二计数差值的平均值大于所述预设计数差值的情况下,将所述最小参数和所述最大参数的平均值加1确定为第一参数;When the average value of the first count difference value and the second count difference value is greater than the preset count difference value, adding 1 to the average value of the minimum parameter and the maximum parameter is determined as the first count parameter;

基于所述第一参数生成第三脉冲信号;generating a third pulse signal based on the first parameter;

获取所述第三脉冲信号的第三计数差值;acquiring a third count difference of the third pulse signal;

基于所述第三计数差值和所述第二计数差值确定所述目标参数。The target parameter is determined based on the third difference count value and the second difference count value.

在本申请的一些实施例中,所述处理单元420更具体用于:In some embodiments of the present application, the processing unit 420 is more specifically used for:

在所述第一计数差值和所述第二计数差值的平均值小于所述预设计数差值的情况下,将所述最小参数和所述最大参数的平均值减一确定为第二参数;In the case where the average value of the first count difference value and the second count difference value is smaller than the preset count difference value, subtract one from the average value of the minimum parameter and the maximum parameter to determine the second count. parameter;

基于所述第二参数生成第四脉冲信号;generating a fourth pulse signal based on the second parameter;

获取所述第四脉冲信号的第四计数差值;obtaining the fourth count difference of the fourth pulse signal;

基于所述第四计数差值和所述第一计数差值确定所述目标参数。The target parameter is determined based on the fourth count difference and the first count difference.

在本申请的一些实施例中,所述处理单元420具体用于:In some embodiments of the present application, the processing unit 420 is specifically configured to:

获取所述晶体410基于所述多个参数分别生成的多个脉冲信号;acquiring a plurality of pulse signals respectively generated by the crystal 410 based on the plurality of parameters;

获取所述多个脉冲信号对应的多个计数差值;acquiring multiple count differences corresponding to the multiple pulse signals;

利用二分法,获取所述多个计数差值中的与预设计数差值最接近的目标计数差值;Using the dichotomy method, obtain the target count difference value that is closest to the preset count difference value among the plurality of count difference values;

将所述目标计数差值对应的参数确定为所述目标参数。A parameter corresponding to the target count difference value is determined as the target parameter.

在本申请的一些实施例中,所述处理单元420还用于:In some embodiments of the present application, the processing unit 420 is further configured to:

按照升序或降序对所述多个计数差值进行排序。The plurality of count differences are sorted in ascending or descending order.

在本申请的一些实施例中,所述多个参数的参数数值随着脉冲信号的频率的增大而减小。In some embodiments of the present application, the parameter values of the plurality of parameters decrease as the frequency of the pulse signal increases.

在本申请的一些实施例中,所述多个参数的参数数值与脉冲信号的频率成反比。In some embodiments of the present application, the parameter values of the plurality of parameters are inversely proportional to the frequency of the pulse signal.

在本申请的一些实施例中,所述处理单元420具体用于:In some embodiments of the present application, the processing unit 420 is specifically configured to:

按照参数值升序或降序的顺序,依次获取至少一个脉冲信号的计数差值。According to the ascending or descending order of parameter values, the count difference value of at least one pulse signal is obtained in sequence.

在本申请的一些实施例中,所述芯片还包括:In some embodiments of the present application, the chip further includes:

通用串行总线USB转串口和通用异步收发传输器UART集线器HUB,所述USB转串口通过所述UART HUB连接至所述处理单元420,所述处理单元420通过所述USB转串口和所述UART HUB接收测试设备发送的校准信令,所述校准信令用于触发所述芯片进行晶体410校准。Universal serial bus USB to serial port and universal asynchronous transceiver UART hub HUB, the USB to serial port is connected to the processing unit 420 through the UART HUB, and the processing unit 420 passes the USB to serial port and the UART The HUB receives the calibration signaling sent by the test equipment, and the calibration signaling is used to trigger the chip to perform crystal 410 calibration.

在本申请的一些实施例中,所述校准信令包括所述多个参数。In some embodiments of the present application, the calibration signaling includes the plurality of parameters.

在本申请的一些实施例中,所述芯片还包括:In some embodiments of the present application, the chip further includes:

寄存器,所述处理单元420通过所述寄存器连接至所述晶体410,所述处理单元420用于将所述多个参数存储至寄存器,以便通过控制所述寄存器向所述晶体410发送所述多个参数。A register, the processing unit 420 is connected to the crystal 410 through the register, and the processing unit 420 is configured to store the plurality of parameters in the register, so as to send the plurality of parameters to the crystal 410 by controlling the register parameters.

在本申请的一些实施例中,所述处理单元420还用于将校准结果存储至所述寄存器,所述校准结果用于指示所述目标参数。In some embodiments of the present application, the processing unit 420 is further configured to store a calibration result in the register, where the calibration result is used to indicate the target parameter.

在本申请的一些实施例中,所述芯片还包括:In some embodiments of the present application, the chip further includes:

通用串行总线USB转串口和通用异步收发传输器UART集线器HUB,所述USB转串口通过所述UART HUB连接至所述处理单元420,所述处理单元420通过所述USB转串口和所述UART HUB向测试设备发送校准结果和/或所述至少一个脉冲信号的计数差值,所述校准结果用于指示所述目标参数,所述至少一个脉冲信号的计数差值用于所述测试设备在显示界面与预设计数差值进行比较。Universal serial bus USB to serial port and universal asynchronous transceiver UART hub HUB, the USB to serial port is connected to the processing unit 420 through the UART HUB, and the processing unit 420 passes the USB to serial port and the UART The HUB sends the calibration result and/or the count difference value of the at least one pulse signal to the test device, the calibration result is used to indicate the target parameter, and the count difference value of the at least one pulse signal is used by the test device in the The display interface compares with the preset count difference.

在本申请的一些实施例中,所述处理单元420具体用于:In some embodiments of the present application, the processing unit 420 is specifically configured to:

获取所述至少一个脉冲信号中每一个脉冲信号的多次计数差值;Acquiring multiple count differences of each pulse signal in the at least one pulse signal;

将所述至少一个脉冲信号中每一个脉冲信号的多次计数差值中的在时间上靠后的至少一次计数差值,确定为所述相应脉冲信号的计数差值。At least one count difference that is later in time among the multiple count differences of each pulse signal in the at least one pulse signal is determined as the count difference of the corresponding pulse signal.

在本申请的一些实施例中,所述处理单元420具体用于:In some embodiments of the present application, the processing unit 420 is specifically configured to:

接收利用已校准应用系统生成的所述参考脉冲信号。The reference pulse signal generated using the calibrated application system is received.

在本申请的一些实施例中,所述参考脉冲信号为脉冲宽度调制PWM信号。In some embodiments of the present application, the reference pulse signal is a pulse width modulated PWM signal.

在本申请的一些实施例中,所述芯片为蓝牙低功耗BLE芯片。In some embodiments of the present application, the chip is a Bluetooth low energy BLE chip.

另外,本申请还提供了一种蓝牙耳机,所述蓝牙耳机可包括上述芯片400。In addition, the present application also provides a Bluetooth headset, and the Bluetooth headset may include the above-mentioned chip 400 .

本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application.

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described systems, devices and units may refer to the corresponding processes in the foregoing method embodiments, which will not be repeated here.

在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.

所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。The functions, if implemented in the form of software functional units and sold or used as independent products, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence, or the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes .

以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应所述以权利要求的保护范围为准。The above are only specific embodiments of the present application, but the protection scope of the present application is not limited to this. should be covered within the scope of protection of this application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims (41)

1. A method of crystal alignment, adapted for use with a chip having a crystal, the method comprising:
obtaining a count difference of at least one pulse signal, the at least one pulse signal including a pulse signal generated by the crystal based on at least one parameter of a plurality of parameters, the count difference of each pulse signal of the at least one pulse signal being a difference between system tick count values based on the corresponding pulse signal obtained using two external interrupts triggered by a reference pulse signal;
determining a target parameter based on the count difference of the at least one pulse signal;
and determining the pulse signal generated based on the target parameter as the pulse signal after crystal calibration.
2. The method of claim 1, wherein obtaining a count difference for at least one pulse signal comprises:
and acquiring a counting difference value of the at least one pulse signal by utilizing a dichotomy.
3. The method of claim 2, wherein said obtaining a count difference of said at least one pulse signal using bisection comprises:
determining a minimum parameter and a maximum parameter of a plurality of parameters;
generating a first pulse signal and a second pulse signal based on the minimum parameter and the maximum parameter, respectively;
respectively acquiring a first counting difference value of the first pulse signal and a second counting difference value of the second pulse signal;
wherein determining a target parameter based on the count difference of the at least one pulse signal comprises:
determining the target parameter based on the first count difference and the second count difference.
4. The method of claim 3, wherein determining the target parameter based on the first count difference and the second count difference comprises:
determining the average value of the minimum parameter and the maximum parameter as the target parameter when the average value of the first count difference and the second count difference is equal to a preset count difference.
5. The method of claim 3 or 4, wherein said determining the target parameter based on the first count difference and the second count difference comprises:
determining the average value of the minimum parameter and the maximum parameter plus 1 as a first parameter when the average value of the first count difference and the second count difference is greater than the preset count difference;
generating a third pulse signal based on the first parameter;
acquiring a third count difference value of the third pulse signal;
determining the target parameter based on the third count difference and the second count difference.
6. The method of any of claims 3 to 5, wherein said determining the target parameter based on the first count difference and the second count difference comprises:
when the average value of the first counting difference value and the second counting difference value is smaller than the preset counting difference value, subtracting one from the average value of the minimum parameter and the maximum parameter to determine the average value as a second parameter;
generating a fourth pulse signal based on the second parameter;
acquiring a fourth count difference value of the fourth pulse signal;
determining the target parameter based on the fourth count difference and the first count difference.
7. The method of claim 1, wherein obtaining a count difference for at least one pulse signal comprises:
acquiring a plurality of pulse signals respectively generated by the crystal based on the parameters;
acquiring a plurality of counting difference values corresponding to the plurality of pulse signals;
wherein the determining a target parameter based on the count difference of the at least one pulse signal comprises:
obtaining a target counting difference value which is closest to a preset counting difference value in the plurality of counting difference values by utilizing a bisection method;
and determining the parameter corresponding to the target counting difference as the target parameter.
8. The method of claim 7, further comprising:
the plurality of count differences are sorted in ascending or descending order.
9. The method according to any one of claims 1 to 8, wherein the parameter values of the plurality of parameters decrease with increasing frequency of the pulse signal.
10. The method of claim 9, wherein the parameter values of the plurality of parameters are inversely proportional to the frequency of the pulse signal.
11. The method of claim 9, wherein obtaining a count difference for at least one pulse signal comprises:
and sequentially acquiring the counting difference value of at least one pulse signal according to the ascending or descending order of the parameter values.
12. The method according to any one of claims 1 to 11, further comprising:
and receiving a calibration signaling sent by the test equipment by using a Universal Serial Bus (USB) to serial port and a universal asynchronous receiving and transmitting transmitter (UART) HUB, wherein the calibration signaling is used for triggering the chip to carry out crystal calibration.
13. The method of claim 12, wherein the calibration signaling comprises the plurality of parameters.
14. The method according to any one of claims 1 to 13, further comprising:
storing the plurality of parameters to a register to send the plurality of parameters to the crystal by controlling the register.
15. The method of claim 14, further comprising:
storing a calibration result to the register, the calibration result indicating the target parameter.
16. The method according to any one of claims 1 to 15, further comprising:
and sending a calibration result and/or a counting difference value of the at least one pulse signal to the test equipment by utilizing a Universal Serial Bus (USB) to serial port and a universal asynchronous receiver-transmitter (UART) HUB (HUB), wherein the calibration result is used for indicating the target parameter, and the counting difference value of the at least one pulse signal is used for comparing the test equipment with a preset counting difference value on a display interface.
17. The method of any one of claims 1 to 16, wherein said obtaining a count difference of at least one pulse signal comprises:
acquiring a plurality of counting differences of each pulse signal in the at least one pulse signal;
determining at least one count difference value later in time of the plurality of count difference values of each of the at least one pulse signal as the count difference value of the corresponding pulse signal.
18. The method according to any one of claims 1 to 17, further comprising:
receiving the reference pulse signal generated with the calibrated application system.
19. The method according to any one of claims 1 to 18, wherein the reference pulse signal is a pulse width modulated, PWM, signal.
20. The method according to any one of claims 1 to 19, wherein the chip is a Bluetooth Low Energy (BLE) chip.
21. A chip, wherein the chip comprises:
a crystal for generating a plurality of pulse signals based on a plurality of parameters, respectively;
a processing unit coupled to the crystal, the processing unit to:
obtaining a count difference of at least one pulse signal, the at least one pulse signal including a pulse signal generated by the crystal based on at least one parameter of a plurality of parameters, the count difference of each pulse signal of the at least one pulse signal being a difference between system tick count values based on the corresponding pulse signal obtained using two external interrupts triggered by a reference pulse signal;
determining a target parameter based on the count difference of the at least one pulse signal;
and determining the pulse signal generated based on the target parameter as the pulse signal after crystal calibration.
22. The chip according to claim 21, wherein the processing unit is specifically configured to:
and acquiring a counting difference value of the at least one pulse signal by utilizing a dichotomy.
23. The chip according to claim 22, characterized in that said processing unit is more specifically configured to:
determining a minimum parameter and a maximum parameter of a plurality of parameters;
generating a first pulse signal and a second pulse signal based on the minimum parameter and the maximum parameter, respectively;
respectively acquiring a first counting difference value of the first pulse signal and a second counting difference value of the second pulse signal;
determining the target parameter based on the first count difference and the second count difference.
24. The chip according to claim 23, characterized in that said processing unit is more specifically configured to:
determining the average value of the minimum parameter and the maximum parameter as the target parameter when the average value of the first count difference and the second count difference is equal to a preset count difference.
25. The chip according to claim 23 or 24, characterized in that said processing unit is more specifically configured to:
determining the average value of the minimum parameter and the maximum parameter plus 1 as a first parameter when the average value of the first count difference and the second count difference is greater than the preset count difference;
generating a third pulse signal based on the first parameter;
acquiring a third count difference value of the third pulse signal;
determining the target parameter based on the third count difference and the second count difference.
26. The chip according to any of claims 23 to 25, characterized in that the processing unit is more specifically configured to:
when the average value of the first counting difference value and the second counting difference value is smaller than the preset counting difference value, subtracting one from the average value of the minimum parameter and the maximum parameter to determine the average value as a second parameter;
generating a fourth pulse signal based on the second parameter;
acquiring a fourth count difference value of the fourth pulse signal;
determining the target parameter based on the fourth count difference and the first count difference.
27. The chip according to claim 21, wherein the processing unit is specifically configured to:
acquiring a plurality of pulse signals respectively generated by the crystal based on the parameters;
acquiring a plurality of counting difference values corresponding to the plurality of pulse signals;
obtaining a target counting difference value which is closest to a preset counting difference value in the plurality of counting difference values by utilizing a bisection method;
and determining the parameter corresponding to the target counting difference as the target parameter.
28. The chip of claim 27, wherein the processing unit is further configured to:
the plurality of count differences are sorted in ascending or descending order.
29. The chip of any one of claims 21 to 28, wherein the parameter values of the plurality of parameters decrease with increasing frequency of the pulse signal.
30. The chip of claim 29, wherein the parameter values of the plurality of parameters are inversely proportional to the frequency of the pulse signal.
31. The chip of claim 29, wherein the processing unit is specifically configured to:
and sequentially acquiring the counting difference value of at least one pulse signal according to the ascending or descending order of the parameter values.
32. The chip of any one of claims 21 to 31, wherein the chip further comprises:
USB changes serial ports and universal asynchronous receiving and dispatching transmitter UART concentrator HUB, USB changes the serial ports and passes through the UART HUB is connected to processing unit, processing unit passes through USB changes the serial ports with the calibration signaling that test equipment sent is received to the UART HUB, the calibration signaling is used for triggering the chip carries out the crystal calibration.
33. The chip of claim 32, wherein the calibration signaling comprises the plurality of parameters.
34. The chip according to any one of claims 21 to 33, wherein the chip further comprises:
a register through which the processing unit is connected to the crystal, the processing unit to store the plurality of parameters to the register so as to send the plurality of parameters to the crystal by controlling the register.
35. The chip of claim 34, wherein the processing unit is further configured to store a calibration result to the register, the calibration result indicating the target parameter.
36. The chip according to any one of claims 21 to 35, wherein the chip further comprises:
USB changes serial ports and universal asynchronous receiving and dispatching transmitter UART concentrator HUB to universal serial bus USB, USB changes the serial ports to pass through UART HUB is connected to processing unit, processing unit passes through USB changes the serial ports with UART HUB sends calibration result and/or at least one pulse signal's count difference to test equipment, the calibration result is used for instructing target parameter, at least one pulse signal's count difference is used for test equipment is showing interface and is predetermineeing the count difference and compare.
37. The chip according to any one of claims 21 to 36, wherein the processing unit is specifically configured to:
acquiring a plurality of counting differences of each pulse signal in the at least one pulse signal;
determining at least one count difference value later in time of the plurality of count difference values of each of the at least one pulse signal as the count difference value of the corresponding pulse signal.
38. The chip according to any one of claims 21 to 37, wherein the processing unit is specifically configured to:
receiving the reference pulse signal generated with the calibrated application system.
39. The chip of any one of claims 21 to 38, wherein the reference pulse signal is a Pulse Width Modulated (PWM) signal.
40. The chip according to any one of claims 21 to 39, wherein the chip is a Bluetooth Low Energy (BLE) chip.
41. A bluetooth headset, comprising:
the chip of any one of claims 21 to 40.
CN202080001624.9A 2020-01-03 2020-01-03 Crystal calibration methods, chips and Bluetooth headsets Active CN111819787B (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/070263 WO2021134783A1 (en) 2020-01-03 2020-01-03 Crystal calibration method, chip and bluetooth earphone

Publications (2)

Publication Number Publication Date
CN111819787A true CN111819787A (en) 2020-10-23
CN111819787B CN111819787B (en) 2023-12-15

Family

ID=72860058

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202080001624.9A Active CN111819787B (en) 2020-01-03 2020-01-03 Crystal calibration methods, chips and Bluetooth headsets

Country Status (2)

Country Link
CN (1) CN111819787B (en)
WO (1) WO2021134783A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114460441A (en) * 2022-01-29 2022-05-10 珠海泰芯半导体有限公司 Chip calibration method, device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040068383A1 (en) * 2002-07-05 2004-04-08 Stmicroelectronics S.A. Method of operating a microcontroller chip having an internal RC oscillator and microcontroller chip embodying the method
US20090049326A1 (en) * 2007-08-14 2009-02-19 Samsung Electronics Co., Ltd. Clock signal generator for generating stable clock signal, semiconductor memory device including the same, and methods of operating
CN102207522A (en) * 2011-04-01 2011-10-05 广州润芯信息技术有限公司 Resistance capacitance (RC) constant measuring method based on frequency measurement
CN102819282A (en) * 2012-07-26 2012-12-12 大唐微电子技术有限公司 Clock recovery circuit device and corresponding method
CN104915305A (en) * 2014-03-11 2015-09-16 泰凌微电子(上海)有限公司 USB equipment chip and frequency calibration method thereof

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103176400B (en) * 2013-01-14 2015-08-26 杭州海兴电力科技股份有限公司 Intelligent ammeter clock calibration method
CN203759695U (en) * 2014-03-11 2014-08-06 泰凌微电子(上海)有限公司 USB chip

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040068383A1 (en) * 2002-07-05 2004-04-08 Stmicroelectronics S.A. Method of operating a microcontroller chip having an internal RC oscillator and microcontroller chip embodying the method
US20090049326A1 (en) * 2007-08-14 2009-02-19 Samsung Electronics Co., Ltd. Clock signal generator for generating stable clock signal, semiconductor memory device including the same, and methods of operating
CN102207522A (en) * 2011-04-01 2011-10-05 广州润芯信息技术有限公司 Resistance capacitance (RC) constant measuring method based on frequency measurement
CN102819282A (en) * 2012-07-26 2012-12-12 大唐微电子技术有限公司 Clock recovery circuit device and corresponding method
CN104915305A (en) * 2014-03-11 2015-09-16 泰凌微电子(上海)有限公司 USB equipment chip and frequency calibration method thereof

Also Published As

Publication number Publication date
CN111819787B (en) 2023-12-15
WO2021134783A1 (en) 2021-07-08

Similar Documents

Publication Publication Date Title
US7035750B2 (en) On-chip test mechanism for transceiver power amplifier and oscillator frequency
US9470759B2 (en) Test instrument having a configurable interface
US7020567B2 (en) System and method of measuring a signal propagation delay
US8058893B1 (en) Frequency trimming for internal oscillator for test-time reduction
US10198331B2 (en) Generic bit error rate analyzer for use with serial data links
US7219269B2 (en) Self-calibrating strobe signal generator
US20040153267A1 (en) System and method of testing a transceiver
CN114584228B (en) Wifi production test calibration system and method and electronic equipment
CN105874748A (en) System and method for testing data packet transceivers having varied performance characteristics and requirements using standard test equipment
CN111819787B (en) Crystal calibration methods, chips and Bluetooth headsets
CN104614659B (en) Automated test system and method
US20130259100A1 (en) Information processing apparatus, testing method, and computer-readable recording medium having stored therein testing program
US7969163B2 (en) Measuring signal propagation and adjustable delays in electronic devices
WO2025162885A1 (en) A global event monitoring unit for a system-on-chip (soc)
CN119355501B (en) Channel PI calibration device and test machine
US7886096B2 (en) Throughput measurement of a total number of data bits communicated during a communication period
CN111865441A (en) A packaged antenna measurement system, method and device
CN112946551B (en) Method and device for measuring path delay, electronic device and storage medium
TWI830662B (en) Logic device for monitoring power signal and method thereof
TWI504906B (en) Automated test system and method
CN217846554U (en) Time measuring device and system
EP4372553A1 (en) Enhancing processing speed of a remote controlled radio frequency test or measurement device
US9170602B1 (en) Calibrating a high-speed clock signal generated using a processor internal to the electronic authentication device without using a crystal oscillator
CN117761389A (en) Circuit board calibration method, device and storage medium
CN117805529A (en) A test system and test method for a spaceborne integrated electronic subsystem

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant