Skip to content

Exclude target-specific pins from GPIO tests with the FPGA shield #10459

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

Closed
wants to merge 2 commits into from

Conversation

fkjagodzinski
Copy link
Member

Description

Most of the HAL tests that use the FPGA shield only use pins present in a PinMap specific for given peripheral. There is no PinMap for GPIOs, but some board-specific pins have to be excluded from testing due to hardware limitations. This patch adds a pinmap_restricted_pins_gpio() function that every target can override if needed.

Pull request type

[ ] Fix
[ ] Refactor
[ ] Target update
[x] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

@c1728p9 @jamesbeyond @mprse @maciejbocianski

Release Notes

Add a weak pinmap_restricted_pins_gpio() that every target can override and provide a list of pins that should be skipped during the GPIO tests (in addition to pinmap_restricted_pins()).

Filip Jagodzinski added 2 commits April 23, 2019 16:52
Add a `pinmap_restricted_pins_gpio()` that is used to skip pins during
the GPIO test.
@@ -83,3 +83,5 @@ MBED_WEAK const PinList *pinmap_restricted_pins()
return &pin_list;
}
```

In addition to `pinmap_restricted_pins()`, the `pinmap_restricted_pins_gpio()` is used to skip pins during GPIO testing. By default this function returns an empty list and any target can override it to provide a list of pins that should be skipped. For example, D14 and D15 pins present in the Arduino form factor of FRDM-K64F have fixed pull-up resistors. The `PullDown` `PinMode` is impossible to test. However, other peripherals like the I2C may be successfully tested on these pins.
Copy link
Contributor

Choose a reason for hiding this comment

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

Its likely that more exclusion lists will be needed for various hardware quirks. What about something like pinmap_pin_info(PinName pin, pin_info_t *info) which returns a structure of info for the given pin? This could take the place of both pinmap_restricted_pins() and pinmap_restricted_pins_gpio() by having these as fields in the struct. As new types of hardware anomalies are found they could be added to the struct. The struct could look something like this (As an example):

typedef struct {
    bool restricted;    // Pin should be avoided for all tests
    PullType pull;      // Pin has a hardware pullup or pulldown or is not pulled
    bool i2c_shared;    // One or more I2C devices may be connected to this pin
    bool spi_shared;    // One or more SPI devices may be connected to this pin
    bool needs_jumper;  // This pin is unconnected with default board jumper setting
} pin_info_t;

@maclobdell what are your thoughts on something like this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds like a good idea. A weak pinmap_pin_info() would do the trick. This would require updating https://github.com/ARMmbed/fpga-ci-test-shield/blob/master/mbed-code/test_utils.h, @maciejbocianski what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

@c1728p9 what will be use case of i2c_shared?
Actually we have only problems with gpio/gpio_irq tests. Limitation of others (i2c/spi/qspi/...) are or should be covered in PinMap_XXX. I think that for now having pinmap_restricted_pins_gpio list with pulled pins is enough

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree with @maciejbocianski -- I don't see any need for more exclusion lists for now.

@ciarmcom
Copy link
Member

@fkjagodzinski, thank you for your changes.
@mprse @maclobdell @maciejbocianski @MarceloSalazar @jamesbeyond @c1728p9 @ARMmbed/mbed-os-hal @ARMmbed/mbed-os-maintainers please review.

@maclobdell
Copy link
Contributor

Instead of having a black list of restricted pins, could we have a white list of pins that are suitable for gpio use? we could have partners provide this list for their boards based on criteria we set (pin doesn't have external components on it, etc). Also a white list could show customers which pins are available in a board for use. And it also would give a list of pins to test. That seems less complex than having to test all pins, see which fail, analyze why they fail, and then add them to the black list. Just some friendly feedback.

@0xc0170
Copy link
Contributor

0xc0170 commented May 2, 2019

Instead of having a black list of restricted pins, could we have a white list of pins that are suitable for gpio use? we could have partners provide this list for their boards based on criteria we set (pin doesn't have external components on it, etc). Also a white list could show customers which pins are available in a board for use. And it also would give a list of pins to test. That seems less complex than having to test all pins, see which fail, analyze why they fail, and then add them to the black list. Just some friendly feedback.

@fkjagodzinski Can you review?

Actually we have only problems with gpio/gpio_irq tests. Limitation of others (i2c/spi/qspi/...) are or should be covered in PinMap_XXX. I think that for now having pinmap_restricted_pins_gpio list with pulled pins is enough

Maybe too big hammer but why this value "PinMapMode" is not part of PinMap ? Do we know additional function for just gpio? If we know this pin up has pull up on board, it is pin's attribute we can't change and should be part of the pin. If we test it, we would check this one and find out "pull up there, dont test any other pin mode".

@fkjagodzinski
Copy link
Member Author

Instead of having a black list of restricted pins, could we have a white list of pins that are suitable for gpio use? (...)

@maclobdell Thanks for your input! Actually all of the pins present in a given form factor (e.g. returned by pinmap_ff_default_pins()) are expected to handle GPIO, so the PinList* returned by GPIO white list would likely duplicate that for most of the targets.

@fkjagodzinski
Copy link
Member Author

Maybe too big hammer but why this value "PinMapMode" is not part of PinMap ? Do we know additional function for just gpio? If we know this pin up has pull up on board, it is pin's attribute we can't change and should be part of the pin. If we test it, we would check this one and find out "pull up there, dont test any other pin mode".

@0xc0170 Just to make it clear -- you suggest adding a PinMode member to

mbed-os/hal/pinmap.h

Lines 30 to 34 in 42a9a7a

typedef struct {
PinName pin;
int peripheral;
int function;
} PinMap;

This sounds like a good idea, but unfortunately we do not have any PinMap for GPIO currently anyway.

Initially, I wanted to add a GPIO PinMap to have a list of pins testable with the FPGA shield, but eventually, I decided to propose this patch since it's a lot simpler.

@adbridge
Copy link
Contributor

@0xc0170 are you happy with the responses to your questions ? Can we move this forward?

@0xc0170
Copy link
Contributor

0xc0170 commented May 22, 2019

Yes it is, this can be as improvement then 👍 However, if this is not must be in 5.13, I would consider it. As it is here it is easier to patch but is this future proof ? Does this align what we have already? If answer is yes, then lets go ahead with this patch.

@0xc0170 0xc0170 requested a review from donatieng May 23, 2019 08:20
@0xc0170
Copy link
Contributor

0xc0170 commented May 23, 2019

CI started meanwhile

@mbed-ci
Copy link

mbed-ci commented May 23, 2019

Test run: FAILED

Summary: 2 of 7 test jobs failed
Build number : 1
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_build-IAR
  • jenkins-ci/mbed-os-ci_mbed2-build-IAR

@fkjagodzinski
Copy link
Member Author

Ok, to speed things up a bit, I prepared an alternative patch that uses the whitelist/pinmap approach instead of providing a function to exclude pins.
@0xc0170 @maclobdell @c1728p9 Could you take a look at #10644?

@0xc0170
Copy link
Contributor

0xc0170 commented May 24, 2019

Closing this in favor of 10644

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.

8 participants