Before edundo help commit
This commit is contained in:
@@ -176,10 +176,9 @@ int main(void)
|
||||
One_ms_timer_init();
|
||||
custom_logic_enable();
|
||||
|
||||
angle_sensor_init();
|
||||
//angle_sensor_init();
|
||||
//initialize_ads();
|
||||
/* External IRQ Config */
|
||||
|
||||
__enable_irq();
|
||||
enable_NVIC_IRQ();
|
||||
//ext_irq_register(GPIO_PIN(ADS_DATA_RDY), ADS1299_dataReadyISR);
|
||||
@@ -188,20 +187,21 @@ int main(void)
|
||||
/* Replace with your application code */
|
||||
while (1) {
|
||||
if (Motor1.timerflags.adc_readings_ready_tic) {process_currents();}
|
||||
|
||||
if (Motor1.timerflags.motor_telemetry_flag) {
|
||||
Motor1.timerflags.motor_telemetry_flag = false;
|
||||
update_telemetry();
|
||||
update_setpoints();
|
||||
PORT->Group[1].OUTCLR.reg = (1<<GPIO_PIN(SPI1_CS));
|
||||
DMAC->Channel[0].CHCTRLA.reg |= DMAC_CHCTRLA_ENABLE;
|
||||
DMAC->Channel[1].CHCTRLA.reg |= DMAC_CHCTRLA_ENABLE;
|
||||
//PORT->Group[1].OUTCLR.reg = (1<<GPIO_PIN(SPI1_CS));
|
||||
//DMAC->Channel[0].CHCTRLA.reg |= DMAC_CHCTRLA_ENABLE;
|
||||
//DMAC->Channel[1].CHCTRLA.reg |= DMAC_CHCTRLA_ENABLE;
|
||||
//_dma_enable_transaction(DMAC_CHANNEL_CONF_SERCOM_1_RECEIVE, false);
|
||||
//_dma_enable_transaction(DMAC_CHANNEL_CONF_SERCOM_1_TRANSMIT, false);
|
||||
|
||||
int16_t* angles;
|
||||
angles = read_angle();
|
||||
Motor1.motor_status.abs_position = degrees(angles[0]);
|
||||
Motor2.motor_status.abs_position = degrees(angles[1]);
|
||||
//angles = read_angle();
|
||||
//Motor1.motor_status.abs_position = degrees(angles[0]);
|
||||
//Motor2.motor_status.abs_position = degrees(angles[1]);
|
||||
|
||||
////field = ang_sense_read(AS_CMD_MAGNITUDE);
|
||||
//*Spare1_tx = (field[0] & AS_MASK);
|
||||
@@ -214,9 +214,9 @@ int main(void)
|
||||
|
||||
if (Motor1.timerflags.current_loop_tic) {
|
||||
Motor1.timerflags.current_loop_tic = false;
|
||||
//APPLICATION_StateMachine();
|
||||
//exec_commutation(&Motor1);
|
||||
//exec_commutation(&Motor2);
|
||||
APPLICATION_StateMachine();
|
||||
exec_commutation(&Motor1);
|
||||
exec_commutation(&Motor2);
|
||||
}
|
||||
|
||||
if (ADS1299.data_ReadyFlag){
|
||||
|
||||
@@ -153,7 +153,8 @@ const static BLDCMotor_param_t FH_22mm24BXTR = {
|
||||
.motor_Max_Spd_RPM = 3000,
|
||||
.motor_MeasureRange_RPM = 3000 * 1.2, //(1.2f * MOTOR_MAX_SPD_RPM)f // give 20% headroom
|
||||
.motor_Max_Spd_ELEC = (3000/60)*7.0, //(MOTOR_MAX_SPD_RPM/60)*MOTOR_POLEPAIRS
|
||||
.motor_Max_Current_IDC_A = 0.368,
|
||||
//.motor_Max_Current_IDC_A = 0.368,
|
||||
.motor_Max_Current_IDC_A = 0.180,
|
||||
.controller_param.Pid_Speed.Kp = 0.00008f,
|
||||
.controller_param.Pid_Speed.Ki = 0.0000001f,
|
||||
//.controller_param.Pid_Speed.Ki = 0.0000001f,
|
||||
@@ -174,10 +175,10 @@ const static BLDCMotor_param_t FH_32mm12BXTR = {
|
||||
.motor_LD_H = 0.000331,
|
||||
.motor_LQ_H = 0.000331,
|
||||
.motor_Flux_WB = 0.0063879968,
|
||||
.motor_Max_Spd_RPM = 3000,
|
||||
.motor_Max_Spd_RPM = 1000,
|
||||
.motor_MeasureRange_RPM = 3200, //(1.2f * MOTOR_MAX_SPD_RPM)f // give 20% headroom
|
||||
.motor_Max_Spd_ELEC = 12000, //(MOTOR_MAX_SPD_RPM/60)*MOTOR_POLEPAIRS
|
||||
.motor_Max_Current_IDC_A = (1.6),
|
||||
.motor_Max_Current_IDC_A = (1.2),
|
||||
.controller_param.Pid_Speed.Kp = 0.0004f,
|
||||
.controller_param.Pid_Speed.Ki = 0.0000001f,
|
||||
.controller_param.Pi_Pos.Kp = 50.0f,
|
||||
@@ -186,7 +187,7 @@ const static BLDCMotor_param_t FH_32mm12BXTR = {
|
||||
//.controller_param.Pid_Speed.Ki = 0.0f,
|
||||
//.controller_param.Pi_Pos.Kp = 4.0f,
|
||||
//.controller_param.Pi_Pos.Ki = 0.0f,
|
||||
.motor_MaxPWM = 300.0,
|
||||
.motor_MaxPWM = 250.0,
|
||||
};
|
||||
|
||||
/* Big Motor - 3216W024BXTR */
|
||||
|
||||
Reference in New Issue
Block a user