OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 4610|回复: 3

请问STM32F373系列的SDADC怎么设置采样速率?

[复制链接]

1

主题

1

帖子

0

精华

新手入门

积分
3
金钱
3
注册时间
2019-4-3
在线时间
0 小时
发表于 2019-4-3 19:24:28 | 显示全部楼层 |阅读模式
1金钱
目前楼主根据HAL库的官方例程配置好了单端零参考电压采集的程序,数据采集方式用的中断,从HAL_SDADC_InjectedConvCpltCallback里面读取函数的返回值。但是现在完全不知道中断的触发条件,所以也不知道数据采集的速率。SDADC如果想要改变采样速率,应该修改哪些配置啊?

正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

530

主题

11万

帖子

34

精华

管理员

Rank: 12Rank: 12Rank: 12

积分
165537
金钱
165537
注册时间
2010-12-1
在线时间
2117 小时
发表于 2019-4-4 02:12:50 | 显示全部楼层
回复

使用道具 举报

0

主题

23

帖子

0

精华

初级会员

Rank: 2

积分
51
金钱
51
注册时间
2019-4-9
在线时间
7 小时
发表于 2019-4-12 10:07:38 | 显示全部楼层
Enable the SDADC analog interface by calling
        PWR_SDADCAnalogCmd(PWR_SDADCAnalog_x, Enable);
    (#) Enable the SDADC APB clock to get write access to SDADC registers using
        RCC_APB1PeriphClockCmd() function
        e.g.  To enable access to SDADC1 registers use
        RCC_APB1PeriphClockCmd(RCC_APB1Periph_SDADC1, ENABLE);
    (#) The SDADCs are clocked by APB1.
        In order to get the SDADC running at the typical frequency (6 MHz
        in fast mode), use SDADC prescaler by calling RCC_SDADCCLKConfig() function
        e.g. if APB1 is clocked at 72MHz, to get the SDADC running at 6MHz
        configure the SDADC prescaler at 12 by calling
        RCC_SDADCCLKConfig(RCC_SDADCCLK_SYSCLK_Div12);
    (#) If required, perform the following configurations:
        (++) Select the reference voltage using SDADC_VREFSelect() function
        (++) Enable the power-down and standby modes using SDADC_PowerDownCmd()
             and SDADC_StandbyCmd() functions respectively
        (++) Enable the slow clock mode (SDADC running at 1.5 MHz) using
             RCC_SDADCCLKConfig() and SDADC_SlowClockCmd() function
             -@@- These configurations are allowed only when the SDADC is disabled.
    (#) Enable the SDADC peripheral using SDADC_Cmd() function.
    (#) Enter initialization mode using SDADC_InitModeCmd() function
        then wait for INITRDY flag to be set to confirm that the SDADC
        is in initialization mode.
    (#) Configure the analog inputs: gain, single ended mode, offset value and
        commmon mode using SDADC_AINInit().
        There are three possible configuration: SDADC_Conf_0, SDADC_Conf_1 and SDADC_Conf_2
    (#) Associate the selected configuration to the channel using SDADC_ChannelConfig()
    (#) For Regular channels group configuration
        (++) use SDADC_Init() function to select the SDADC channel to be used
             for regular conversion, the continuous mode...
             -@@- Only software trigger or synchro with SDADC1 are possible
                  for regular conversion
    (#) For Injected channels group configuration
        (++) Select the SDADC channel to be used for injected conversion
             using SDADC_InjectedChannelSelect()
        (++) Select the external trigger SDADC_ExternalTrigInjectedConvConfig()
             and the edge (rising, falling or both) using
             SDADC_ExternalTrigInjectedConvEdgeConfig()
             -@@- Software trigger and synchro with SDADC1 are possible
    (#)  Exit initialization mode using SDADC_InitModeCmd() function

这是标准库里关于设置SDADC时钟的描述,HAL库应该有类似的函数
回复

使用道具 举报

2

主题

23

帖子

0

精华

初级会员

Rank: 2

积分
95
金钱
95
注册时间
2020-3-24
在线时间
19 小时
发表于 2020-11-20 13:26:48 | 显示全部楼层
同求交流啊
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-6-15 04:01

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表