|
|
@@ -40,52 +40,7 @@ extern bool can_is_connect_pc(void);
|
|
|
extern measure_time_t g_meas_hall;
|
|
|
extern measure_time_t g_meas_foc;
|
|
|
extern measure_time_t g_meas_MCTask;
|
|
|
-#ifdef JTAG_DEBUG
|
|
|
-int jtag_cmd = 0;
|
|
|
-int jtag_data = 0;
|
|
|
-int jtag_plot = 0;
|
|
|
-void fetch_jtag_cmd(void) {
|
|
|
- foc_cmd_body_t foc_cmd;
|
|
|
|
|
|
- if (jtag_cmd == 1 || jtag_cmd == 2) {
|
|
|
- jtag_plot = 2;
|
|
|
- foc_cmd.cmd = Foc_Start_Motor;
|
|
|
- foc_cmd.data = (void *)os_alloc(4);
|
|
|
- encode_u8(foc_cmd.data, jtag_cmd);
|
|
|
- foc_send_command(&foc_cmd);
|
|
|
- jtag_cmd = 0;
|
|
|
- }else if (jtag_cmd == 3) {
|
|
|
-
|
|
|
- float vq = (float)jtag_data/10.0f;
|
|
|
- PMSM_FOC_SetOpenVdq(0, (vq));
|
|
|
- jtag_cmd = 0;
|
|
|
- }else if (jtag_cmd == 4) {
|
|
|
- jtag_plot = 1;
|
|
|
- foc_cmd.cmd = Foc_Cali_Hall_Phase;
|
|
|
- foc_cmd.data = (void *)os_alloc(4);;
|
|
|
- encode_s16(foc_cmd.data, jtag_data);
|
|
|
- foc_send_command(&foc_cmd);
|
|
|
- jtag_cmd = 0;
|
|
|
- }else if (jtag_cmd == 5) {
|
|
|
- PMSM_FOC_Set_Torque((float)jtag_data/10.0f);
|
|
|
- jtag_cmd = 0;
|
|
|
- }else if (jtag_cmd == 6) {
|
|
|
- PMSM_FOC_EnableCruise(true);
|
|
|
- }else if (jtag_cmd == 7) {
|
|
|
- PMSM_FOC_EnableCruise(false);
|
|
|
- }else if (jtag_cmd == 8) {
|
|
|
- //mc_current_sensor_calibrate((float)jtag_data/10.0f);
|
|
|
- jtag_cmd = 0;
|
|
|
- }else if (jtag_cmd == 9) {
|
|
|
- mc_encoder_zero_calibrate(jtag_data);
|
|
|
- jtag_cmd = 0;
|
|
|
- }
|
|
|
- jtag_cmd = 0;
|
|
|
-}
|
|
|
-#else
|
|
|
-void fetch_jtag_cmd(void){
|
|
|
-}
|
|
|
-#endif
|
|
|
|
|
|
#if 0
|
|
|
static s16 test_rpm = 0000;
|
|
|
@@ -110,10 +65,6 @@ void app_start(void){
|
|
|
mc_conf_init();
|
|
|
mc_err_block_init();
|
|
|
mc_init();
|
|
|
-#ifdef GD32_FOC_DEMO
|
|
|
- extern void key_init(void);
|
|
|
- key_init();
|
|
|
-#endif
|
|
|
shark_task_create(_app_low_task, NULL);
|
|
|
shark_task_create(_app_report_task, NULL);
|
|
|
shark_task_create(_app_plot_task, NULL);
|
|
|
@@ -198,7 +149,7 @@ static u32 _app_plot_task(void * args) {
|
|
|
}else if (plot_type == 5) {
|
|
|
can_plot2((s16)PMSM_FOC_Get()->idq_ctl[0].s_Cp, (s16)PMSM_FOC_Get()->idq_ctl[1].s_Cp);
|
|
|
}else if (plot_type == 6) {
|
|
|
- //can_plot2((s16)(PMSM_FOC_Get()->in.s_iABC[0]), (s16)(PMSM_FOC_Get()->in.s_iABC[1]));
|
|
|
+ //do it in other place
|
|
|
}else if (plot_type == 7) {
|
|
|
#ifdef CONFIG_DQ_STEP_RESPONSE
|
|
|
can_plot2((s16)(target_d*10.0f), (s16)(PMSM_FOC_Get()->out.s_RealIdq.d * 10.0f));
|
|
|
@@ -220,7 +171,6 @@ static u32 _app_low_task(void *args) {
|
|
|
if (!PMSM_FOC_Is_Start()) {
|
|
|
mc_err_block_save();
|
|
|
}
|
|
|
- fetch_jtag_cmd();
|
|
|
return 1;
|
|
|
}
|
|
|
|