Skip to content

Powerloop UART Flashing#3661

Open
Andrewyx wants to merge 7 commits intoUBC-Thunderbots:masterfrom
Andrewyx:Andrewyx/uart_flashing
Open

Powerloop UART Flashing#3661
Andrewyx wants to merge 7 commits intoUBC-Thunderbots:masterfrom
Andrewyx:Andrewyx/uart_flashing

Conversation

@Andrewyx
Copy link
Copy Markdown
Contributor

@Andrewyx Andrewyx commented Mar 27, 2026

Description

Implements serial flashing using UART via the RX & TX gpio pins of the raspberry pi. Flashing commands have not been altered from ansible. Updates setup scripts to configure platformio natively on the PI. Furthermore, adds autoflashing so that boot and reset no longer need to be pressed.

Testing Done

Flashing completes successfully. Powerloop must still be verified on a protobot.

Resolved Issues

Resolves #3662

Length Justification and Key Files to Review

Review Checklist

It is the reviewers responsibility to also make sure every item here has been covered

  • Function & Class comments: All function definitions (usually in the .h file) should have a javadoc style comment at the start of them. For examples, see the functions defined in thunderbots/software/geom. Similarly, all classes should have an associated Javadoc comment explaining the purpose of the class.
  • Remove all commented out code
  • Remove extra print statements: for example, those just used for testing
  • Resolve all TODO's: All TODO (or similar) statements should either be completed or associated with a github issue

@Andrewyx Andrewyx marked this pull request as ready for review March 27, 2026 23:15
williamckha
williamckha previously approved these changes Mar 27, 2026
Comment thread src/software/power/BUILD
Comment thread src/software/embedded/setup_robot_software_deps.sh Outdated
@Andrewyx Andrewyx requested review from StarrryNight and nycrat April 7, 2026 23:16
Copy link
Copy Markdown
Member

@nycrat nycrat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some comments about adding comments. I'm not too familiar with the ansible or platformio code so perhaps there might be things that I've missed

Comment on lines +54 to +55
sudo raspi-config nonint do_serial_hw 0
sudo raspi-config nonint do_serial_cons 1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps add comment to explain these two lines, very unclear at first read about their purpose

Comment on lines +31 to +49
def set_gpio(pin, value):
try:
sysfs_gpio(pin, value)
except Exception:
v = "dh" if value == PinState.HIGH else "dl"
try:
subprocess.run(
["pinctrl", "set", str(pin), "op", v],
check=True,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
except Exception:
subprocess.run(
["raspi-gpio", "set", str(pin), "op", v],
check=False,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest adding comments to this function; it is very unclear in what circumstance sysfs_gpio would throw an exception and what the code does to handle the exception

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Powerloop Header Flashing

3 participants