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

Test circuits_gpio v2.0.0-pre.* on official Nerves targets #159

Closed
9 tasks done
fhunleth opened this issue Dec 30, 2023 · 16 comments
Closed
9 tasks done

Test circuits_gpio v2.0.0-pre.* on official Nerves targets #159

fhunleth opened this issue Dec 30, 2023 · 16 comments

Comments

@fhunleth
Copy link
Contributor

fhunleth commented Dec 30, 2023

This issue tracks testing on various systems.

Two kinds of tests are useful to report:

  1. Testing in apps that use Circuits.GPIO v1. See the porting guide
  2. Circuits.GPIO.Diagnostics.report(gpio1, gpio2) where you connect gpio1 and gpio2 together and let the Diagnostics module check things out.

Update your mix.exs with the following dependency and force if necessary: {:circuits_gpio, "~> 2.0.0-pre.3"}. If you don't want to think, check out and build the try-circuits_gpio-v2 branch of circuits_quickstart.

Please post the output of the Diagnostics report even if 100% successful just in case some target has unexpected performance issues.

Platforms of particular interest (reports from others are appreciated)

  • Raspberry Pi Zero W
  • Raspberry Pi Zero 2W
  • Raspberry Pi 3
  • Raspberry Pi 4
  • Raspberry Pi 5
  • BeagleBoneBlack or green, etc. nerves_system_bbb 2.20.1
  • BeagleBoneBlack or green, etc. nerves_system_bbb 2.19.x or earlier
  • MangoPi MQ-Pro
  • GRiSP2
@fhunleth
Copy link
Contributor Author

fhunleth commented Dec 30, 2023

Here's the MangoPi:

iex(2)> Circuits.GPIO.Diagnostics.report(36, 35)
Circuits.GPIO Diagnostics 2.0.0-pre.3

Output GPIO: 36
Input GPIO:  35

Output info: %Circuits.GPIO.Line{gpio_spec: {"gpiochip0", 36}, controller: "2000000.pinctrl", consumer: "circuits_gpio"}
Input info:  %Circuits.GPIO.Line{gpio_spec: {"gpiochip0", 35}, controller: "2000000.pinctrl"}
Backend: Circuits.GPIO.CDev

Simple writes and reads work: PASSED
Can set 0 on open: PASSED
Can set 1 on open: PASSED
Input interrupts sent: PASSED
Interrupt timing sane: PASSED
Internal pullup works: PASSED
Internal pulldown works: PASSED

Writes/second: 78623
Reads/second: 78272

All tests passed

@fhunleth
Copy link
Contributor Author

Here's the result on a BeagleBone Green Wireless:

iex(4)> Circuits.GPIO.Diagnostics.report(60, 112)
Circuits.GPIO Diagnostics 2.0.0-pre.2

Output GPIO: 60
Input GPIO: 112
Backend: Circuits.GPIO.CDev

Simple writes and reads work: PASSED
Can set 0 on open: PASSED
Can set 1 on open: PASSED
Input interrupts sent: PASSED
Interrupt timing sane: PASSED
Internal pullup works: PASSED
Internal pulldown works: FAILED 291: Assertion failed: GPIO.read(in_gpio) == 0


Speed test: 69713 writes/second

Failed

@fhunleth
Copy link
Contributor Author

Raspberry Pi 5
(I had to specify pins by label rather than by GPIO number. The pins were on gpiochip4)

iex(21)> Circuits.GPIO.Diagnostics.report("PIN36", "PIN38")
Circuits.GPIO Diagnostics 2.0.0-pre.2

Output GPIO: "PIN36"
Input GPIO: "PIN38"
Backend: Circuits.GPIO.CDev

Simple writes and reads work: PASSED
Can set 0 on open: PASSED
Can set 1 on open: PASSED
Input interrupts sent: PASSED
Interrupt timing sane: PASSED
Internal pullup works: FAILED 268: Assertion failed: GPIO.read(in_gpio) == 1
Internal pulldown works: FAILED 291: Assertion failed: GPIO.read(in_gpio) == 0


Speed test: 646412 writes/second

Failed

@pojiro
Copy link
Contributor

pojiro commented Jan 1, 2024

I tested Raspberry Pi 4 with 2.0.0-pre.2.

iex(2)> Circuits.GPIO.Diagnostics.report(16, 20)
Circuits.GPIO Diagnostics 2.0.0-pre.2

Output GPIO: 16
Input GPIO: 20
Backend: Circuits.GPIO.CDev

Simple writes and reads work: PASSED
Can set 0 on open: PASSED
Can set 1 on open: PASSED
Input interrupts sent: PASSED
Interrupt timing sane: PASSED
Internal pullup works: PASSED
Internal pulldown works: PASSED


Speed test: 335177 writes/second

All tests passed

@pojiro
Copy link
Contributor

pojiro commented Jan 1, 2024

I tested Raspberry Pi 3, 3B+, with 2.0.0-pre.2.

iex(1)> Circuits.GPIO.Diagnostics.report(16, 20)
Circuits.GPIO Diagnostics 2.0.0-pre.2

Output GPIO: 16
Input GPIO: 20
Backend: Circuits.GPIO.CDev

Simple writes and reads work: PASSED
Can set 0 on open: PASSED
Can set 1 on open: PASSED
Input interrupts sent: PASSED
Interrupt timing sane: PASSED
Internal pullup works: PASSED
Internal pulldown works: PASSED


Speed test: 232423 writes/second

All tests passed

@fhunleth
Copy link
Contributor Author

fhunleth commented Jan 1, 2024

@pojiro Could you confirm that GPIOs 16 and 20 are connected together? The results that you're getting suggest that there's no wire connecting them. If they are connected, could you post the output from Circuits.GPIO.enumerate() |> Enum.map(&IO.inspect/1).

Second idea: Try passing "PIN36" and "PIN38" instead of 16 and 20.

@fhunleth
Copy link
Contributor Author

fhunleth commented Jan 1, 2024

GRiSP2 with the GPIO1's PMOD connector pins 1 and 3 connected. (pin 2 didn't work?). See nerves-project/nerves_system_grisp2#68.

iex(26)> Circuits.GPIO.Diagnostics.report({"gpiochip0", 1}, {"gpiochip0", 3})
Unexpected return from reading gpio events: -1, errno=9
Circuits.GPIO Diagnostics 2.0.0-pre.2

Output GPIO: {"gpiochip0", 1}
Input GPIO: {"gpiochip0", 3}
Backend: Circuits.GPIO.CDev

Simple writes and reads work: PASSED
Can set 0 on open: PASSED
Can set 1 on open: PASSED
Input interrupts sent: PASSED
Interrupt timing sane: PASSED
Internal pullup works: FAILED 268: Assertion failed: GPIO.read(in_gpio) == 1
Internal pulldown works: FAILED 291: Assertion failed: GPIO.read(in_gpio) == 0


Speed test: 46848 writes/second

@pojiro
Copy link
Contributor

pojiro commented Jan 1, 2024

@fhunleth I didn't understand the protocol. Now I see it, tested again. So I updated the results, rpi3 and rpi4. Thanks.

@pojiro
Copy link
Contributor

pojiro commented Jan 1, 2024

I tested BeagleBoneBlack nerves_system_bbb 2.19.1 with 2.0.0-pre.2.

iex(2)> Circuits.GPIO.Diagnostics.report(67, 68)
Circuits.GPIO Diagnostics 2.0.0-pre.2

Output GPIO: 67
Input GPIO: 68
Backend: Circuits.GPIO.CDev

Simple writes and reads work: PASSED
Can set 0 on open: PASSED
Can set 1 on open: PASSED
Input interrupts sent: PASSED
Interrupt timing sane: PASSED
Internal pullup works: PASSED
Internal pulldown works: FAILED 291: Assertion failed: GPIO.read(in_gpio) == 0


Speed test: 76327 writes/second

Failed

I tested BeagleBoneBlack nerves_system_bbb 2.19.1 with 2.0.0-pre.3.

iex(1)> Circuits.GPIO.Diagnostics.report(67, 68)
Circuits.GPIO Diagnostics 2.0.0-pre.3

Output GPIO: 67
Input GPIO:  68

Output info: %Circuits.GPIO.Line{gpio_spec: {"gpiochip2", 3}, label: "P8_8", controller: "gpio-64-95", consumer: "circuits_gpio"}
Input info:  %Circuits.GPIO.Line{gpio_spec: {"gpiochip2", 4}, label: "P8_10", controller: "gpio-64-95"}
Backend: Circuits.GPIO.CDev

Simple writes and reads work: PASSED
Can set 0 on open: PASSED
Can set 1 on open: PASSED
Input interrupts sent: PASSED
Interrupt timing sane: PASSED
Internal pullup works: PASSED
Internal pulldown works: FAILED 325: Assertion failed: GPIO.read(in_gpio) == 0

Writes/second: 72606
Reads/second: 111043

Failed

@fhunleth
Copy link
Contributor Author

fhunleth commented Jan 1, 2024

@pojiro Great! Thank you for retesting and updating the reports. I'll be updating the diagnostics for the pre.3 release to make this more clear and also to give more explicit feedback when the basic test fails.

@fhunleth
Copy link
Contributor Author

fhunleth commented Jan 2, 2024

circuits_gpio v2.0.0-pre.3 is available now. It doesn't add any new checks to the diagnostics, but it does have more help when tests fail.

@Moosieus
Copy link

Moosieus commented Jan 2, 2024

Raspberry Pi Zero W on 2.0.0-pre.3:

iex(4)> Circuits.GPIO.Diagnostics.report(16, 20)

Circuits.GPIO Diagnostics 2.0.0-pre.3

Output GPIO: 16
Input GPIO:  20

Output info: %Circuits.GPIO.Line{gpio_spec: {"gpiochip0", 16}, label: "GPIO16", controller: "pinctrl-bcm2835"}
Input info:  %Circuits.GPIO.Line{gpio_spec: {"gpiochip0", 20}, label: "GPIO20", controller: "pinctrl-bcm2835"}
Backend: Circuits.GPIO.CDev

Simple writes and reads work: PASSED
Can set 0 on open: PASSED
Can set 1 on open: PASSED
Input interrupts sent: PASSED
Interrupt timing sane: PASSED
Internal pullup works: PASSED
Internal pulldown works: PASSED

Writes/second: 117302
Reads/second: 118245

All tests passed
true

@fhunleth
Copy link
Contributor Author

fhunleth commented Jan 3, 2024

@Moosieus Thanks for posting that. I just now noticed that the labels for pins 16 and 20 are "GPIO16" and "GPIO20" for that Raspberry Pi Zero, and that's different from the Raspberry Pi 5 (PINn where n is the physical GPIO connector pin number). That will certainly be confusing to people who don't know, so I added a note to the docs.

@Moosieus
Copy link

Moosieus commented Jan 3, 2024

Here's the Raspberry Pi Zero 2W on 2.0.0-pre.3 as well:

iex(1)> Circuits.GPIO.Diagnostics.report(16, 20)

Circuits.GPIO Diagnostics 2.0.0-pre.3

Output GPIO: 16
Input GPIO:  20

Output info: %Circuits.GPIO.Line{gpio_spec: {"gpiochip0", 16}, label: "GPIO16", controller: "pinctrl-bcm2835"}
Input info:  %Circuits.GPIO.Line{gpio_spec: {"gpiochip0", 20}, label: "GPIO20", controller: "pinctrl-bcm2835"}
Backend: Circuits.GPIO.CDev

Simple writes and reads work: PASSED
Can set 0 on open: PASSED
Can set 1 on open: PASSED
Input interrupts sent: PASSED
Interrupt timing sane: PASSED
Internal pullup works: PASSED
Internal pulldown works: PASSED

Writes/second: 230044
Reads/second: 232477

All tests passed
true

@fhunleth
Copy link
Contributor Author

fhunleth commented Jan 3, 2024

All boards are covered! Thanks @pojiro and @Moosieus!

I'm going to leave this issue open a little longer to review the failures. I think the failures are expected due to hardware limitations, though.

@fhunleth
Copy link
Contributor Author

Closing since the v2.0 updates are looking pretty good on official systems and proprietary boards and software.

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

3 participants