Skip to content

Conversation

crasbe
Copy link
Contributor

@crasbe crasbe commented May 13, 2025

Contribution description

The CC2538 does not support "Open Drain" or "Open Drain with Pullup" outputs. However problems can arrise from setting both macros to the same value. This commit sets them to separate values which are both invalid to avoid conflicts with other applications.

The value of 0xf0 was chosen arbitrarily, but it is still very far away from the valid values:

/**
* @brief Values to override pin configuration
*/
typedef enum {
OVERRIDE_DISABLE = 0x0,
OVERRIDE_ANALOG = 0x1,
OVERRIDE_PULLDOWN = 0x2,
OVERRIDE_PULLUP = 0x4,
OVERRIDE_ENABLE = 0x8,
} cc2538_ioc_over_t;

Testing procedure

Unfortunately I don't have the hardware to test this, but the changes should be fairly obvious.

Issues/PRs references

Prerequisite for #10688.

@crasbe crasbe requested a review from gschorcht May 13, 2025 22:19
@crasbe crasbe added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels May 13, 2025
@github-actions github-actions bot added Platform: ARM Platform: This PR/issue effects ARM-based platforms Area: cpu Area: CPU/MCU ports labels May 13, 2025
@@ -154,7 +154,7 @@ typedef enum {
GPIO_IN_PU = ((uint8_t)OVERRIDE_PULLUP), /**< input, pull-up */
GPIO_OUT = ((uint8_t)OVERRIDE_ENABLE), /**< output */
GPIO_OD = (0xff), /**< not supported */
GPIO_OD_PU = (0xff) /**< not supported */
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if it wouldn't be more logical to change the value for GPIO_OD instead of GPIO_OD_PU to 0xfe to have the values in ascending order, as an enumeration normally does.

Copy link
Contributor Author

@crasbe crasbe May 13, 2025

Choose a reason for hiding this comment

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

Sure.

Edit: from a compiler or program standpoint, it shouldn't make a difference anyway, but I'm all for style too :)

@riot-ci
Copy link

riot-ci commented May 13, 2025

Murdock results

✔️ PASSED

ae0beee cpu/cc2538: distinguish between GPIO_OD and GPIO_OD_PU

Success Failures Total Runtime
10346 0 10346 11m:35s

Artifacts

Copy link
Contributor

@gschorcht gschorcht left a comment

Choose a reason for hiding this comment

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

Small change that should work also without having the possibility to test it. It is the exactly same way as handled for other CPUs, e.g. cpu/sam0_common.

@gschorcht
Copy link
Contributor

Please squash.

The CC2538 does not support "Open Drain" or "Open Drain with
Pullup" outputs. However problems can arrise from setting both
macros to the same value. This commit sets them to separate
values which are both invalid to avoid conflicts with other
applications.
@crasbe crasbe enabled auto-merge May 14, 2025 08:12
@crasbe crasbe added this pull request to the merge queue May 14, 2025
Merged via the queue into RIOT-OS:master with commit eb9fb74 May 14, 2025
25 checks passed
@crasbe
Copy link
Contributor Author

crasbe commented May 14, 2025

Thanks for reviewing :)

@crasbe crasbe deleted the pr/cc2538_gpio branch May 14, 2025 10:48
@Teufelchen1 Teufelchen1 added this to the Release 2025.07 milestone Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants