AD9371概念:
AD9371 是一款宽带射频 (RF) 收发器,提供了双通道发射器和接收器、集成的合成器和数字信号处理功能。 该元件系列提供 FDD 和 TDD 应用中的 3G/4G 微处理器和宏基站设备所需的高性能和低功耗的多功能组合。 AD9371 工作频率为 300 MHz 至 6 GHz,涵盖大部分需执照和免执照蜂窝频带。 该 IC 支持高达 100 MHz 的接收器带宽。 器件还支持观测接收器,发送合成带宽高达 250 MHz,可适应数字校正算法。
AD9371 包括宽带直接转换信号路径,具有最尖端的噪声系数和线性度。 每个完整的接收器和发射器子系统包括 DC 偏移校正、正交错误校正和可编程数字滤波器,因而无需在数字基带中使用这些功能。 集成的多个辅助功能,如辅助模数转换器 (ADC)、辅助数模转换器 (DAC) 和通用输入/输出 (GPIO) 可提供额外的监视和控制能力。
特性 | |
|
|
应用 | |
|
内核菜单栏配置:
Linux Kernel Configuration
Device Drivers --->
<*> Industrial I/O support --->
--- Industrial I/O support
-*- Enable ring buffer support within IIO
-*- Industrial I/O lock free software ring
-*- Enable triggered sampling support
*** Analog to digital converters ***
[--snip--]
-*- Analog Devices High-Speed AXI ADC driver core
< > Analog Devices AD9361, AD9364 RF Agile Transceiver driver
<*> Analog Devices AD9371 RF Transceiver driver
< > Analog Devices AD6676 Wideband IF Receiver driver
< > Analog Devices AD9467, AD9680, etc. high speed ADCs
< > Analog Devices Motor Control (AD-FMCMOTCON) drivers
< > Generic FFT driver
<*> Generic AXI JESD204B configuration driver
[--snip--]
Frequency Synthesizers DDS/PLL --->
Direct Digital Synthesis --->
<*> Analog Devices CoreFPGA AXI DDS driver
将内核固件"Mykonos_M3.bin"加入到内核配置菜单栏中
drive -->
Generic Driver Option--->
在内核源码中:/drive/iio/ad9371.c
其在内核初始化流程如下:
ad9371初始化
1. 从ad9371_probe开始执行
2. clk = devm_clk_get(&spi->dev, "jesd_rx_clk"); 获取jesd_rx_clk的结构体
3. indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*phy)); 分配IIO驱动资源
4. ret = ad9371_alloc_mykonos_device(phy); 分配9371 API参数内存
5. phy->pdata = ad9371_phy_parse_dt(indio_dev, &spi->dev); 设置9371 API默认参数,还未配到9371
6. phy->reset_gpio = devm_gpiod_get(&spi->dev, "reset", GPIOD_OUT_LOW); ad9371_reset(phy); 复位9371
7. phy->sysref_req_gpio = devm_gpiod_get(&spi->dev, "sysref_req", GPIOD_OUT_HIGH); sysref_req拉高
8. 初始化SPI接口参数
9. 如果有TX, phy->jesd_tx_clk = devm_clk_get(&spi->dev, "jesd_tx_clk"); 获取jesd_tx_clk的结构体
10. phy->jesd_rx_os_clk = devm_clk_get(&spi->dev, "jesd_rx_os_clk"); 获取jesd_rx_os_clk的结构体
11. phy->dev_clk = devm_clk_get(&spi->dev, "dev_clk"); 获取dev_clk的结构体
12. phy->fmc_clk = devm_clk_get(&spi->dev, "fmc_clk"); 获取fmc_clk的结构体
13. phy->sysref_dev_clk = devm_clk_get(&spi->dev, "sysref_dev_clk"); 获取sysref_dev_clk的结构体
14. phy->sysref_fmc_clk = devm_clk_get(&spi->dev, "sysref_fmc_clk"); 获取sysref_fmc_clk的结构体
15. ret = clk_prepare_enable(phy->fmc_clk); 打开fmc_clk时钟*****fpga device clk
16. ret = clk_prepare_enable(phy->dev_clk); 打开dev_clk时钟
17. ret = request_firmware(&phy->fw, FIRMWARE, &spi->dev); 加载固件文件
18. ret = ad9371_setup(phy); 配置9371
19. ad9371_clk_register(phy, "-rx_sampl_clk", NULL, NULL, CLK_GET_RATE_NOCACHE | CLK_IGNORE_UNUSED , RX_SAMPL_CLK); 注册rx_sampl_clk时钟
20. 生成配置接口文件profile_config
21. 生成配置接口文件gain_table_config
22. 注册IIO驱动
23. ret = ad9371_register_axi_converter(phy); ?
24. ret = ad9371_register_debugfs(indio_dev); 生成debugfs下的参数文件接口
ad9371_setup()
1. 获取dev_clk,fmc_clk,这两个必须相等
2. 如果rx使能,ad9371_set_jesd_lanerate()算rx lanerate,设置到phy->jesd_rx_clk
3. ret = ad9371_update_sysref(phy, lmfc); 计算LMFC,看是否和sysref匹配,判断fpga的sysref和9371的sysref是否一致
4. ret = ad9371_reset(phy); 复位9371
5. ret = MYKONOS_initialize(mykDevice);
5.1 /* Enable Reference clock - Set REFCLK pad common mode voltage */
CMB_SPIWriteByte(device->spiSettings, MYKONOS_ADDR_REF_PAD_CONFIG2, 0x07);
5.2 CMB_SPIWriteByte(device->spiSettings, MYKONOS_ADDR_SYSREF_PAD_CONFIG, 0x12); //Enable SYSREF input buffer
5.3 选择tx rx orx的SYNCB输入模式
5.4 /* Set number of device clock cycles per microsecond [round(freq/2) - 1] */
CMB_SPIWriteByte(device->spiSettings, MYKONOS_ADDR_REFERENCE_CLOCK_CYCLES, (uint8_t)((((device->clocks->deviceClock_kHz / 1000) + 1) >> 1) - 1));
5.5 /* Set profile specific digital clock dividers */
CMB_SPIWriteByte(device->spiSettings, MYKONOS_ADDR_CONFIGURATION_CONTROL_1, 0x04); /* Negate Rx2 so phase matches Rx1 */
5.6 计算TX RX通道参数
5.7 CMB_SPIWriteByte(device->spiSettings, MYKONOS_ADDR_CONFIGURATION_CONTROL_2, txChannelSettings);
CMB_SPIWriteByte(device->spiSettings, MYKONOS_ADDR_CONFIGURATION_CONTROL_4, rxChannelSettings); 设置rx tx参数
5.8 /* Set the CLKPLL with the frequency from the device data structure */
retVal = MYKONOS_initDigitalClocks(device);
6. ret = MYKONOS_checkPllsLockStatus(mykDevice, &pllLockStatus); CLKPLL Status Check
7. ret = MYKONOS_enableMultichipSync(mykDevice, 1, NULL); Perform MultiChip Sync (MCS) on Mykonos Device
8. ad9371_sysref_req(phy, SYSREF_PULSE);
9. ret = MYKONOS_enableMultichipSync(mykDevice, 0, &mcsStatus); 回读MCS的状态
10. MYKONOS_initArm(), Load Mykonos ARM
10.1 retVal = MYKONOS_setupJesd204bFramer(device); 配置204b framer
11. MYKONOS_loadArmFromBinary() 加载固件文件
12. Set RF PLL Frequencies
13. ret = ad9371_init_cal(phy, initCalMask); 校准
14. /**** Enable SYSREF to Mykonos JESD204B Framers ***/
/*** < User: Make sure SYSREF is stopped/disabled > ***/
/*** < User: make sure BBIC JESD is reset and ready to recieve CGS chars> ***/
ret = MYKONOS_enableSysrefToRxFramer(mykDevice, 1);
15. Enable SYSREF to Mykonos JESD204B Deframer
在应用层配置设置:
请参考:
AD9371配置设置https://wiki.analog.com/resources/tools-software/linux-drivers/iio-transceiver/ad9371