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

Add support for UART_B on GPIO3/4 #492

merged 8 commits into from Nov 5, 2020

Add support for UART_B on GPIO3/4 #492

merged 8 commits into from Nov 5, 2020


Copy link

@samuelsadok samuelsadok commented Sep 24, 2020

Adds support for UART_B on GPIO3 and GPIO4. UART_A (on GPIO1/2) and UART_B can currently not be enabled at the same time.

This supersedes #383.

HWIL Test Log:
e7f046d: passes. With test-rig and test script modifications, TestUartAscii also passes on the new UART_B.
e15ab60:,, TestSpiEncoder(ENCODER_MODE_SPI_ABS_AMS) and TestSpiEncoder(ENCODER_MODE_SPI_ABS_CUI) pass.

Copy link

SG-O commented Oct 3, 2020

When I try to
execute odrv0.config.enable_uart1 = True
I get the following error:

In [1]: odrv0.config.enable_uart1
AttributeError                            Traceback (most recent call last)
~\Documents\GitHub\ODrive\Firmware\fibre\python\fibre\ in <module>
----> 1 odrv0.config.enable_uart1

~\Documents\GitHub\ODrive\Firmware\fibre\python\fibre\ in __getattribute__(self, name)
    243             return attr
    244         else:
--> 245             return object.__getattribute__(self, name)
    246             #raise AttributeError("Attribute {} not found".format(name))

AttributeError: 'RemoteObject' object has no attribute 'enable_uart1'

Copy link
Member Author

samuelsadok commented Oct 5, 2020

Whoops, looks like there was an error in the yaml, fixed now. I guess it must have sneaked in after testing but let me know if you have further problems.

Copy link

madcowswe commented Oct 8, 2020

Example of how to change active UART to GPIO 3/4:

odrv0.config.enable_uart0 = False
odrv0.config.gpio1_mode = GPIO_MODE_DIGITAL
odrv0.config.gpio2_mode = GPIO_MODE_DIGITAL
odrv0.config.enable_uart1 = True
odrv0.config.gpio3_mode = GPIO_MODE_UART1
odrv0.config.gpio4_mode = GPIO_MODE_UART1

Copy link

SG-O commented Oct 9, 2020

This fixed it for me! Thank you very much.
Also don't forget to run odrv0.save_configuration() 😄

Copy link

madcowswe commented Oct 14, 2020

@samuelsadok Can you change it to be UART_A and UART_B instead?
Can you also add some instructions similar to this to the documentation?

I2C0 => I2C_A
@samuelsadok samuelsadok changed the title Add support for UART1 on GPIO3/4 Add support for UART_B on GPIO3/4 Oct 15, 2020
Copy link
Member Author

samuelsadok commented Oct 15, 2020

Done. I also changed similar user-facing names (SPI0 => SPI_A, I2C0 => I2C_A, CAN0 => CAN_A, PWM0 => PWM) and verified that the relevant HWIL tests pass.
Edit: forgot to update the docs. Will do that shortly (after syncing devel with the recent doc changes on master).

Copy link

SG-O commented Oct 15, 2020

When I get home, I'll test the changes.

@samuelsadok samuelsadok merged commit 9345582 into devel Nov 5, 2020
1 check passed
@samuelsadok samuelsadok deleted the uart1 branch Nov 5, 2020
@Wetmelon Wetmelon added this to the v3.6 Next milestone Nov 10, 2020
@madcowswe madcowswe moved this from Review to Next release in ODrive Development Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
ODrive Development
Next release

Successfully merging this pull request may close these issues.

None yet

5 participants