您的位置:首页 > 房产 > 家装 > 客服电话人工服务_企业网app下载_广告策划书_天机seo

客服电话人工服务_企业网app下载_广告策划书_天机seo

2024/10/30 21:31:11 来源:https://blog.csdn.net/So_shine/article/details/143258222  浏览:    关键词:客服电话人工服务_企业网app下载_广告策划书_天机seo
客服电话人工服务_企业网app下载_广告策划书_天机seo

目录

    • 前言
    • 一、依赖文档、工具
    • 二、运行linux内核驱动的平台
      • 1、代码、文件列表
      • 2、适配、编译
      • 3、调试
    • 三、无os的mcu平台
      • 1、代码、文件列表
      • 2、适配、编译
      • 3、调试

前言

本笔记基于运行linux操作系统的SOC芯片平台、linux内核版本linux5.10.xxx和无操作系统的mcu平台记录调试;

一、依赖文档、工具

文档名说明获取方式
hmc7044.pdf数据手册adi官网或者国内采芯网
GUI配置工具通过在界面进行操作可以导出寄存器和寄存器值配置对文档用于代码中进行配置参考adi官网

二、运行linux内核驱动的平台

1、代码、文件列表

文件名说明获取链接
hmc7044.c驱动文件https://github.com/analogdevicesinc/linux/blob/master/drivers/iio/frequency/hmc7044.c
hmc7044.h驱动头文件https://github.com/analogdevicesinc/linux/blob/master/include/dt-bindings/iio/frequency/hmc7044.h
hmc7044.txt设备树属性配置说明文档,可以和GUI中的配置项说明配合理解https://github.com/analogdevicesinc/linux/blob/master/Documentation/devicetree/bindings/iio/frequency/hmc7044.txt

2、适配、编译

1.将hmc7044.c 添加到自己的linux版本sdk的drivers/iio/frequency/目录下;
2.将hmc7044.h 添加到自己的linux版本sdk的include/dt-bindings/iio/frequency/目录下;
3.修改linux内核代码的配置文件添加CONFIG_HMC7044=m,这里配置为生成内核模块的方式;

4.修改hmc7044.c同级目录下的Kconfig文件添加如下内容:
config HMC7044
tristate “Analog Devices HMC7044, HMC7043 Clock Jitter Attenuator with JESD204B”
depends on SPI
depends on COMMON_CLK
help
Say yes here to build support for Analog Devices HMC7044, HMC7043
Clock Jitter Attenuator with JESD204B.
The driver provides direct access via sysfs.
To compile this driver as a module, choose M here: the
module will be called hmc7044.

5.修改hmc7044.c 同级目录下的Makefile文件增加如下内容:
obj-$(CONFIG_HMC7044) += hmc7044.o
6.修改设备树文件,配置spi使用的pin脚,hmc7044使用的是三线spi,这里我配置成了普通的gpio,在hmc7044中使用io模拟spi三线的的方式读写hmc7044:
&引脚配置控制器{
片选 {
};
时钟 {
};
数据线 {
};
};

7.修改设备树文件,spi节点下增加hmc7044子节点和配置,配置为参考配置具体以实际设计需求为准:

&spiXXX
{pinctrl-0 = <引用片选>,<引用时钟>,<引用数据线>;hmc7044: hmc7044@0 {compatible = "adi,hmc7044";reg = <0>;spi-max-frequency = <10000000>;adi,pll1-clkin-frequencies = <122880000 0 0 0>;adi,pll1-loop-bandwidth = <200>;//gpio属性定义spics = <引用引脚>;spiclk = <引用引脚>;spidata = <引用引脚>;adi,vcxo-frequency = <122880000>;adi,pll2-output-frequency = <2949120000>;adi,sysref-timer-divider = <1024>;adi,pulse-generator-mode = <0>;adi,clkin0-buffer-mode = <0x15>;adi,oscin-buffer-mode = <0x15>;adi,gpi-controls = <0x00 0x00 0x00 0x00>;adi,gpo-controls = <0x1f 0x2b 0x00 0x00>;clock-output-names = "hmc7044_out0", "hmc7044_out1", "hmc7044_out2","hmc7044_out3", "hmc7044_out4", "hmc7044_out5","hmc7044_out6", "hmc7044_out7", "hmc7044_out8","hmc7044_out9", "hmc7044_out10", "hmc7044_out11","hmc7044_out12", "hmc7044_out13";hmc7044_c2: channel@2 {reg = <2>;adi,extended-name = "DAC_CLK";adi,divider = <1>;adi,driver-mode = <1>;};hmc7044_c3: channel@3 {reg = <3>;adi,extended-name = "DAC_SYSREF";adi,divider = <512>;adi,driver-mode = <1>;};hmc7044_c12: channel@12 {reg = <12>;adi,extended-name = "FPGA_CLK";adi,divider = <8>;adi,driver-mode = <2>;};hmc7044_c13: channel@13 {reg = <13>;adi,extended-name = "FPGA_SYSREF";adi,divider = <512>;adi,driver-mode = <2>;};};
};`

8.修改hmc7044.c:
修改hmc7044_probe函数对设备树中的gpio进行请求、设置初始化方向;
修改hmc7044_write函数使用gpio模式实现芯片的写时序;
修改hmc7044_read函数使用gpio模式实现芯片的读时序;

9.以上文件修改后编译内核;

3、调试

编译后生成hmc7044.ko文件,导入到嵌入式板卡中insmod hmc7044.ko进行调试,其中hmc7044_read_write_check函数会使用一个寄存器将0xAD写入再读出判断spi读写是否正常;
测量芯片输出时钟是否正常等;

三、无os的mcu平台

1、代码、文件列表

文件名说明获取链接
hmc7044.c驱动文件https://github.com/analogdevicesinc/no-OS/blob/main/drivers/frequency/hmc7044/hmc7044.c
hmc7044.h驱动头文件https://github.com/analogdevicesinc/no-OS/blob/main/drivers/frequency/hmc7044/hmc7044.h

2、适配、编译

1、struct no_os_spi_init_param结构,配置参考如下:

struct no_os_spi_init_param hmc7044_spi_param = {.device_id = SPI_DEVICE_ID,  //板卡上自定义的id.max_speed_hz = 10000000, //spi最大速率.mode = NO_OS_SPI_MODE_0, //spi模式0.chip_select = SPI_HMC7044_CS,  //板卡上自定义的第几个片选.platform_ops = &stm32_xspi_ops,  //以stm32 MCU为例.no_os_spi_lanes = NO_OS_SPI_SINGLE_LANE, //单数据线,半双工读写};

2、struct hmc7044_chan_spec 结构,配置参考如下:

struct hmc7044_chan_spec chan_spec[4] = {{.disable = 0, .num = 2, .divider = 8, .driver_mode = 1},		//使能,2通道,8分频,LVPECL电平{.disable = 0, .num = 3, .divider = 512, .driver_mode = 1},		//使能,3通道,512分频,LVPECL电平{.disable = 0, .num = 12, .divider = 8, .driver_mode = 2},	//使能,12通道,8分频,LVDS电平{.disable = 0, .num = 13, .divider = 512, .driver_mode = 2},	//使能,13通道,512分频,LVDS电平};

3、struct hmc7044_init_param 结构,配置参考如下:

struct hmc7044_init_param hmc7044_param = {.spi_init = &hmc7044_spi_param,.clkin_freq = {122880000, 0, 0, 0},  //给clkin0  输入122.88Mhz,其它通道不输入.vcxo_freq = 122880000, //vcxo输入122.88Mhz.pll2_freq = 2949120000,.pll1_loop_bw = 200,.sysref_timer_div = 1024, //sysref timer 分频.pulse_gen_mode = 4,  //sysref产生8个脉冲.in_buf_mode = {0x15, 0, 0, 0, 0x15},//配置ckin0~ckin3,oscin输入时钟的模式.gpi_ctrl = {0x00, 0x00, 0x00, 0x00},  //四个gpio输入功能关闭.gpo_ctrl = {0x1f, 0x2b, 0x00, 0x00},  //四个gpio前两个配置输出.num_channels = 4, //使用四个通道.channels = chan_spec, //引用每个通道的具体配置};

3、调试

编译后生成执行文件下载到MCU中,运行程序看串口打印,其中hmc7044_read_write_check函数会使用一个寄存器将0xAD写入再读出判断spi读写是否正常;
测量芯片输出时钟是否正常等;

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com