-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
tests: gpio: Add check to validate initial values of gpio output #25148
Comments
@albertofloyd I understand that issue relates to an Input pin of the Microchip board.
That setup will define that if pin receives HIGH signal, on logical level it will be 1 (as common). What do you mean "Check via loopback"? I can't understand that process. I see in the code there are already zassert to check gpio_pin_configure output. |
Test enhancement is not MCHP-specific, though the issue was found in MCHP board. The enhancement is to update gpio test case so gpio initialization issues not taking effect can be caught. Current oversimplified gpio test case sequence
Original issue in MCHP board. Suggested enhancement |
Thank you for a such detailed explanation, I'm working on it. |
@albertofloyd Please take a look at my PR #26934 |
@maksimmasalski The idea was to perform get_pin() operation immediate after gpio_pin_configure() which seems to be part of latest test. Latest test code
|
I understand that check is already performed, but it is not working. Seems like deep underlying issue. P.S. Next week I will have vacation, so can't continue work on it and find out the root cause. |
@albertofloyd agreed, see my summary at #26934 (comment). It's possible that 2f8167f fixed the problem. |
Unless the problem can be reproduced by reverting #25103 and re-testing I think this should just be closed. |
@albertofloyd Exactly; please do that. I would, but I don't have the hardware. |
Reverted #25103 and test gpio basic test still passes. However, I think a more robust case test approach would be to configure using both flags supported by API. GPIO_OUTPUT_LOW, GPIO_OUTPUT_HIGH
|
@albertofloyd I'm still confused. Lines 84 through 105 test output low. Lines 107 through 121 test output high. If I make the changes you suggest the test fails on nrf52840dk_nrf52840:
which is expected (the changes are incomplete). If I add:
the tests pass, but they're redundant with the tests that follow immediately, and we're not checking whether setting output to low initially succeeds. Either high or low needs to be tested first; swapping them might detect a problem on But also the test could reconfigure both test pins to disconnected (where supported) between checking high and low, in case there's something about explicitly setting the direction that changes the behavior. I've opened #27218 to see whether that has any effect. Please test it with and without #25103. |
@pabigot
Current test sequence
What I meant (but fail to conveyed) was to reverse 1 and 3 to catch the bug. #27218 looks good will try it tomorrow |
Thanks; that's something I hypothesized but didn't know for sure.
Swapping the order wouldn't be sufficient: there are GPIO peripherals where the default output value is high (SX1509B at power-up, for example): if |
Is your enhancement proposal related to a problem? Please describe.
Issue like this could be catch in sanity check for specific-boards.
#25101
Describe the solution you'd like
Current gpio test needs to add an additional test step where the following is done.
Additional context
In some some boards, some GPIO are not explicitly set using set_raw_xx() and they rely in initial configuration from device tree values.
If gpio drivers have problems to set initial values, this can lead to increase power consumption and/or incorrect behavior.
The text was updated successfully, but these errors were encountered: