AT32F435/437固件库BSP&Pack应用指南
2022.11.15 第 1 页 版本 2.0.4
应用指南
AT32F435/437固件库BSP&Pack应用指南
前言
这篇应用指南对如何使用AT32F435/437固件库BSP(Board Support Package)以及如何安装AT32
Pack进行了简单的描述,对用户起到引导性的作用。
AT32F435/437固件库BSP&Pack应用指南
2022.11.15 第 2 页 版本 2.0.4
目录
简介 ........................................................................................................................ 50
Pack 安装步骤 ....................................................................................................... 51
IAR Pack 安装 ........................................................................................................ 51
Keil_v5 Pack 安装 ................................................................................................... 53
Keil_v4 Pack 安装 ................................................................................................... 54
Segger Pack 安装 ................................................................................................... 57
Flash 算法文件说明 ............................................................................................... 61
Keil 算法文件的使用方法 ........................................................................................ 61
IAR 算法文件的使用方法 ........................................................................................ 63
BSP 使用简述 ........................................................................................................ 67
BSP 快速使用 ......................................................................................................... 67
模板工程介绍 .............................................................................................................. 67
BSP 相关宏定义 ......................................................................................................... 68
BSP 规范 ................................................................................................................ 69
外设缩写 ..................................................................................................................... 69
命名规则 ..................................................................................................................... 70
编码规则 ..................................................................................................................... 70
BSP 结构 ................................................................................................................ 73
BSP 文件夹结构 ......................................................................................................... 73
BSP 库函数文件描述 .................................................................................................. 74
外设初始化和设置 ....................................................................................................... 75
外设库函数格式 .......................................................................................................... 75
AT32F435/437 外设库函数概述 ............................................................................. 76
HICK 自动时钟校准(ACC) .................................................................................. 76
函数 acc_calibration_mode_enable ........................................................................... 76
AT32F435/437固件库BSP&Pack应用指南
2022.11.15 第 3 页 版本 2.0.4
函数 acc_step_set ...................................................................................................... 77
函数 acc_interrupt_enable ......................................................................................... 78
函数 acc_hicktrim_get ................................................................................................ 78
函数 acc_hickcal_get .................................................................................................. 79
函数 acc_write_c1 ...................................................................................................... 79
函数 acc_write_c2 ...................................................................................................... 79
函数 acc_write_c3 ...................................................................................................... 80
函数 acc_read_c1 ....................................................................................................... 80
函数 acc_read_c2 ....................................................................................................... 81
函数 acc_read_c3 ....................................................................................................... 81
函数 acc_flag_get ....................................................................................................... 82
函数 acc_flag_clear .................................................................................................... 82
模拟数字/转换器(ADC) ....................................................................................... 83
函数 adc_reset............................................................................................................ 85
函数 adc_enable ......................................................................................................... 85
函数 adc_base_default_para_init ............................................................................... 86
函数 adc_base_config ................................................................................................ 86
函数 adc_common_default_para_init ......................................................................... 87
函数 adc_common_config .......................................................................................... 88
函数 adc_resolution_set ............................................................................................. 90
函数 adc_voltage_battery_enable .............................................................................. 91
函数 adc_dma_mode_enable .................................................................................... 91
函数 adc_dma_request_repeat_enable ..................................................................... 92
函数 adc_interrupt_enable ......................................................................................... 92
函数 adc_calibration_value_set ................................................................................. 93
函数 adc_calibration_init ............................................................................................ 93
函数 adc_calibration_init_status_get ......................................................................... 94
函数 adc_calibration_start .......................................................................................... 94
函数 adc_calibration_status_get ................................................................................ 95
函数 adc_voltage_monitor_enable ............................................................................. 95
函数 adc_voltage_monitor_threshold_value_set ....................................................... 96
AT32F435/437固件库BSP&Pack应用指南
2022.11.15 第 4 页 版本 2.0.4
函数 adc_voltage_monitor_single_channel_select .................................................... 96
函数 adc_ordinary_channel_set ................................................................................. 97
函数 adc_preempt_channel_length_set ..................................................................... 98
函数 adc_preempt_channel_set................................................................................. 98
函数 adc_ordinary_conversion_trigger_set................................................................ 99
函数 adc_preempt_conversion_trigger_set ............................................................. 100
函数 adc_preempt_offset_value_set ........................................................................ 102
函数 adc_ordinary_part_count_set .......................................................................... 103
函数 adc_ordinary_part_mode_enable .................................................................... 103
函数 adc_preempt_part_mode_enable .................................................................... 103
函数 adc_preempt_auto_mode_enable ................................................................... 104
函数 adc_conversion_stop ....................................................................................... 104
函数 adc_conversion_stop_status_get .................................................................... 105
函数 adc_occe_each_conversion_enable ............................................................... 105
函数 adc_ordinary_software_trigger_enable ........................................................... 106
函数 adc_ordinary_software_trigger_status_get ..................................................... 106
函数 adc_preempt_software_trigger_enable ........................................................... 107
函数 adc_preempt_software_trigger_status_get ..................................................... 107
函数 adc_ordinary_conversion_data_get ................................................................. 108
函数 adc_combine_ordinary_conversion_data_get ................................................. 108
函数 adc_preempt_conversion_data_get ................................................................ 108
函数 adc_flag_get ..................................................................................................... 109
函数 adc_flag_clear .................................................................................................. 110
函数 adc_ordinary_oversample_enable ................................................................... 110
函数 adc_preempt_oversample_enable .................................................................. 111
函数 adc_oversample_ratio_shift_set ...................................................................... 111
函数 adc_ordinary_oversample_trig_enable............................................................ 112
函数 adc_ordinary_oversample_restart_set ............................................................ 113
控制器局域网模块(CAN) ................................................................................... 113
函数 can_reset.......................................................................................................... 115
函数 can_baudrate_default_para_init ...................................................................... 115
AT32F435/437固件库BSP&Pack应用指南
2022.11.15 第 5 页 版本 2.0.4
函数 can_baudrate_set ............................................................................................ 116
函数 can_default_para_init ....................................................................................... 117
函数 can_base_init ................................................................................................... 117
函数 can_filter_default_para_init .............................................................................. 119
函数 can_filter_init .................................................................................................... 119
函数 can_debug_transmission_prohibit ................................................................... 121
函数 can_ttc_mode_enable ...................................................................................... 122
函数 can_message_transmit .................................................................................... 122
函数 can_transmit_status_get .................................................................................. 124
函数 can_transmit_cancel ........................................................................................ 125
函数 can_message_receive ..................................................................................... 125
函数 can_receive_fifo_release ................................................................................. 126
函数 can_receive_message_pending_get ............................................................... 127
函数 can_operating_mode_set ................................................................................ 128
函数 can_doze_mode_enter .................................................................................... 128
函数 can_doze_mode_exit ....................................................................................... 129
函数 can_error_type_record_get .............................................................................. 129
函数 can_receive_error_counter_get ....................................................................... 130
函数 can_transmit_error_counter_get ...................................................................... 131
函数 can_interrupt_enable ....................................................................................... 131
函数 can_flag_get ..................................................................................................... 132
函数 can_flag_clear .................................................................................................. 133
CRC 计算单元(CRC)........................................................................................ 134
函数 crc_data_reset ................................................................................................. 135
函数 crc_one_word_calculate .................................................................................. 135
函数 crc_block_calculate .......................................................................................... 136
函数 crc_data_get .................................................................................................... 136
函数 crc_common_data_set ..................................................................................... 136
函数 crc_common_data_get .................................................................................... 137
函数 crc_init_data_set .............................................................................................. 137
函数 crc_reverse_input_data_set............................................................................. 138