Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EV-PEAK C3 #354

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft

EV-PEAK C3 #354

wants to merge 6 commits into from

Conversation

mskvortsov
Copy link

This PR is mostly for tracking the progress of porting the firmware to the M0516-based EV-PEAK C3 charger.

Currently, only the screen and buttons are working. Tracing the connections between HEF4051BT and MCU was easy, but they weren't checked.

Since I'm not an electronics engineering guy and anything operating above 5V (and especially having analog circuitry) makes me anxious, I'm kindly asking for help or advice on what the next steps could be regarding discharging/charging/balancing functions and what I could do to minimize the chances of burning something and hence losing the device.

IMG_1847

@stawel
Copy link
Owner

stawel commented Jul 11, 2024

Great work!

what I could do to minimize the chances of burning something and hence losing the device.

do not enter into any calibration, charging, discharging (for now)

I'm kindly asking for help or advice on what the next steps could be regarding
discharging/charging/balancing functions

useful schematics:
Turnigy 2x200W - I will use this one for reference when possible.
imaxB6

0a. make sure transistor (*) Q20: IRFZ44N (backside) is off (with a multimeter)
0b. make sure transistor (*) Q22: TPC8028 (near "bat-" terminal) is off (with a multimeter)
0c. make sure there is no voltage after (*) D2: 2xSR560 (on (*) C7: big capacitor)

  1. find LCD pins (done)
  2. find button pins (done)
  3. find buzzer pin (done?)
  4. find UART pins (done? - is the UART working?)
  5. find: OUTPUT_DISABLE_PIN, this one controls: (*)Q22: TPC8028
  6. find all MUX_ (*) IC9: HEF4051BT pins (done)
  7. find all analog pins (**)
  8. find all BALANCER_LOAD_PIN pins (**)
  9. find all DISCHARGE_ pins (**)
  10. find all SMPS_ pins (**)
  11. find any remaining pins (if any remain)

(*) - see: Turnigy 2x200W
(**) - for these you will use a "helper" program, let me know when you're ready

@mskvortsov
Copy link
Author

mskvortsov commented Jul 13, 2024

Thank you for the great hints - these are exactly what I was looking for. I'll continue moving through the list when I have enough time (not so much in the upcoming days).

Here is the schematic I've made for the charger. It probably contains errors, but it's better than nothing, I guess.
ev-peak-c3-rev0.pdf
ev-peak-c3-labeled.jpg

@diggit
Copy link
Collaborator

diggit commented Jul 13, 2024

Nice work! I know it is WIP, but I have some notes:

  • I think you are missing 5V connection on the left side of R104.
  • U2A non inverting input also does not look right. To be honest, I am not sure about it's purpose there.
  • U3A non inverting input will have some MCU HW PWM pin connected

It look like discharging current regulation loop fully relies on MCU (unless there is some missing path between U1C and U1B)? Designs I know, have fast CC regulation in HW and MCU only controls set-point according to measurement from shunt.

@mskvortsov
Copy link
Author

Thanks, @diggit! Indeed, there were missing nets. Does the block containing U2A make sense now? And what do you think about this HW design - is it compatible with the software as it is (without modifying SW substantially)?

  1. R104 (left) — +5V
  2. U2A non-inv. input — MCU:44 (note MCU:44 is also connected to R10 towards U2D input)
  3. R21 — MCU:3
  4. R12 and R14 junction — MCU:23
  5. MCU:17 — ground
  6. R80 — U1B inv. input (loops U1B and U1C)

Fixed schematics, revision 1
ev-peak-c3-rev1.pdf

@diggit
Copy link
Collaborator

diggit commented Jul 13, 2024

@mskvortsov thak looks much closer to known designs! U2A doing charging/buck HW OCP is new to me, but it's nice addition.
It looks like there are more safety enable pins, but generally it's very close to known designs. Nothing significantly different. You can see currently known M0516 base targets pin mapping here. All these pins are used in generic charger code, so not too many changes.
In the end we'll need new generic target like src/hardware/nuvoton-M051/generic/50W is.

@mskvortsov
Copy link
Author

I've updated pin definitions, but some are under question.

  1. It seems that there are no OUTPUT_VOLTAGE_MINUS_PIN and MADDR_V_BALANSER_BATT_MINUS for this HW (I routed them to the available ground as a workaround),
  2. Choosing OUTPUT_VOLTAGE_PLUS_PIN is unclear to me. Is it MUX:7, MCU:43, or something else?

LCD shows the "reverse polarity" message now, and when AnalogInputAnalyzer is enabled, the message is:

V+_pin: 0
V-_pin: 8490

Which is strange because DMM shows 0V at MCU:21 (to which OUTPUT_VOLTAGE_MINUS_PIN is routed to).

0a. make sure transistor () Q20: IRFZ44N (backside) is off (with a multimeter)
0b. make sure transistor (
) Q22: TPC8028 (near "bat-" terminal) is off (with a multimeter)
0c. make sure there is no voltage after () D2: 2xSR560 (on () C7: big capacitor)

(0a) Q1 IRFZ44N is off,
(0b) 13.6V at the gate of Q2 (TPC8028, near BATT- terminal),
(0c) no voltage on the big cap.

Is (0b) critical?

@mskvortsov
Copy link
Author

Schematics has some minor changes:

  • MUX:6 is connected to ground,
  • R33 is 100K not 2K,
  • Q11-Q16 are actually PNP Darlingtons,
  • added JP1 jumper near C42 to the left of U4,
  • added MCU symbol,
  • and some layout improvements.

Schematics, revision 2
ev-peak-c3-rev2.pdf

@stawel
Copy link
Owner

stawel commented Jul 16, 2024

Ok, nice to know that AnalogInputAnalyzer is still working :)

(0a) Q1 IRFZ44N is off,
(0b) 13.6V at the gate of Q2 (TPC8028, near BATT- terminal),
(0c) no voltage on the big cap.
Is (0b) critical?

before stating AnalogInputAnalyzer you have to correctly assign OUTPUT_DISABLE_PIN (done?),
this pin will "enable" battery output when doing measurements, that is set some voltage on gate Q2.
To make sure it is correctly set, temporary change: https://github.com/stawel/cheali-charger/blob/master/src/core/helper/AnalogInputsAnalyzer.cpp#L141
to:

AnalogInputs::powerOn(false);

now there shouldn't be any voltage on Q2 gate (transistor should be disabled)

It seems that there are no MADDR_V_BALANSER_BATT_MINUS for this HW (I routed them to the available ground as a workaround),

this is ok, each of your balance cell inputs has a dedicated op-amp, MADDR_V_BALANSER_BATT_MINUS is not needed here - remove it and make sure:
ENABLE_SIMPLIFIED_VB0_VB2_CIRCUIT is not defined anywhere.

It seems that there are no OUTPUT_VOLTAGE_MINUS_PIN for this HW
Choosing OUTPUT_VOLTAGE_PLUS_PIN is unclear to me. Is it MUX:7, MCU:43, or something else?

OUTPUT_VOLTAGE_MINUS_PIN and OUTPUT_VOLTAGE_PLUS_PIN are used to measure the battery voltage
and check "reverse polarity".
It looks like your hardware has a dedicated "reverse polarity pin" (MCU:36) and the battery voltage is just OUTPUT_VOLTAGE_PLUS_PIN, so:
remove OUTPUT_VOLTAGE_MINUS_PIN and additionally define:

bool hardware::isReversePolarity()

like in:
https://github.com/stawel/cheali-charger/blob/master/src/hardware/nuvoton-NUC029xAN/generic/100W/CQ3.cpp#L87-L90

hmm....interesting... have you looked into:
https://github.com/stawel/cheali-charger/blob/master/src/hardware/nuvoton-NUC029xAN/
the targets: EV-PEAK_CQ3
name looks suspiciously similar :-)

@mskvortsov
Copy link
Author

Yes, C3 turns out to be very close to CQ3 indeed - just a matter of pin assignments. Charging and discharging functions look good now, though I'm still testing. Probably, instead of plain copying the CQ3 files, this can be done better by reorganizing the build system or something, but I think it's out of the scope for this particular porting effort.

The only thing that I'm slightly unsure of so far is Icharge calibration. For a 1S battery, two measured points are

p0: x0 = 124, y0 = 100mA
p1: x1 = 2567, y1 = 1000mA

fitting a line y = 0.37x + 53.5. At the minimal Icharge of 50mA (as set in the settings) the target value is negative, and the display shows

calib. error
Icharge 11

After increasing the minimal Icharge to 60mA charging starts successfully. At x = 0, DMM's reading is 53.0mA - quite close to 50mA but just a tiny bit not enough. I've done some basic analysis for currents at x = [0; 2500] with a step of 100 using numpy - the response to x is perfectly linear and fits the line above exactly.

Should I instead tweak the p0 and p1 calibration points, such that x is still positive at Icharge of 50mA?

And one more thing I haven't yet found a resolution for: what is the preferred way of extracting calibration data from a device for putting it into defaultCalibration.cpp?

@mskvortsov
Copy link
Author

Got calibration points manually using the Analog Inputs Analyzer. Added some small value to the x of 100mA Icharge point so that the x of 50mA is still positive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants