
first one I tried still acts like no firmware in it basicaly.
On the log we can see the optionbytes.hex is not found, maybe the path to the file on the scrip is wrong, I think Stancecoke is the one that can help you here.
Comparing with the script file for building, seems that script for write option bytes misses the line:
Code: Select all
cd firmware
I have controller tester connected which will show the mosfets switching, no brake icon. No battery showing. (Empty will flash if lvc)casainho wrote: ↑Jan 10 2018 5:58pmGood that you know all that things, that's great.
Let's focus only in one controller. We need to know if firmware is really working and being flashed.
When it works, should, send to LCD the symbol of brake, throttle and battery status.
Also, motor should be like "blocked" when you push the motor by hand, that is firmware controllong the power mosfets - with controller powered off, motor should rotate freely by hand.
If that things don't happen, so for some reason the firmware is not running. Also make sure when you power on, the brakes are released, other way the firmware simple don't run (this is specific to our firmware).
Please test and confirm. I am now thinking on next step.
So, for what I can understand, you was able to flash and the firmware is running on the controller. You need to test more and give us more details, like what combination of components are you using when testing. Also some pictures make me happyhonya96 wrote: ↑Jan 10 2018 7:46pmOld tool working on 6 fet also. I am even getting some mosfet switches but I can rotate the motor freely. Then after holding throttle for a while they stop switching and its hard to turn motor. Weird. Maybe I will test on a fully working 6 fet tomorowbut you can give suggestions anyway. Thanks a lot
...for me flexibiliy and user configurability is the key here. It's the ability to add a torque sensor, add ramp up/down, various pas/throttle options/battery config, etc, etc, that will make this more attractive than the manufacturer's firmware. Hopefully once released it would be occasionally updated with bug fixes, code improvements, new features, etc.Later, when you write your feedback, please include what you value that you get with this firmware, comparing to original one.
- reduced by half the current value sent to display (I always din't trust much in my experimental values)geofft wrote: ↑Jan 11 2018 10:56amMotor wattmeter now powers up properly at zero, but is over-reading by a factor of around 2 - 2.5. It is also heavily over damped, taking about 10 secs to return to zero when motor drive is cut. Although it powers up at true zero it also has an annoying habit of 'zeroing' at 22 watts in use.
The table for battery voltages is on main.h, please propose the values that you think are correct. You can even change your main.h and test them:
Code: Select all
#define LI_ION_CELL_VOLTS_MAX 4.2
#define LI_ION_CELL_VOLTS_100 4.05
#define LI_ION_CELL_VOLTS_80 3.93
#define LI_ION_CELL_VOLTS_60 3.78
#define LI_ION_CELL_VOLTS_40 3.60
#define LI_ION_CELL_VOLTS_20 3.38
#define LI_ION_CELL_VOLTS_0 3.20
#define LI_ION_CELL_VOLTS_MIN 3.0
Code: Select all
#define BATTERY_PACK_VOLTS_100 (LI_ION_CELL_VOLTS_100 * BATTERY_LI_ION_CELLS_NUMBER) * 256
#define BATTERY_PACK_VOLTS_80 (LI_ION_CELL_VOLTS_80 * BATTERY_LI_ION_CELLS_NUMBER) * 256
#define BATTERY_PACK_VOLTS_60 (LI_ION_CELL_VOLTS_60 * BATTERY_LI_ION_CELLS_NUMBER) * 256
#define BATTERY_PACK_VOLTS_40 (LI_ION_CELL_VOLTS_40 * BATTERY_LI_ION_CELLS_NUMBER) * 256
#define BATTERY_PACK_VOLTS_20 (LI_ION_CELL_VOLTS_20 * BATTERY_LI_ION_CELLS_NUMBER) * 256
#define BATTERY_PACK_VOLTS_0 (LI_ION_CELL_VOLTS_0 * BATTERY_LI_ION_CELLS_NUMBER) * 256
// calc battery pack state of charge (SOC)
ui16_battery_volts = motor_get_ADC_battery_voltage_filtered () * ADC_BATTERY_VOLTAGE_K;
if (ui16_battery_volts > BATTERY_PACK_VOLTS_100) { ui16_battery_soc = 16; } // 4 bars | full
else if (ui16_battery_volts > BATTERY_PACK_VOLTS_80) { ui16_battery_soc = 12; } // 3 bars
else if (ui16_battery_volts > BATTERY_PACK_VOLTS_40) { ui16_battery_soc = 8; } // 2 bars
else if (ui16_battery_volts > BATTERY_PACK_VOLTS_20) { ui16_battery_soc = 4; } // 1 bar
else { ui16_battery_soc = 3; } // empty
Please enjoy your EBike and don't take to much time on this project. While it is great to have feedback and being improving it, don't stress about it and enjoy riding your EBike
The first photo ebike, is a big one
I've tested it with BionX direct drive successfully, too.
So we have to copy the code from the torque-simulation fork and use the X4 pad for the analogue brake signal
That's only a problem on the table. The current is controlled to be zero if you release the throttle. If there is no load, the current is near zero and the control loop reduces the duty cycle very slowly due to small delta between target and actual value. The ramp parameters can't help a this point.
Yes, this works better out on the road. Was going to mention pas ramp up though, I've got the ramp value set to just 5 at the moment and it's still too slow to build up, this may eventually need some adjustment in the code.That's only a problem on the table.
Please be more detailed in on your explanations. You mention ramp up and PAS and some value of 5, it doesn't make sense. You need to say which values for which option variable.
Sorry.....!Please be more detailed in on your explanations. You mention ramp up and PAS and some value of 5, it doesn't make sense. You need to say which values for which option variable.
If we don't understand, we can't help.
Stancecoke, I remember you told about let the current controller do it's job.stancecoke wrote: ↑Jan 12 2018 1:54amThat's only a problem on the table. The current is controlled to be zero if you release the throttle. If there is no load, the current is near zero and the control loop reduces the duty cycle very slowly due to small delta between target and actual value. The ramp parameters can't help a this point.
Code: Select all
// Brake signal
void EXTI_PORTA_IRQHandler(void) __interrupt(EXTI_PORTA_IRQHANDLER)
{
if (brake_is_set())
{
motor_controller_set_state (MOTOR_CONTROLLER_STATE_BRAKE); // enable brake state
motor_set_regen_current_max (ADC_MOTOR_REGEN_CURRENT_MAX); // enable the strongest possible ebrake/regen
motor_set_pwm_duty_cycle_target (0); // target 0 PWM duty_cycle and the motor will stop/block
ebike_app_cruise_control_stop ();
}
else
{
motor_controller_reset_state (MOTOR_CONTROLLER_STATE_BRAKE); // disable brake state, this will make throttle to setup the new value for target PWM duty_cycle
motor_set_regen_current_max (0); // disable ebrake/regen
}
}
WARNING to everyone: a too low value of PWM duty cycle ramp up/down step will make the "FOC algorithm" fail and probably make short circuit on the controller!! Please start with a high value like 250 and reduce slowly.geofft wrote: ↑Jan 12 2018 5:09amWas referring to the 'PWM duty cycle ramp up step' as in the configurators and config.h.Please be more detailed in on your explanations. You mention ramp up and PAS and some value of 5, it doesn't make sense. You need to say which values for which option variable.
If we don't understand, we can't help.
Yes, I see the changes on the log: https://github.com/OpenSource-EBike-fir ... its/master
That's right
Code: Select all
uint32_t PI_control (uint16_t ist, uint16_t soll)
{
float float_p;
static float float_i;
float_p=((float)soll - (float)ist)*P_FACTOR;
if (float_p>3)float_p=3;
if (float_p<-3)float_p=-3;
float_i+=((float)soll - (float)ist)*I_FACTOR;
if (float_i>255)float_i=255;
if (float_i<0)float_i=0;
return ((uint32_t)(float_p+float_i));
}