mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-22 16:14:37 +08:00
Merge branch 'devel' into control-loop-refactor
This commit is contained in:
+21
-20
@@ -1,24 +1,24 @@
|
||||
# Pinout
|
||||
|
||||
| # | Label | `GPIO_MODE_DIGITAL` | `GPIO_MODE_ANALOG_IN` | `GPIO_MODE_UART0` | `GPIO_MODE_PWM0` | `GPIO_MODE_CAN0` | `GPIO_MODE_I2C0` | `GPIO_MODE_ENC0` | `GPIO_MODE_ENC1` | `GPIO_MODE_MECH_BRAKE` |
|
||||
|----|---------------|------------------------|-----------------------|-------------------|------------------|------------------|------------------|------------------|------------------|------------------------|
|
||||
| 0 | _not a pin_ | | | | | | | | | |
|
||||
| 1 | GPIO1 (+) | general purpose | analog input | **UART0.TX** | PWM0.0 | | | | | mechanical brake |
|
||||
| 2 | GPIO2 (+) | general purpose | analog input | **UART0.RX** | PWM0.1 | | | | | mechanical brake |
|
||||
| 3 | GPIO3 | general purpose | **analog input** | | PWM0.2 | | | | | mechanical brake |
|
||||
| 4 | GPIO4 | general purpose | **analog input** | | PWM0.3 | | | | | mechanical brake |
|
||||
| 5 | GPIO5 | general purpose | **analog input** (*) | | | | | | | mechanical brake |
|
||||
| 6 | GPIO6 (*) (+) | **general purpose** | | | | | | | | mechanical brake |
|
||||
| 7 | GPIO7 (*) (+) | **general purpose** | | | | | | | | mechanical brake |
|
||||
| 8 | GPIO8 (*) (+) | **general purpose** | | | | | | | | mechanical brake |
|
||||
| 9 | M0.A | general purpose | | | | | | **ENC0.A** | | |
|
||||
| 10 | M0.B | general purpose | | | | | | **ENC0.B** | | |
|
||||
| 11 | M0.Z | **general purpose** | | | | | | | | |
|
||||
| 12 | M1.A | general purpose | | | | | I2C.SCL | | **ENC1.A** | |
|
||||
| 13 | M1.B | general purpose | | | | | I2C.SDA | | **ENC1.B** | |
|
||||
| 14 | M1.Z | **general purpose** | | | | | | | | |
|
||||
| 15 | _not exposed_ | general purpose | | | | **CAN0.RX** | I2C.SCL | | | |
|
||||
| 16 | _not exposed_ | general purpose | | | | **CAN0.TX** | I2C.SDA | | | |
|
||||
| # | Label | `GPIO_MODE_DIGITAL` | `GPIO_MODE_ANALOG_IN` | `GPIO_MODE_UART_A` | `GPIO_MODE_UART_B` | `GPIO_MODE_PWM` | `GPIO_MODE_CAN_A` | `GPIO_MODE_I2C_A` | `GPIO_MODE_ENC0` | `GPIO_MODE_ENC1` | `GPIO_MODE_MECH_BRAKE` |
|
||||
|----|---------------|------------------------|-----------------------|--------------------|--------------------|-----------------|------------------|-------------------|------------------|------------------|------------------------|
|
||||
| 0 | _not a pin_ | | | | | | | | | | |
|
||||
| 1 | GPIO1 (+) | general purpose | analog input | **UART_A.TX** | | PWM0.0 | | | | | mechanical brake |
|
||||
| 2 | GPIO2 (+) | general purpose | analog input | **UART_A.RX** | | PWM0.1 | | | | | mechanical brake |
|
||||
| 3 | GPIO3 | general purpose | **analog input** | | **UART_B.TX** | PWM0.2 | | | | | mechanical brake |
|
||||
| 4 | GPIO4 | general purpose | **analog input** | | **UART_B.RX** | PWM0.3 | | | | | mechanical brake |
|
||||
| 5 | GPIO5 | general purpose | **analog input** (*) | | | | | | | | mechanical brake |
|
||||
| 6 | GPIO6 (*) (+) | **general purpose** | | | | | | | | | mechanical brake |
|
||||
| 7 | GPIO7 (*) (+) | **general purpose** | | | | | | | | | mechanical brake |
|
||||
| 8 | GPIO8 (*) (+) | **general purpose** | | | | | | | | | mechanical brake |
|
||||
| 9 | M0.A | general purpose | | | | | | | **ENC0.A** | | |
|
||||
| 10 | M0.B | general purpose | | | | | | | **ENC0.B** | | |
|
||||
| 11 | M0.Z | **general purpose** | | | | | | | | | |
|
||||
| 12 | M1.A | general purpose | | | | | | I2C.SCL | | **ENC1.A** | |
|
||||
| 13 | M1.B | general purpose | | | | | | I2C.SDA | | **ENC1.B** | |
|
||||
| 14 | M1.Z | **general purpose** | | | | | | | | | |
|
||||
| 15 | _not exposed_ | general purpose | | | | | **CAN_A.RX** | I2C.SCL | | | |
|
||||
| 16 | _not exposed_ | general purpose | | | | | **CAN_A.TX** | I2C.SDA | | | |
|
||||
|
||||
|
||||
(*) ODrive v3.5 and later <br>
|
||||
@@ -28,7 +28,8 @@ Notes:
|
||||
* Changes to the pin configuration only take effect after `odrv0.save_configuration()` and `odrv0.reboot()`
|
||||
* Bold font marks the default configuration.
|
||||
* If a GPIO is set to an unsupported mode it will be left uninitialized.
|
||||
* When setting a GPIO to a special purpose mode (e.g. `GPIO_MODE_UART0`) you must also enable the corresponding feature (e.g. `<odrv>.config.enable_uart`).
|
||||
* When setting a GPIO to a special purpose mode (e.g. `GPIO_MODE_UART_A`) you must also enable the corresponding feature (e.g. `<odrv>.config.enable_uart_a`).
|
||||
* Digital mode is a general purpose mode that can be used for these functions: step, dir, enable, encoder index, hall effect encoder, SPI encoder nCS.
|
||||
* You must also connect GND between ODrive and your other board.
|
||||
* ODrive v3.3 and onward have 5V tolerant GPIO pins.
|
||||
* Simultaneous operation of UART_A and UART_B is currently not supported.
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ Any of the numerical parameters that are writable from the ODrive Tool can be ho
|
||||
2. If you want to control your ODrive with the PWM input without using anything else to activate the ODrive, you can configure the ODrive such that axis 0 automatically goes operational at startup. See [here](commands.md#startup-procedure) for more information.
|
||||
3. In ODrive Tool, configure the PWM input mapping
|
||||
```
|
||||
odrv0.config.gpio4_mode = GPIO_MODE_PWM0
|
||||
odrv0.config.gpio4_mode = GPIO_MODE_PWM
|
||||
odrv0.config.gpio4_pwm_mapping.min = -2
|
||||
odrv0.config.gpio4_pwm_mapping.max = 2
|
||||
odrv0.config.gpio4_pwm_mapping.endpoint = odrv0.axis0.controller._remote_attributes['input_pos']
|
||||
|
||||
+9
-5
@@ -27,7 +27,8 @@ Take this info with a grain of salt as we might forget to update it from time to
|
||||
| 11 | DMA1_Stream0_IRQn | 4 |
|
||||
| 13 | DMA1_Stream2_IRQn | 10 |
|
||||
| 15 | DMA1_Stream4_IRQn | 10 |
|
||||
| 16 | DMA1_Stream5_IRQn | 3 |
|
||||
| 16 | DMA1_Stream5_IRQn | 10 |
|
||||
| 17 | DMA1_Stream6_IRQn | 10 |
|
||||
| 19 | CAN1_TX_IRQn | 9 |
|
||||
| 20 | CAN1_RX0_IRQn | 9 |
|
||||
| 21 | CAN1_RX1_IRQn | 9 |
|
||||
@@ -36,6 +37,7 @@ Take this info with a grain of salt as we might forget to update it from time to
|
||||
| 40 | EXTI15_10_IRQn | 1 |
|
||||
| 44 | TIM8_UP_TIM13_IRQn | 0 |
|
||||
| 45 | TIM8_TRG_COM_TIM14_IRQn | 6 |
|
||||
| 47 | DMA1_Stream7_IRQn | 3 |
|
||||
| 50 | TIM5_IRQn | 1 |
|
||||
| 52 | UART4_IRQn | 10 |
|
||||
| 67 | OTG_FS_IRQn | 6 |
|
||||
@@ -49,10 +51,12 @@ Take this info with a grain of salt as we might forget to update it from time to
|
||||
|
||||
| Name | Prio | Channel | High Level Func |
|
||||
|--------------|------|----------------------------------|-----------------|
|
||||
| DMA1_Stream0 | 1 | 0 (SPI3_RX) | SPI |
|
||||
| DMA1_Stream2 | 0 | 4 (UART4_RX) | UART0 |
|
||||
| DMA1_Stream4 | 0 | 4 (UART4_TX) | UART0 |
|
||||
| DMA1_Stream5 | 2 | 0 (SPI3_TX) | SPI |
|
||||
| DMA1_Stream0 | 1 | 0 (SPI3_RX) | SPI_A |
|
||||
| DMA1_Stream2 | 0 | 4 (UART4_RX) | UART_A |
|
||||
| DMA1_Stream4 | 0 | 4 (UART4_TX) | UART_A |
|
||||
| DMA1_Stream5 | 0 | 4 (USART2_RX) | UART_B |
|
||||
| DMA1_Stream6 | 0 | 4 (USART2_TX) | UART_B |
|
||||
| DMA1_Stream7 | 2 | 0 (SPI3_TX) | SPI_A |
|
||||
| DMA2_Stream0 | 0 | 0 (ADC1) | freerunning ADC |
|
||||
|
||||
|
||||
|
||||
+14
-2
@@ -1,6 +1,6 @@
|
||||
# UART Interface
|
||||
|
||||
The ODrive's UART0 interface is enabled by default with a baudrate of 115200 on the pins as shown in [Pinout](pinout).
|
||||
The ODrive's UART_A interface is enabled by default with a baudrate of 115200 on the pins as shown in [Pinout](pinout).
|
||||
|
||||
To use UART connect it like this:
|
||||
|
||||
@@ -10,4 +10,16 @@ To use UART connect it like this:
|
||||
|
||||
The logic level of the ODrive is 3.3V. The GPIOs are 5V tolerant.
|
||||
|
||||
You can use `odrv0.config.uart0_baudrate` to change the baudrate and `odrv0.config.enable_uart0` to disable/reenable UART0. Currently the UART port runs both the [Native Protocol](native-protocol) and the [ASCII Protocol](ascii-protocol) at the same time.
|
||||
You can use `odrv0.config.uart_a_baudrate` to change the baudrate and `odrv0.config.enable_uart_a` to disable/reenable UART_A. Currently the UART port runs both the [Native Protocol](native-protocol) and the [ASCII Protocol](ascii-protocol) at the same time.
|
||||
|
||||
### How to use UART on GPIO3/4
|
||||
|
||||
If you need GPIO1/2 for some function other than UART you can disable UART_A and instead use UART_B on GPIO3/4. Here's how you do it:
|
||||
|
||||
odrv0.config.enable_uart_a = False
|
||||
odrv0.config.gpio1_mode = GPIO_MODE_DIGITAL
|
||||
odrv0.config.gpio2_mode = GPIO_MODE_DIGITAL
|
||||
odrv0.config.enable_uart_b = True
|
||||
odrv0.config.gpio3_mode = GPIO_MODE_UART_B
|
||||
odrv0.config.gpio4_mode = GPIO_MODE_UART_B
|
||||
odrv0.reboot()
|
||||
|
||||
Reference in New Issue
Block a user