FOC开环调试成功

This commit is contained in:
cbb
2025-10-16 21:43:19 +08:00
parent 2d807260c5
commit 35801d6f48
13 changed files with 704 additions and 509 deletions
+16 -35
View File
@@ -3,11 +3,11 @@
#include "Filter.h"
#include "Timer.h"
#include "adc.h"
#include "core_cm4.h"
#include "device/tle5012b.h"
#include "initial.h"
#include "sys/initial.h"
#include "systick.h"
#include "core_cm4.h"
#include "tle5012b.h"
#include <cinttypes>
#include <cstdio>
@@ -15,45 +15,26 @@
// 全局变量定义
CurrentKalman kalman(0.0f, 0.0026f, 4.8f, 0.0001f, 1e-6f, 0.02f);
CircularBuffer buffer;
CAN_transmiter CAN0_transmiter;
int main(void) {
systick_config(); // 系统时钟初始化
USART0_init(); // 调试串口初始化
User_timer_init(); // Timer初始化
adc_config(); // ADC初始化
dma_config(); // DMA采样ADC初始化
tle5012b_gpio_init(); // TLI5012B初始化
systick_config(); // 系统时钟初始化
USART0_init(); // 调试串口初始化
User_timer_init(); // Timer初始化
adc_config(); // ADC初始化
dma_config(); // DMA采样ADC初始化
tle5012b_gpio_init(); // TLI5012B初始化
tle5012b_spi_init();
cdd_TLI5012_Init(); // 初始化TLE5012B传感器
watchdog_init(1000);
// 初始化CAN回环测试
// can_loopback_init();
// cdd_TLI5012_Init(); // 初始化TLE5012B传感器
watchdog_init(5000);
while (1) {
/* clear the FWDGT reset flag */
fwdgt_counter_reload();
/* clear the FWDGT reset flag */
fwdgt_counter_reload();
// can_loopback_test();
/* value print */
// printf(" the temperature data is %2.2f degrees Celsius\r\n",
// get_mcu_temp());
// printf(" the drv_temperature data is %2.2f degrees Celsius\r\n",
// get_drv_temp());
// printf(" the U current data is %2.2f mA\r\n",get_current('U'));
// printf(" the V current data is %2.2f mA\r\n",get_current('V'));
// printf(" the W current data is %2.2f mA\r\n",get_current('W'));
// printf(" the VBUS is %2.2f V\r\n",get_vbus_voltage());
// printf(" the angle is %2.2f\r\n", tle5012b_read());
printf("\n----------------------------------------------------\n");
CAN0_transmiter.communication_check();
// delay_1ms(2);
delay_1ms(700);
// TLI5012B测试
Test_TLI5012B();
Set_Pwm(0, 1500);
}
}
}