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

2019-07-20 02:37发布

目前楼主根据HAL库的官方例程配置好了单端零参考电压采集的程序,数据采集方式用的中断,从HAL_SDADC_InjectedConvCpltCallback里面读取函数的返回值。但是现在完全不知道中断的触发条件,所以也不知道数据采集的速率。SDADC如果想要改变采样速率,应该修改哪些配置啊?
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
2条回答
otto1230
2019-07-20 08:42
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库应该有类似的函数

一周热门 更多>