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

Add kconfig options for rp2040 uart #6549

Merged

Conversation

amken3d
Copy link
Contributor

@amken3d amken3d commented Apr 4, 2024

Current implementation only supports UART0 on Pin0 and 1.
This change brings in all the possible UART 0 and 1 pin combinations for the RP2040.
Has been tested on a custom board with UART1 on 24,25

@JamesH1978
Copy link
Collaborator

Thank you for submitting a PR, pleas refer to point 3 in "What to expect in a review" in https://github.com/Klipper3d/klipper/blob/master/docs/CONTRIBUTING.md and provide a signed off by line.

Thanks
James

amken3d added 3 commits April 18, 2024 08:20
… combinations for RP2040

Signed-off-by:Hriday Keni <info@amken.us>
… combinations for RP2040

Signed-off-by:Hriday Keni <info@amken.us>
Signed-off-by:Hriday Keni <info@amken.us>
@amken3d amken3d force-pushed the Add-Kconfig-options-for-RP2040-uart branch from 97cfc56 to a1a8e8c Compare April 18, 2024 12:33
@amken3d
Copy link
Contributor Author

amken3d commented Apr 18, 2024

I have included the sign off line for each commit and rebased.
Thank you

Copy link
Collaborator

@KevinOConnor KevinOConnor left a comment

Choose a reason for hiding this comment

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

Thanks. We can certainly add additional serial options for the rp2040. However, please layout the user facing menu (and backend Kconfig code) in the same style as the stm32 serial selection menu. That is, we want to have a single flat menu with all the meaningful user facing communication options. Also, like on stm32, it's probably a good idea to tie the less used serial options to CONFIG_LOW_LEVEL_OPTIONS.

I also have a minor comment on the implementation - see below.

-Kevin

Comment on lines 107 to 114

#if CONFIG_RP2040_SERIAL_UART0
enable_pclock(RESETS_RESET_UART0_BITS);
uint32_t pclk = get_pclock_frequency(RESETS_RESET_UART0_BITS);
#elif CONFIG_RP2040_SERIAL_UART1
enable_pclock(RESETS_RESET_UART1_BITS);
uint32_t pclk = get_pclock_frequency(RESETS_RESET_UART1_BITS);
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please avoid #if in the executable code - prefer if (CONFIG_RP2040_SERIAL_UART0) ...

@KevinOConnor KevinOConnor added the pending feedback Topic is pending feedback from submitter label Apr 20, 2024
amken3d added 2 commits April 23, 2024 21:42
Signed-off-by: hrken1 <info@amken.us>
Signed-off-by: hrken1 <info@amken.us>
@amken3d
Copy link
Contributor Author

amken3d commented Apr 24, 2024

@KevinOConnor, thank you for the feedback. I have made the changes you suggested.

image

image

image

@@ -3,21 +3,65 @@
// Copyright (C) 2021 Kevin O'Connor <kevin@koconnor.net>
//
// This file may be distributed under the terms of the GNU GPLv3 license.
//Modified 04/04/2024 by Amken3d (info@amken.us) to add all UART pin combos
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please don't add changelog information to the code - use the git commit messages for describing and documenting history. There's a brief note on this at https://www.klipper3d.org/CONTRIBUTING.html#what-to-expect-in-a-review . Sorry - I missed this in the previous review. Otherwise the changes look fine to me.

Thanks,
-Kevin

amken3d added 2 commits April 24, 2024 10:36
Signed-off-by: hrken1 <info@amken.us>
Signed-off-by: hrken1 <info@amken.us>
@amken3d
Copy link
Contributor Author

amken3d commented Apr 24, 2024

Done

@KevinOConnor KevinOConnor merged commit 0b329c5 into Klipper3d:master Apr 25, 2024
1 check passed
@KevinOConnor
Copy link
Collaborator

Thanks.

-Kevin

@amken3d amken3d deleted the Add-Kconfig-options-for-RP2040-uart branch April 25, 2024 13:38
richfelker pushed a commit to richfelker/klipper that referenced this pull request Jun 11, 2024
…3d#243)

Modified serial.c and Kconfig to dynamically select all possible UART combinations for RP2040

Signed-off-by: Hriday Keni <info@amken.us>
Co-authored-by: Amken USA <166057890+amken3d@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending feedback Topic is pending feedback from submitter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants