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

Inconsistent SPI GPIO Behavior on PC Engines APU3 with RTE and OSFV #86

Open
7 tasks
pietrushnic opened this issue Dec 30, 2024 · 5 comments
Open
7 tasks
Assignees

Comments

@pietrushnic
Copy link
Contributor

pietrushnic commented Dec 30, 2024

While setting up a PC Engines APU3 with RTE v1.1 and OSFV CLI in a homelab, several challenges were encountered, primarily related to SPI GPIO configuration and its management across different setups. The issues include discrepancies between lab and homelab environments, missing or incomplete documentation, and confusion around OSFV CLI configuration for different RTE versions.

Key piece of code relevant to this issue is here.

  • SPI GPIO pins (e.g., gpio404-406) are not enabled by default in the homelab setup, preventing SPI flash detection.
  • Enabling these GPIOs manually resolves the issue, suggesting that OSFV CLI does not handle SPI GPIO states automatically in this configuration.
  • Lab setups should use older RTE versions (v1.0), which do not manage SPI GPIO enable/disable states. Our database reported this, but the behavior shows something different (SPI GPIO enable/disable works).
  • The homelab uses RTE v1.1, where SPI GPIO management should be handled but seems misconfigured.
  • The current APU3 model configuration in OSFV CLI assumes older RTE versions and does not correctly handle SPI GPIO states for RTE v1.1.
  • Creating a custom configuration with the correct programmer (rte_1_1) resolves the issue.
  • Information on setting up GPIOs, RTE versions, and configuration is scattered and incomplete. I had no idea I had to create additional configuration while adding my homelab platform.
  • Existing guides potentially do not adequately address RTE v1.1-specific behaviors or how to create customized configurations for homelab setups.
  • SPI GPIO configuration seems to persist across reboots, which may lead to even more significant confusion I get into.

What can we do?

  • Add the OSFV CLI APU3 model to include the correct configuration for RTE v1.1. src/osfv/models: add my apu3 homelab model #87
  • Enhance documentation:
  • Introduce better mechanisms in OSFV CLI to allow overriding configurations via arguments or external files.
    • Maybe all model parameters should be configurable by the command line. IMHO, I would notice that, but the configuration in the model I completely missed.
  • Educate users, partners, and 3mdeb employees on adding and customizing configurations, possibly through Dasharo User Guide (DUG) or vPub.
@pietrushnic
Copy link
Contributor Author

pietrushnic commented Dec 31, 2024

I also have some concerns regarding RteCtrl and initialization of GPIO. Behavios seem to inconsistent at least on RTE v1.1.0 I tried something like on RTE OS v0.7.5:

  1. Set gpio404-406 to init_value 0 in /etc/RteCtrl/RteCtrl.cfg
  2. poweroff
  3. Disconnect power cable (G3)
  4. Power on
  5. check status of gpio:
root@rte:~# cat /sys/class/gpio/gpio40{4,5,6}/value
1
1
1

More to that I was not able to disable those GPIO:

root@rte:~# echo 0 > /sys/class/gpio/gpio404/value
root@rte:~# echo 0 > /sys/class/gpio/gpio406/value
root@rte:~# echo 0 > /sys/class/gpio/gpio405/value
root@rte:~# cat /sys/class/gpio/gpio40{4,5,6}/value
1
1
1

So, I cannot test if #87 works fine.

@macpijan
Copy link
Contributor

So, I cannot test if #87 works fine.

This second comment is based on the RTE in 3mdeb lab, or in your homelab? As in the first comment you say: Creating a custom configuration with the correct programmer (rte_1_1) resolves the issue.

@pietrushnic
Copy link
Contributor Author

It is for my home lab. AFAIK I cannot power down and power up RTE remotely in the 3mdeb lab.

I should write that it should resolve the issue. It is not yet proven, but the code leads to that.

@pietrushnic
Copy link
Contributor Author

pietrushnic commented Dec 31, 2024

It is all weird behavior:

3mdeb lab:

root@rte:~# cat /sys/class/gpio/gpio40{4,5,6}/value
1
1
1
root@rte:~# echo 1 > /sys/class/gpio/gpio406/value
root@rte:~# cat /sys/class/gpio/gpio40{4,5,6}/value
0
0
1
root@rte:~#

@pietrushnic
Copy link
Contributor Author

pietrushnic commented Dec 31, 2024

I was able to test it with the procedure for disabling SPIO GPIOs:

root@rte:~# cat /sys/class/gpio/gpio40{4,5,6}/value
1
1
1
root@rte:~# echo 1 > /sys/class/gpio/gpio406/value
root@rte:~# cat /sys/class/gpio/gpio40{4,5,6}/value
0
0
1
root@rte:~# echo 0 > /sys/class/gpio/gpio406/value
root@rte:~# cat /sys/class/gpio/gpio40{4,5,6}/value
0
0
0

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

No branches or pull requests

2 participants