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 nanopi boards supported by periph.io #2157

Merged
merged 3 commits into from
Apr 4, 2023

Conversation

biotinker
Copy link
Member

Bee ring is using the nanopi neo air, which is now supported OOTB by periph.io periph/host#30

This means very little is required to use the nanopi neo air with RDK's genericlinux.

Tested this on the real hardware and confirmed that GPIO, i2c, and SPI are all working.

@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Apr 4, 2023
Copy link
Member

@penguinland penguinland left a comment

Choose a reason for hiding this comment

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

LGTM!

As a heads-up: although SPI, I2C, and basic I/O work, digital interrupts will not work via Periph (and therefore most encoders won't work, nor will the ultrasonic sensor). Hardware PWM also won't work, though software PWM should (which is fine at low frequencies, but becomes garbage if you get over 200 Hz).

Copy link
Member

@randhid randhid left a comment

Choose a reason for hiding this comment

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

LGTM, one little nit agree with @penguinland Hardware PWM won't work, but if it's not blocking for BeeRing this is fine for now.

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Apr 4, 2023
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Apr 4, 2023
@biotinker biotinker merged commit 29a10c3 into viamrobotics:main Apr 4, 2023
penguinland added a commit that referenced this pull request Apr 6, 2023
…#2171)

No changes to behavior should yet exist, as only a single board uses non-Periph pins so far. The changes to behavior will come when other boards start using non-Periph pins, which should allow them to use hardware PWM.

Changes include:
- Create the helper function `readIntFile` when initializing a board, and using that in several places instead of copying and pasting paragraphs of code.
- Rename `gpioChipInfo` to `gpioChipsInfo` because it contains data about multiple chips. This helps with other variable names later, when we need to specify whether we're talking about the `gpio` or `pwm` chip.
- Move the place where we look for hardware PWM chips, from where we initialize PWM structs to where we initialize the board's pin descriptions (the same place where we look for GPIO chips).
- Search for PWM devices in several different directories. The new directories added in are their locations on the BeagleBone and Up4000 boards, though neither of those are used yet because the BB still uses Periph for its pins and the Up4000 isn't ready to go yet. This is just preparation!
- Change the semantic meaning of the `PWMSysFsDir` field within the `GPIOBoardMapping` struct. It used to be a relative path within the one place we look for things, and it's now an absolute path because there are multiple places in sysfs that this directory might be, depending on which board you're on.

Future changes that are planned but will be in a separate PR:
- If you're unable to find a PWM device that you expect to find, _log the error but continue on._ Perhaps you're on a BeagleBone, which requires [modifying the device tree overlays from their factory defaults and then rebooting](https://forum.beagleboard.org/t/overlays-beaglebone-ai-64-pwm/32508), before you can see the PWM devices, and the rest of the board should still be usable as long as you don't try using hardware PWMs.
- Change the BeagleBone board to stop using Periph and start using our own implementation of GPIO pins, including support for hardware PWM.
- When the Up4000 board is further along, change it from Periph to this implementation, too.
- Same thing with the [nanopi board](#2157), though that's lower priority for now.

Tried on the Orin: everything still works normally. Tried on the BeagleBone: still needs work (hence why the future changes are not in this PR. They'll come later).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test This pull request is marked safe to test from a trusted zone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants