From e5d5b1953b1b658096daede8c31ade7608ac3e1b Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Fri, 19 Jan 2018 14:08:41 -0800 Subject: [PATCH 1/7] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index dacfbb6c..75d8cad7 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ Baud rate: 115200 Pinout: * GPIO 1: Tx (connect to Rx of other device) * GPIO 2: Rx (connect to Tx of other device) +* GND: you must connect the grounds of the devices together. Use any GND pin on J3 of the ODrive. To enable UART mode for the GPIO, please see [Setting the GPIO mode](Firmware/README.md#configuring-parameters). @@ -50,6 +51,7 @@ Pinout: * GPIO 2: M0 dir * GPIO 3: M1 step * GPIO 4: M1 dir +* GND: you must connect the grounds of the devices together. Use any GND pin on J3 of the ODrive. Please note that GPIO_3 and GPIO_4 are NOT 5v tolerant on ODrive v3.2 and earlier, so 3.3V signals only! ODrive v3.3 and onward have 5V tolerant GPIO pins. From d55e96530d9c17d4d9628b98c997f879095e19d3 Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Fri, 19 Jan 2018 14:12:28 -0800 Subject: [PATCH 2/7] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 75d8cad7..a54dcabb 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Pinout: * GPIO 2: Rx (connect to Tx of other device) * GND: you must connect the grounds of the devices together. Use any GND pin on J3 of the ODrive. -To enable UART mode for the GPIO, please see [Setting the GPIO mode](Firmware/README.md#configuring-parameters). +To enable UART mode for the GPIO, please see [Setting the GPIO mode](Firmware/README.md#communication-configuration). ### Setting up Step/Direction Pinout: @@ -56,7 +56,7 @@ Pinout: Please note that GPIO_3 and GPIO_4 are NOT 5v tolerant on ODrive v3.2 and earlier, so 3.3V signals only! ODrive v3.3 and onward have 5V tolerant GPIO pins. -To enable step/dir mode for the GPIO, please see [Setting the GPIO mode](Firmware/README.md#configuring-parameters). +To enable step/dir mode for the GPIO, please see [Setting the GPIO mode](Firmware/README.md#communication-configuration). There is also a new config variable called `counts_per_step`, which specifies how many encoder counts a "step" corresponds to. It can be any floating point value. The maximum step rate is pending tests, but it should handle at least 16kHz. If you want's to test it, please be aware that the failure mode on too high step rates is expected to be that the motors shuts down and coasts. From a20741e8c10e39130ed2629c4c1b7abc01b46989 Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Fri, 2 Feb 2018 23:52:19 -0800 Subject: [PATCH 3/7] Update README.md --- Firmware/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/README.md b/Firmware/README.md index f9ca56f1..3eeb444f 100644 --- a/Firmware/README.md +++ b/Firmware/README.md @@ -69,7 +69,7 @@ It may be helpful to know that the entry point of each of the motor threads is ` ### Mandatory parameters You must set: * `ENCODER_CPR`: Encoder Count Per Revolution (CPR). This is 4x the Pulse Per Revolution (PPR) value. -* `POLE_PAIRS`: This is the number of magnet poles in the rotor, divided by two. You can simply count the number of magnets in the rotor, if you can see them. +* `POLE_PAIRS`: This is the number of magnet poles in the rotor, **divided by two**. You can simply count the number of magnets in the rotor, if you can see them. * `brake_resistance`: This is the resistance of the brake resistor. If you are not using it, you may set it to 0.0f. * `motor_type`: This is the type of motor being used. Currently two types of motors are supported -- High-current motors (`MOTOR_TYPE_HIGH_CURRENT`) and Gimbal motors (`MOTOR_TYPE_GIMBAL`). From 858ef6cc79ef64d719db182364e238e8de94b921 Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Wed, 7 Feb 2018 22:55:23 -0800 Subject: [PATCH 4/7] Set .use_index to false by default --- Firmware/MotorControl/low_level.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/MotorControl/low_level.c b/Firmware/MotorControl/low_level.c index f7527821..5fffdabc 100644 --- a/Firmware/MotorControl/low_level.c +++ b/Firmware/MotorControl/low_level.c @@ -120,7 +120,7 @@ Motor_t motors[] = { .rotor_mode = ROTOR_MODE_ENCODER, .encoder = { .encoder_timer = &htim3, - .use_index = true, + .use_index = false, .index_found = false, .calibrated = false, .idx_search_speed = 10.0f, // [rad/s electrical] @@ -220,7 +220,7 @@ Motor_t motors[] = { .rotor_mode = ROTOR_MODE_ENCODER, .encoder = { .encoder_timer = &htim4, - .use_index = true, + .use_index = false, .index_found = false, .calibrated = false, .idx_search_speed = 10.0f, // [rad/s electrical] From 74d930ee9a7d260b757103caa7693018b1fbc61e Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Fri, 9 Feb 2018 14:32:58 -0800 Subject: [PATCH 5/7] Update low_level.c --- Firmware/MotorControl/low_level.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/MotorControl/low_level.c b/Firmware/MotorControl/low_level.c index 5fffdabc..df7a2cc6 100644 --- a/Firmware/MotorControl/low_level.c +++ b/Firmware/MotorControl/low_level.c @@ -35,7 +35,7 @@ float vbus_voltage = 12.0f; // TODO stick parameter into struct #define ENCODER_CPR (2048 * 4) // Default resolution of CUI-AMT102 encoder -#define POLE_PAIRS 7 +#define POLE_PAIRS 7 // This value is correct for N5065 motors and Turnigy SK3 series. const float elec_rad_per_enc = POLE_PAIRS * 2 * M_PI * (1.0f / (float)ENCODER_CPR); #if HW_VERSION_MAJOR == 3 From 6183eac57b08b9784cc874ab52082f8c1b106795 Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Fri, 9 Feb 2018 14:38:35 -0800 Subject: [PATCH 6/7] Update README.md --- Firmware/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/README.md b/Firmware/README.md index 3eeb444f..8c540021 100644 --- a/Firmware/README.md +++ b/Firmware/README.md @@ -69,7 +69,7 @@ It may be helpful to know that the entry point of each of the motor threads is ` ### Mandatory parameters You must set: * `ENCODER_CPR`: Encoder Count Per Revolution (CPR). This is 4x the Pulse Per Revolution (PPR) value. -* `POLE_PAIRS`: This is the number of magnet poles in the rotor, **divided by two**. You can simply count the number of magnets in the rotor, if you can see them. +* `POLE_PAIRS`: This is the number of magnet poles in the rotor, **divided by two**. You can simply count the number of permanent magnets in the rotor, if you can see them. Note: this is not the same as the number of coils in the stator. * `brake_resistance`: This is the resistance of the brake resistor. If you are not using it, you may set it to 0.0f. * `motor_type`: This is the type of motor being used. Currently two types of motors are supported -- High-current motors (`MOTOR_TYPE_HIGH_CURRENT`) and Gimbal motors (`MOTOR_TYPE_GIMBAL`). From b9b21b95bffef8d88a0d0d775b9f2c955b2a192f Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Mon, 12 Feb 2018 00:02:13 -0800 Subject: [PATCH 7/7] make python comms debug easier --- tools/explore_odrive.py | 2 +- tools/odrive/core.py | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/tools/explore_odrive.py b/tools/explore_odrive.py index 0991ee81..0cdeb46a 100755 --- a/tools/explore_odrive.py +++ b/tools/explore_odrive.py @@ -33,7 +33,7 @@ if (args.verbose): printer = print else: printer = lambda x: None - +printer = print # Connect to device if not args.usb is None: diff --git a/tools/odrive/core.py b/tools/odrive/core.py index c4888de7..b654f130 100644 --- a/tools/odrive/core.py +++ b/tools/odrive/core.py @@ -252,7 +252,7 @@ def find_dev_serial_ports(search_regex): return [] def find_pyserial_ports(): - return [x.name for x in serial.tools.list_ports.comports()] + return [x.device for x in serial.tools.list_ports.comports()] def find_serial_channels(printer=noprint): """ @@ -270,11 +270,7 @@ def find_serial_channels(printer=noprint): macos_usb_serial_ports = find_dev_serial_ports(r'^tty\.usbmodem') for port in real_serial_ports + linux_usb_serial_ports + macos_usb_serial_ports: - try: - yield channel_from_serial_port(port, 115200, False, printer) - except serial.serialutil.SerialException: - printer("could not open " + port) - continue + yield channel_from_serial_port(port, 115200, False, printer) def find_all(consider_usb=True, consider_serial=False, printer=noprint):