STM32开发笔记92: SX1268驱动程序设计(时钟)

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/qingwufeiyang12346/article/details/100549740

单片机型号:STM32L053R8T6


本系列开发日志,将详述SX1268驱动程序的整个设计过程,本篇介绍时钟的相关内容。

一、RC频率参考

Two RC oscillators are available: 64 kHz and 13 MHz RC oscillators. The 64 kHz RC oscillator (RC64k) is optionally used by the circuit in SLEEP mode to wake-up the transceiver when performing periodic or duty cycled operations. Several commands make use of this 64 kHz RC oscillator (called RTC across this document) to generate time-based events. The 13 MHz RC oscillator (RC13M) is enabled for all SPI communication to permit configuration of the device without the need to start the crystal oscillator. Both RC oscillators are supplied directly from the battery.(两个RC振荡器可用:64 kHz和13 MHzRC振荡器。RC64k用于睡眠模式周期性唤醒。有几个命令使用这个64 kHz RC振荡器(在本文档中称为RTC)来生成基于时间的事件。RC13M支持所有SPI通信,无需启动晶体振荡器即可配置设备。两个RC振荡器都由电池供给电源。

二、高精度频率参考

In SX1268 the high-precision frequency reference can come either from an on-chip crystal oscillator (OSC) using an external crystal resonator or from an external TCXO (Temperature Compensated Crystal Oscillator), supplied by an internal regulator.(在SX1268中,高精度的频率基准可以来自使用外部晶体谐振器的片上晶体振荡器(OSC),也可以来自由内部调节器提供的外部TCXO(温度补偿晶体振荡器)。

The SX1268 comes in a small form factor 4 x 4 mm QFN package with the ability to transmit up to +22 dBm. When in transmit mode the circuit may heat up depending on the output power and current consumption. Careful PCB design using thermal isolation techniques must be applied between the circuit and the crystal resonator to avoid transferring the heat to the external crystal resonator.(SX1268为4*4mm QFN封装,但可以发射22dBm能量。当处于发射模式时,电路会发热,其依靠于输出电源和电流损耗。在电路和晶体谐振器之间必须使用热隔离技术进行仔细的PCB设计,以避免将热量转移到外部晶体谐振器。

三、XTAL控制模块

The SX1268 does not require the user to set external foot capacitors on the XTAL supplying the 32 MHz clock. Indeed, the device is fitted with internal programmable capacitors connected independently to the pins XTA and XTB of the device.Each capacitor can be set independently, balanced or unbalanced to each other, by 0.47 pF typical steps.(SX1268晶振不需外部电容,内部配有0.47pF增量的可调电容

四、TCXO控制模块

Under certain circumstances, typically small form factor designs with reduced heat dissipation or environments with extreme temperature variation, it may be required to use a TCXO (Temperature Compensated Crystal Oscillator) to achieve better frequency accuracy.(某些情况下,由于体积小和极端散热,所以需要使用TCXO以获得较好的频率精度

A complete Reset of the chip as described in Section 8.1 "Reset" on page 48 is required to get back to normal XOSC operation, after the chip has been set to TCXO mode with the command SetDIO3AsTCXOCtrl.(在使用SetDIO3AsTCXOCtrl命令将芯片设置为TCXO模式后,需要按照第48页8.1节“Reset”所述对芯片进行完全复位,才能恢复正常的XOSC操作。

五、PLL

A fractional-N third order sigma-delta PLL acts as the frequency synthesizer for the LO of both receiver and transmitter chains. SX1268 is able to cover continuously all the sub-GHz frequency range 410 MHz to 810 MHz. The PLL is capable of auto-calibration and has low switching-on or hopping times. Frequency modulation is performed inside the PLL bandwidth. The PLL frequency is derived from the crystal oscillator circuit which uses an external 32 MHz crystal reference.(SX1268可覆盖410MHz-810MHz频率。PLL可以自动校准,开关和调频时间较短,频率调制是在锁相环带宽内进行的。锁相环的频率来源于晶体振荡器电路,该电路使用一个外部的32mhz晶体基准。

六、E22-400M22S

E22-400M22S内部使用DIO3为TCXO供电,应调用SetDIO3asTCXOCtrl命令,使能后方可给有源晶振供电。

七、SetDIO3AsTCXOCtrl函数

八、校准

九、程序实现

typedef enum
{
    TCXO_CTRL_1_6V                          = 0x00,
    TCXO_CTRL_1_7V                          = 0x01,
    TCXO_CTRL_1_8V                          = 0x02,
    TCXO_CTRL_2_2V                          = 0x03,
    TCXO_CTRL_2_4V                          = 0x04,
    TCXO_CTRL_2_7V                          = 0x05,
    TCXO_CTRL_3_0V                          = 0x06,
    TCXO_CTRL_3_3V                          = 0x07,
}RadioTcxoCtrlVoltage_t;

typedef union
{
    struct
    {
        uint8_t RC64KEnable    : 1;                             //!< Calibrate RC64K clock
        uint8_t RC13MEnable    : 1;                             //!< Calibrate RC13M clock
        uint8_t PLLEnable      : 1;                             //!< Calibrate PLL
        uint8_t ADCPulseEnable : 1;                             //!< Calibrate ADC Pulse
        uint8_t ADCBulkNEnable : 1;                             //!< Calibrate ADC bulkN
        uint8_t ADCBulkPEnable : 1;                             //!< Calibrate ADC bulkP
        uint8_t ImgEnable      : 1;
        uint8_t                : 1;
    }Fields;
    uint8_t Value;
}CalibrationParams_t;
void SX126xSetDio3AsTcxoCtrl(RadioTcxoCtrlVoltage_t tcxoVoltage, uint32_t timeout);	
void SX126xCalibrate(CalibrationParams_t calibParam);	
void CSX1268::SX126xSetDio3AsTcxoCtrl(RadioTcxoCtrlVoltage_t tcxoVoltage, uint32_t timeout)
{
	uint8_t buf[4];

	buf[0] = tcxoVoltage & 0x07;
	buf[1] = (uint8_t)((timeout >> 16) & 0xFF);
	buf[2] = (uint8_t)((timeout >> 8) & 0xFF);
	buf[3] = (uint8_t)(timeout & 0xFF);

	SX126xWriteCommand(RADIO_SET_TCXOMODE, buf, 4);
}

void CSX1268::SX126xCalibrate(CalibrationParams_t calibParam)
{
	SX126xWriteCommand(RADIO_CALIBRATE, ( uint8_t* )&calibParam, 1);
}

 

 

 

原创性文章,转载请注明出处CSDN:http://blog.csdn.net/qingwufeiyang12346

 

 

猜你喜欢

转载自blog.csdn.net/qingwufeiyang12346/article/details/100549740