Main Content

Migrate From STM32F4-Discovery Library to STM32F4xx Based Boards Library Analog to Digital Converter Block Usage

When you migrate from STM32F4-Discovery Analog to Digital Converter block usage to using an STM32F4xx Based Boards Analog to Digital Converter block usage, use this workflow.

These example steps show the process for migrating from the STM32F-Discovery library Analog to Digital Converter block to the STM32F4xx Based Boards library Analog to Digital Converter block:

  1. Open the Simulink model in which you are migrating block usage.

  2. From Configuration Parameters > Hardware Implementation > Hardware board selection is STM32F4-Discovery.

    Hardware board selection is STM32F4-Discovery

  3. Change Hardware board selection to STM32F4xx Based. After the dialog box updates to match this selection, From Target hardware resources > Build options, use the Browse or Create buttons to select an STM32CubMX project file.

    Hardware board selection is STM32F4xx Based

  4. In the Simulink model, replace the Analog to Digital Converter block from the STM32F4-Discovery library with an Analog to Digital Converter block from the STM32F4xx Based Boards library. Before replacing the block, note the ADC module, ADC conversion group, Block configuration, Block action, and other settings in the block parameters dialog box. Apply the corresponding settings to the replacement block.

  5. Use the ADC module block parameter selection from the STM32F4-Discovery block for the ADC module block parameter selection of the STM32F4xx processor boards block.

  6. Use the ADC conversion group block parameter selection from the STM32F4-Discovery block as the selection for the Conversion group block parameter selection of the STM32F4xx processor boards block. The selection of the ADC conversion group or Conversion group parameter configures features that are available in the dialog box. When the conversion group is set to Injected group, use the guidance in the table.

    STM32F4-Discovery block parameter configuration Migrate to STM32F4xx processor boards block parameter configuration
    When the ADC conversion group block parameter selection is set to Injected group, the Block configuration is set to Software start of conversion, and the Block action is set to Trigger, wait and read results . . .Set the Conversion group to Injected and the Trigger mode to Trigger and read. (See Migrate STM32F4-Discovery (Injected group, Trigger wait and read results) to STM32F4xx processor.)
    When the ADC conversion group block parameter selection is set to Injected group, the Block configuration is set to Software start of conversion, and the Block action is set to Trigger via input port . . .Set the Conversion group to Injected and the Trigger mode to Trigger only.(See Migrate STM32F4-Discovery (Injected group, Trigger via input port) to STM32F4xx processor.)
    When the ADC conversion group block parameter selection is set to Injected group, the Block configuration is set to Trigger start of conversion after regular group (JAUTO), and the Block action is set to Read results . . .Set the Conversion group to Injected and the Trigger mode to Read results only. (See Migrate STM32F4-Discovery (Injected group, Read result) to STM32F4xx processor.)
    When the ADC conversion group block parameter selection is set to Injected group, the Block configuration is set to Only read results, and the Block action is set to Read results . . .Set the Conversion group to Injected and the Trigger mode to Read results only. (See Migrate STM32F4-Discovery (Injected group, Read result) to STM32F4xx processor.)
    When the ADC conversion group block parameter selection is set to Injected group, the Block configuration is set to External start of conversion, and the Block action is set to Read results . . .

    Set the Conversion group to Injected and the Trigger mode to Read results only.

    For this configuration of the STM32F4-Discovery block, the Injected group selections for External trigger event selection and External trigger event configuration are migrated to settings in the CubeMX configuration for the STM32F4xx processor boards block as shown in ADC1 Mode and Configuration Parameter Settings ADC Injected Conversion Mode for Conversion group to Injected and Block configuration to External start of conversion.

    Migrate STM32F4-Discovery (Injected group, Trigger wait and read results) to STM32F4xx processor

    Migrate STM32F4-Discovery (Injected group, Trigger via input port) to STM32F4xx processor

    Migrate STM32F4-Discovery (Injected group, Read result) to STM32F4xx processor

    ADC1 Mode and Configuration Parameter Settings ADC Injected Conversion Mode for Conversion group to Injected and Block configuration to External start of conversion

    ADC1 Mode and Configuration Parameter Settings ADC Injected Conversion Mode for Conversion group to Injected and Block configuration to External start of conversion

  7. Use the ADC conversion group block parameter selection from the STM32F4-Discovery block for the Conversion group block parameter selection of the STM32F4xx processor boards block. The selection of the ADC conversion group or Conversion group parameter configures features that are available in the dialog box. When the conversion group is set to Regular group, use the guidance in the table.

    STM32F4-Discovery block parameter configuration Migrate to STM32F4xx processor boards block parameter configuration
    When the ADC conversion group block parameter selection is set to Regular group, the Block configuration is set to Software start of conversion, and the Block action is set to Trigger, wait and read results . . .

    Set the Conversion group to Regular and the Trigger mode to Trigger and read.

    For this configuration of the STM32F4-Discovery block, the Regular group selections for Enable continuous conversion and Enable EOC signal at the end of each channel conversion are migrated to settings in the CubeMX configuration for the STM32F4xx processor boards block as shown in Migrate STM32F4-Discovery (Regular group, Trigger, wait, and read result) to CubeMX for STM32F4xx processor and ADC1 Mode and Configuration Parameter Settings ADC_Settings for Conversion group to Regular and Block configuration to Software start of conversion.

    When the ADC conversion group block parameter selection is set to Regular group, the Block configuration is set to Software start of conversion, and the Block action is set to Trigger via input port;

    Set the Conversion group to Regular and the Trigger mode to Trigger only.

    For this configuration of the STM32F4-Discovery block, the Regular group selections for Enable continuous conversion and Enable EOC signal at the end of each channel conversion are migrated to settings in the CubeMX configuration for the STM32F4xx processor boards block as shown in Migrate STM32F4-Discovery (Regular group, Trigger, wait, and read result) to CubeMX for STM32F4xx processor and ADC1 Mode and Configuration Parameter Settings ADC_Settings for Conversion group to Regular and Block configuration to Software start of conversion.

    When the ADC conversion group block parameter selection is set to Regular group, the Block configuration is set to External start of conversion, and the Block action is set to Read results . . .

    Set the Conversion group to Regular and the Trigger mode to Read result only.

    For this configuration of the STM32F4-Discovery block, the Regular group selections for External trigger event selection and External trigger event configuration are migrated to settings in the CubeMX configuration for the STM32F4xx processor boards block as shown in Migrate STM32F4-Discovery (Regular group, Read result) to CubeMX for STM32F4xx processor and ADC1 Mode and Configuration Parameter Settings ADC_Settings for Conversion group to Regular and Block configuration to External start of conversion.

    Migrate STM32F4-Discovery (Regular group, Trigger, wait, and read result) to CubeMX for STM32F4xx processor

    Migrate STM32F4-Discovery (Regular group, Trigger, wait, and read result) to CubeMX for STM32F4xx processor

    ADC1 Mode and Configuration Parameter Settings ADC_Settings for Conversion group to Regular and Block configuration to Software start of conversion

    ADC1 Mode and Configuration Parameter Settings ADC_Settings for Conversion group to Regular and Block configuration to Software start of conversion

    Migrate STM32F4-Discovery (Regular group, Read result) to CubeMX for STM32F4xx processor

    Migrate STM32F4-Discovery (Regular group, Read result) to CubeMX for STM32F4xx processor

    ADC1 Mode and Configuration Parameter Settings ADC_Settings for Conversion group to Regular and Block configuration to External start of conversion

    ADC1 Mode and Configuration Parameter Settings ADC_Settings for Conversion group to Regular and Block configuration to External start of conversion

  8. Migrate the Number of channels to be converted and 1st Conversion block parameter selection values on the Channel Selection tab from the STM32F4-Discovery block to settings in the CubeMX configuration for the STM32F4xx processor boards block as shown in ADC1 Mode and Configuration Parameter Settings ADC_Settings for Channel Selection tab.

    ADC1 Mode and Configuration Parameter Settings ADC_Settings for Channel Selection tab

    ADC1 Mode and Configuration Parameter Settings ADC_Settings for Channel Selection tab

  9. Migrate the Post over run interrupt, Post watchdog interrupt, and Post end of conversion interrupt block parameter selection values on the Interrupts and Status flags tab from the STM32F4-Discovery block to settings in model Configuration Parameters > Hardware Implementation > Hardware board (STM32F4xx processor boards) > Target hardware resources > ADC1. Use the guidance in the table.

    STM32F4-Discovery block parameter configuration Migrate to STM32F4xx processor boards model configuration parameter
    Post over run interrupt Enable Overrun interrupt
    Post watchdog interrupt Watchdog interrupt is enabled (selection disabled in dialog box; see step later in this procedure)
    Post end of conversion interrupt Enable injected EoCS interrupt or Enable Regular EoCS interrupt (depends on conversion group selection)
  10. Migrate the Status flags block parameter selection values on the Interrupts and Status flags tab from the STM32F4-Discovery block to the Output status setting in the STM32F4xx processor boards block parameter value. If any of the STM32F4-Discovery block status parameters are enabled, enable the Output status parameter.

  11. Migrate the Configuration Parameters > Hardware Implementation > Hardware board > ADC1 > Enable watchdog on regular channels or Enable watchdog on injected channels value to the CubeMX configuration for the STM32F4xx processor boards block as shown in ADC1 Mode and Configuration Parameter Settings ADC_Settings for Enable watchdog.

ADC1 Mode and Configuration Parameter Settings ADC_Settings for Enable watchdog

ADC1 Mode and Configuration Parameter Settings ADC_Settings for Enable watchdog

See Also

Topics