“Infineon” e-bike controller protocol

The following info is a result of analysis of the serial protocol between the PC and a Infineon-based e-bike controller. The info is not guaranteed to be correct, however, I will fix it as soon as new info will be gathered or errors will be found.

The serial protocol used by “Parameter Designer” (also known as Keywin E-Bike Lab or KEBL for short) is very simple. First of all, serial port settings are: 9600 baud, 8 data bits, no parity, 1 stop bit (9600 8N1). Then the program starts sending out the byte ‘8’, until the user presses the “flash” button on the programming adapter. At this point the microcontroller boots, reads the serial port, sees the “8” and answers with a “U”. After this “Parameter Designer” will send out a block of 32 bytes, which contains the controller settings; the table that follows describes every byte of this array. Finally, after receiving the data block and testing the checksum the controller replies with another ‘U’.

Offset

Range of values

Description

0

2

Unknown value

1

15

Unknown value

2

0 … 255

PhaseCurrent: the phase current limit. The actual value depends on the controller model (or, rather, of the current measuring schematic). To compute the actual value, use one of the formulas from the following table:

Model

Formula

EB206

V = I * 1.25 - 0.2

EB209

V = I * 1.25 - 19.2

EB212

V = I * 0.624 - 7

EB215

V = I * 0.416 - 18.9

EB218

V = I * 0.187 - 0.1

EB215/Lyen

V = I * 0.834 - 30.1

EB218/Lyen

V = I * 0.624 - 16

EB224/Lyen

V = I * 0.624 - 18

EB232/Lyen

V = I * 0.5 - 20.2

For example, the value for EB212 at 60A phase current would be:

V = 60 * 0.625 - 7 = 30.5 ~= 31

Note that the formulas for EB206-212 Lyen edition controllers are the same as for “generic” Infineon controllers.

3

0 … 255

RatedCurrent: the battery current limit. The actual value depends on the controller model (or, rather, of the current measuring schematics). To compute the actual value, use one of the formulas from the following table:

Model

Formula

EB206

V = I * 1.256 + 1.25

EB209

V = I * 1.256 - 2.8

EB212

V = I * 0.624 - 1.5

EB215

V = I * 0.425 - 3.3

EB218

V = I * 0.213 + 0.1

EB206/Lyen

V = I * 1.249 - 4.26

EB209/Lyen

V = I * 1.249 - 2.26

EB212/Lyen

V = I * 0.631 - 1.5

EB215/Lyen

V = I * 0.83 - 5.86

EB218/Lyen

V = I * 0.625 - 5

EB224/Lyen

V = I * 0.627 - 4.12

EB232/Lyen

V = I * 0.5 - 4

For example, the value for EB212 at 20A rated current would be:

V = 20 * 0.624 - 1.5 = 10.98 ~= 11

4

0 … 255

HaltVoltage: The battery voltage at which controller cuts out the power. The programmed value does not depend on the controller model and can be computed by the following formula:

V = U * 3.281

5

0 … 255

Tolerance: The voltage rise on the battery after power has been cut off by HaltVoltage condition to enable the power back. Some batteries (e.g. Pb) will restore their voltage after a bit of rest. The value can be computed with the same formula as HaltVoltage:

V = U * 3.281

6

38 … 128

LimitSpeed: This is the speed value to use when the speed limit switch (or wire-plug) is connected to ground (“SL” contact on the board). The actual value to program can be derived from the speed percent (30-100%) with the following formula:

V = SL * 1.28 (sic! this is different from SpeedX)

7

0: Switch mode

1: Cycle mode

SpeedMode: When set to “switch mode” you can choose any of the three speed settings with a 3-position switch; in “Cycle mode” a button will toggle you between speed 1 and 2; it is not possible to switch to speed 3 in this mode.

8

24 … 95

Speed1: The speed “1” setting. The actual value to program can be computed from the speed percent (30-120%) with the following formula:

V = SL / 1.26

9

24 … 95

Speed2: The “default” speed, when not using any kind of speed switches. The formula for the programmed value is:

V = SL / 1.26

10

24 … 95

Speed3: The third speed setting. The formula for the programmed value is:

V = SL / 1.26

11

10 … 100

BlockTime: The amount of time to try rolling the wheel before deciding that it has been blocked (e.g. if the Hall sensors signals won’t change for that much time, the controller will stop trying). The programmed value is:

V = T * 10

12

10 … 150

AutoCruisingTime: If the throttle position stays still for that much time, the controller will lock this value and even if you release the throttle, it will keep the speed. The programmed value is:

V = T * 10

13

0: Enable

1: Disable

SlipChargeMode: This mode, if enabled, will allow you to brake with the throttle - when you release the throttle, it will start braking. Note that this is incompatible with “Auto Cruising” feature.

14

0: Common VCC

1: Common GND

2: 164 Mode: P1 - DAT, P2 - CLK

IndicateMode: The work mode for the LED indicator contacts (P1-P3 on the board). The P3 output (along with the speed LED signals P1 and P2) can be active high or active low depending on this setting.

15

0, 4, 8, 255

EBS Level: The amount of energy to regenerate while braking. When 0, no energy will be recovered, thus no regen braking; when 4, a medium amount of energy will be recovered (recommended for small wheels) and 8 for the highest amount of recovered energy (strong braking). The actual programmed value:

V = L * 4

The value 255 seems to mean “unlimited regeneration current”.

16

38 … 128

ConverseSpeed: This is the reverse rotation speed, activated by connecting the DX3 contact on the board to GND. The formula for the value (30..100%) is the same as for LimitSpeed:

V = SL * 1.28

17

0 … 255

EBSLimVoltage: The regeneration voltage limit. The formula is the same as for the voltage values above, e.g.:

V = U * 3.285

Note: This is supposed to use same circuitry as HaltVoltage, thus the formulas should be identic. However, in KEBL the formulas are slighly different. To me, the HaltVoltage formula looks more correct.

18

0: Low

1: High

GuardLevel: this sets the polarity of the “anti-theft” signal (controller blocks the motor from rotating). When set to 0, connecting the TB contact to ground will activate the feature; when set to 1 a high signal will activate the feature.

19

0: Disabled

1: Enabled

BarProtect: enables protection against burned out throttle electronics. If throttle signal goes above ~4V (normally it is below), controller stops.

20

0: Fast

1: Slow

1:1 Design: this is for pedal assist sensor.

21

0: Cruising indicate

1: Cruising + Fault indicator

P3 Design: This sets the mode of the P3 pin, which should be connected to a LED on the handlebar. If this parameter is 0, the LED will light up when cruising mode will be enabled; of set to 1 this LED will also show the fault code (by blinking a certain number of times) in the event something wrong happens.

22

0 - 120 degree

1 - 60 degree

2 - Compatible

PhaseDegree: the (electric) angle between Hall sensors

23

0 or 80

Unknown: the generic Parameter Designer always puts 0 here, Lyen’s modified Parameter Designer puts 80 here for all controller models except EB206/Lyen.

24

0

Unused

25

0

Unused

26

0

Unused

27

0

Unused

28

0

Unused

29

0

Unused

30

0

Unused

31

0 … 255

The exclusive disjunction (XOR) of the previous 31 bytes (a kind of check sum).