-
Notifications
You must be signed in to change notification settings - Fork 3k
STM32H7: Don't configure GPIO port pinout for _c pins #14707
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
Conversation
@pennam, thank you for your changes. |
// Configure GPIO | ||
#if defined(ALTC) | ||
if ((pin != PA_0C) && (pin != PA_1C) && (pin != PC_2C) && (pin != PC_3C)) | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will stop analog support of arduino Ax pins ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, analog Ax pins are working also after the change. On our board we are using PA_0C
PA_1C
PC_2C
PC_3C
PC2
PC3
PA4
and PA6
as analog input pins and they are all working. It's my understanding that there is no need (and it is in some way wrong) to call the pinmap_pinout
functions for PX_XC because they cannot be configured as all the others GPIO. pinmap_pinout
function is used to change GPIO port configuration (pull-up, pull-down, speed, input output...) but this pins don't have these options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, it's working because in analogin, pinmap_pinout sets pin to analog and PullNone, which is the default pin state...
But I don't like the current correction :-)
I am thinking about a better patch in pinmap.c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you have a look on jeromecoutant@ca862ed
Hi @jeromecoutant thanks for your proposal. Creating configure_dualpad_switch() inside pinmap.c makes a lot of sense regardless my changes. I dind't have the chance to test it yet, but i don't think this jeromecoutant@ca862ed changes will fix the issue with the ethernet interface. mbed-os/targets/TARGET_STM/pinmap.c Lines 70 to 75 in 8a0c3c7
calling pin_function(PA_1C, data) gpio will point to port A address and ll_pin is 1 so it will reconfigure PA1 as analog input, breaking ethernet interface. There are 16 GPIO for each port from PX_0 to PX_15 so my idea is that PX_1C does not fit into these registers, and they don't have to be configured for _C pins. I will try to test it again tomorrow adding some debug prints to be more confident of the outcome. |
OK! We agree that the pinmap.c implementation still misses some use case! I propose to keep this PR opened till a full and verified version is not merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting for the correction in pinmap.c
This pull request has automatically been marked as stale because it has had no recent activity. @ARMmbed/mbed-os-maintainers, please complete review of the changes to move the PR forward. Thank you for your contributions. |
@jeromecoutant Yes, it works! I'm closing this pr because #14733 solves the issue. Thanks. |
Summary of changes
On
PORTENTA
, but also onDISCO-H747I
PA1 pin is used as ethernet refclock and PA1_C as analog input.When ethernet connection is running instantiating an AnalogIn input on PA1_C will cause ethernet connection hang.
It's my understanding that _c pins are not mapped as all the other GPIO because they are analog only pins. Calling pinmap_pinout function on _c pins actually changes the configuration of the non _c pin.
pinmap_pinout(PA_0C, PinMap_ADC) changes the output configuration of PA_0;
pinmap_pinout(PA_1C, PinMap_ADC) changes the output configuration of PA_1 and so on...
Impact of changes
STM32H747xI STM32H7A3xIQ STM32H743xI
Migration actions required
Documentation
Pull request type
Test results
To reproduce the issue this program can be used, at the moment i've only tested it on PORTENTA
Reviewers
@facchinm @jeromecoutant