diff --git a/Makefile b/Makefile index fb1545b0..a9a01f09 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PKGS = balance blacktip_dpv refloat tnt vbms32 vbms32_micro +PKGS = balance blacktip_dpv refloat tnt x1_unlocker vbms32 vbms32_micro PKGS += lib_files lib_interpolation lib_nau7802 lib_pn532 PKGS += lib_ws2812 logui lib_code_server lib_midi lib_disp_ui PKGS += vdisp lib_tca9535 vbms_harmony32 vbms_harmony16 diff --git a/res_all.qrc b/res_all.qrc index 493935b8..c5c722a8 100644 --- a/res_all.qrc +++ b/res_all.qrc @@ -5,6 +5,7 @@ refloat/refloat.vescpkg logui/logui.vescpkg tnt/tnt.vescpkg + x1_unlocker/x1_unlocker.vescpkg vbms32/vbms32.vescpkg vbms32_micro/vbms32_micro.vescpkg lib_ws2812/ws2812.vescpkg diff --git a/x1_unlocker/Makefile b/x1_unlocker/Makefile new file mode 100644 index 00000000..b1878497 --- /dev/null +++ b/x1_unlocker/Makefile @@ -0,0 +1,11 @@ +VESC_TOOL ?= vesc_tool + +all: x1_unlocker.vescpkg + +x1_unlocker.vescpkg: + $(VESC_TOOL) --buildPkg "x1_unlocker.vescpkg:script.lisp::0:README.md:X1-Unlocker" + +clean: + rm -f x1_unlocker.vescpkg + +.PHONY: all clean diff --git a/x1_unlocker/README.md b/x1_unlocker/README.md new file mode 100644 index 00000000..a53ec706 --- /dev/null +++ b/x1_unlocker/README.md @@ -0,0 +1,51 @@ +# X1-Unlocker + +Automatically sends a "magic" message, to unlock the CAN-port of INNOTRACE X1 controllers. + +INNOTRACE was a brand that sold aftermarket controllers for chinese Bafang Ultra M620/G510 mid-drive motors with integrated torque-sensor. Their X1-Controller and X1-Tool were basically a commercialized copy of the VESC-Project. It was tied to a subscription service and overpriced USB-FTDI-cable, which connected via UART to the motor, like the stock Bafang-Controller does. With this package a magic CAN-message is sent, which makes the X1-Controller show up as VESC-CAN-device and accessible. + +

+ +--- +## Disclaimer +This is experimental and mostlikely not intended by Innotrace! Functions are limited and you should be very careful with changing unknown parameters! It works with X1-FW 2.4.x.x and 2.5.x.x. Things you can do with this: + +* Rotor-Calibration +* Max Current +* Max Wattage + +

+ +--- +## Usage +The package is made to be used with VESC-Express, but can run it on any VESC that supports lispBM. The script automatically runs one time at boot, therefore please exactly follow these steps, to prepare your setup correctly: + +1. Download the latest VESC-Tool beta from https://vesc-project.com/vesc_tool +2. Connect the CAN-H and CAN-L of the VESC-Express with your X1 motor. (see pinout below) +3. Turn on the battery. +4. Turn on the display. (**Important! Do not skip!**) +5. Plug the VESC-Express into your computer. +6. Connect via VESC-Tool beta. +7. Wait until LED changes from RED to BLUE. +8. Now click "Scan CAN" and click on "X1". +9. There you go! + +

+ +--- +## Locate Connector +With Bafang this connector is normally for optional battery communication via UART. On X1, this connector is repurposed and has CAN-Bus accessible from the outside, without opening the motor: [plug_location.png](https://github.com/Tomblarom/vesc_pkg/blob/main/x1_unlocker/plug_location.png)\ +[image source: [https://www.greenbikekit.com](https://www.greenbikekit.com)] +

+ +--- +## Pinout Connector +Copied from [@dedo](https://forums.electricbikereview.com/threads/archon-x1-programming-thread-questions-and-experiences.40034/page-16#post-627685). Thanks for providing! [plug_pinout.png](https://github.com/Tomblarom/vesc_pkg/blob/main/x1_unlocker/plug_pinout.png)\ +Female: 04R-JWPF-VSLE-S\ +Male: 04T-JWPF-VSLE-S + +

+ +--- +### Version +- X1-Unlocker v1.0 \ No newline at end of file diff --git a/x1_unlocker/plug_location.png b/x1_unlocker/plug_location.png new file mode 100644 index 00000000..af0feb17 Binary files /dev/null and b/x1_unlocker/plug_location.png differ diff --git a/x1_unlocker/plug_pinout.png b/x1_unlocker/plug_pinout.png new file mode 100644 index 00000000..c279fecd Binary files /dev/null and b/x1_unlocker/plug_pinout.png differ diff --git a/x1_unlocker/script.lisp b/x1_unlocker/script.lisp new file mode 100644 index 00000000..173eda0a --- /dev/null +++ b/x1_unlocker/script.lisp @@ -0,0 +1,30 @@ +(gpio-configure 3 'pin-mode-out) ; LED Blue +(gpio-configure 2 'pin-mode-out) ; LED Red + +(print "scanning..") +(gpio-write 3 0) +(gpio-write 2 1) + +(defun avl nil + (progn + (print "X1 available") + (gpio-write 3 1) + (gpio-write 2 0) + ) +) + +(conf-set 'can-baud-rate 1) +(can-send-eid 0x00D431FF (list 0x14 0x78 0x00 0x00 0x00 0x00 0x00 0x00)) +(if (can-scan) (avl) + (progn + (conf-set 'can-baud-rate 2) + (can-send-eid 0x00D431FF (list 0x14 0x78 0x00 0x00 0x00 0x00 0x00 0x00)) + (if (can-scan) (avl) + (progn + (print "not found") + ) + ) + ) +) + +