EFeru / hoverboard-firmware-hack-FOC

With Field Oriented Control (FOC)
GNU General Public License v3.0
1.12k stars 932 forks source link

Incorrect battery measurement in VARIANT_USART #449

Closed VitaliySayfullin closed 10 months ago

VitaliySayfullin commented 10 months ago

Variant

USART

Control type

FOC

Control mode

Speed

What is the bug and how to reproduce it ?

Battery is calibrated.

#define BAT_CALIB_REAL_VOLTAGE  4020      // input voltage measured by multimeter (multiplied by 100). In this case 43.00 V * 100 = 4300
#define BAT_CALIB_ADC           1960      // adc-value measured by mainboard (value nr 5 on UART debug output)

Terminal shows correct value from debug uart2:

Using the configuration from config.h
Limits Input1: TYP:2 MIN:-1000 MID:0 MAX:1000
Limits Input2: TYP:2 MIN:-1000 MID:0 MAX:1000
-- Motors enabled --
in1:0 in2:0 cmdL:0 cmdR:0 BatADC:1957 BatV:4177 TempADC:4095 Temp:-4412

But if I connect web tool or any other control to usart3 then I get broken value of voltage and board switch off by low battery event. USART3 Feedback shows correct value at board start:

(frame:43981 cmd1:0 cmd2:0 speedR:0 speedL:0 batV:4063 temp:317 cmdLed:0 checksum:42287)

But batV decreases constantly till dead_level while anything is connected to USART3. frame:43981 cmd1:0 cmd2:0 speedR:0 speedL:0 batV:3384 temp:319 cmdLed:0 checksum:42954 Multimeter shows 40,2V

VitaliySayfullin commented 10 months ago

Solved. The reason was broken USB-UART adapter.