-
Notifications
You must be signed in to change notification settings - Fork 2k
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/periph/uart_locate_pins: new test/utility app #20253
Conversation
ea5767c
to
1e4932d
Compare
|
||
ifneq ($(MCU),esp32) | ||
# We only need 1 thread (+ the Idle thread on some platforms) and we really | ||
# want this app working on all boards. |
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.
I guess you could even do
DISBALE_MODULE += core_thread
Mind you that esp32 is not the only platform that uses core_idle_thread
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.
That's why it is 2 (because of the idle thread) or 3 on ESP (because of some ESP32 specific worker thread)
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.
ah ok - is that also true for esp8266?
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.
I think not, but then again I'm not sure. But DISABLE_MODULE += core_thread
works even better anyway.
tests/periph/uart_locate_pins/main.c
Outdated
static char buf[32]; | ||
size_t len = snprintf(buf, sizeof(buf), "P%u.%u / P%c%u\n", | ||
pins[i].port_num, pins[i].pin_num, | ||
(int)'A' + (int)pins[i].port_num, pins[i].pin_num); |
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.
If you want to save ROM you could use fmt
and set CONFIG_SKIP_BOOT_MSG=1
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.
I added a commit to just skip the boot message with stdio_null
regardless of CONFIG_SKIP_BOOT_MSG
. If the output is thrown away anyway, we can just as well safe the ROM/CPU cycles needed to prepare the output.
Tested with diff --git a/tests/periph/uart_locate_pins/main.c b/tests/periph/uart_locate_pins/main.c
index eeed7b9cd2..e2eb33605c 100644
--- a/tests/periph/uart_locate_pins/main.c
+++ b/tests/periph/uart_locate_pins/main.c
@@ -38,9 +38,41 @@ static const struct {
uint8_t port_num;
uint8_t pin_num;
} pins[] = {
+ {
+ .port_num = 1,
+ .pin_num = 8,
+ },
+ {
+ .port_num = 1,
+ .pin_num = 7,
+ },
+ {
+ .port_num = 1,
+ .pin_num = 6,
+ },
+ {
+ .port_num = 1,
+ .pin_num = 5,
+ },
+ {
+ .port_num = 1,
+ .pin_num = 4,
+ },
+ {
+ .port_num = 1,
+ .pin_num = 3,
+ },
+ {
+ .port_num = 0,
+ .pin_num = 27,
+ },
+ {
+ .port_num = 0,
+ .pin_num = 26,
+ },
{
.port_num = 0,
- .pin_num = 0,
+ .pin_num = 2,
},
};
and got:
|
This application uses `soft_uart` to bit-bang the name of a number of configured GPIO pins via said pins at 9600 Bd. This way attaching an USB UART bridge to one pin at a time easily reveals which MCU GPIO pin a given pin on a board corresponds to. This is useful when no schematic and no silkscreen labeling is available, or when the information is misleading or outright incorrect (looking at the E180-ZG120B-TB).
With `stdio_null` no one is reading the boot message anyway, so let's safe some ROM.
35b1a6c
to
b17b2b0
Compare
Sorry, an unrelated commit sneaked in. I had to force push to get rid of it |
Contribution description
This application uses
soft_uart
to bit-bang the name of a number of configured GPIO pins via said pins at 9600 Bd. This way attaching an USB UART bridge to one pin at a time easily reveals which MCU GPIO pin a given pin on a board corresponds to. This is useful when no schematic and no silkscreen labeling is available, or when the information is misleading or outright incorrect (looking at the E180-ZG120B-TB).Testing procedure
main.c
to contain some pins to detect where they are routed to on the board.Issues/PRs references
None