There is something wrong. I applied torque and rotated the crank back and forth but motor did not react.
I tried all combinations in the line 411 of the "hw_luna_m600_core.c" file
return ADC_VOLTS(ADC_IND_EXT2)*1000;
and
return app_adc_get_voltage2()*1000;
and also without *1000 .
The ADC mode in the VESC Tool was set to Current mode (to make throttle works) and I also tried all other ADC modes and nothing makes the toque sensor+quadrature sensors work together.
Luna based Bafang M560 motor controller firmware. Contribute to TPEHAK/bldc development by creating an account on GitHub.
github.com
I can make throttle works, and I can also make the torque sensor works through the ADC2 (basically like a second throttle) through the VESC Tool PAS menu settings adjusting the voltages, functions and reverses. But the throttle sensor in combination with quadrature sensor through the Luna firmware algorithm through that line 411 does not work.
I also tried to set the "float_brake = 0.0" in the line 252 in the "app_adc.c" file but it makes the throttle does not work at all.
Is there any way to check the quadrature signal on the pins PA5 and PA6 to make sure they receive the signal properly with the VESC Tool application? We still have an option to swap the signals but I think it should not affect because of I can simply apply torque and rotate the crank backward.
I also can swap the "Invert Pedal Direction" in the PAS menu which I guess does it without necessity of swapping the signals physically on the PCB. I tried it too and it did not make the torque sensor+quadrature sensor works.
We also can match the quadrature sensor circuitry to the Bafang M560 controller quadrature sensor circuitry. Currently those circuits match the Luna M600 controller. But maybe the quadrature signal of the M600 PAS sensor is different than the M560 PAS sensor.
Here is the PAS sensor quadrature signals connection on our PCB which is matching the Luna M600 controller. I guess we can unsolder those 10K resistors connected to the +5V to match the Bafang M560
Here is the Bafang M560RS PAS sensor quadrature signals connection. It has no 10K resistors connected to the +5V. Those pins from the PAS connector are connected directly to the MCU pins through 1K resistors.
But before unsoldering the resistors it would be nice to know if there is a way to check through the VESC Tool if the STM32 obtains the quadrature signals on those pins with the current circuitry as is or not.