casainho
10 GW
- Joined
- Feb 14, 2011
- Messages
- 6,058
Please see on LCD3 the motor speed ERPS and also the duty_cycle value and post them here.jbalat said:Oh well my theory is down the tubes. I bumped the voltage up from 10s to 14s and cadence is still limited to 80 (which is really 104)
Bugger hopefully I can bump up the ERPS limit in the code ?
Main.h file:
#define MOTOR_OVER_SPEED_ERPS 520 // motor max speed, protection max value | 30 points for the sinewave at max speed
About cadence,
void read_pas_cadence (void)
{
// cadence in RPM = 60 / (ui16_pas_timer2_ticks * PAS_NUMBER_MAGNETS * 0.000064)
if (ui16_pas_pwm_cycles_ticks >= ((uint16_t) PAS_ABSOLUTE_MIN_CADENCE_PWM_CYCLE_TICKS)) { ui8_pas_cadence_rpm = 0; }
else
{
ui8_pas_cadence_rpm = (uint8_t) (60 / (((float) ui16_pas_pwm_cycles_ticks) * ((float) PAS_NUMBER_MAGNETS) * 0.000064));
if (ui8_pas_cadence_rpm > ((uint8_t) PAS_MAX_CADENCE_RPM))
{
ui8_pas_cadence_rpm = ((uint8_t) PAS_MAX_CADENCE_RPM);
}
}
}
On motor.c, ui16_pas_pwm_cycles_ticks is incremented every PWM cycle of 64us and reset.
That variable keeps the ticks in 64us that takes counting each magnet timming.
You should change PAS_NUMBER_MAGNETS (main.h) but that number were givin by another user/developer of TSDZ2:
// PAS
#define PAS_NUMBER_MAGNETS 24