-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Use sky13317 antenna switch in Beagleconnect freedom #73488
Conversation
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.
Please:
- Move formatting changes to a different commit, if not a different PR.
- Add GPIO states to DT as well, not just pinmux.
- Verify pinmux/GPIO state for PA-on mode.
To explain some of the comments regarding formatting and stuff, I actually deleted the old |
I am going to seperate the seemigly format changes to a separate commit but do not, I am simply recreating a commit that is not originally supposed to exist (since I deleted the original file and replaced it with launchxl board_antenna). So somethings might still end up looking weird. |
825cb04
to
fd8f103
Compare
- This antenna switch is used by both beagleconnect_freedom and beagleplay. Signed-off-by: Ayush Singh <[email protected]>
It would be good to get this in for the LTS release. I think the gpio dt logic is sound and it fixes a long-standing hack that IIRC has been delayed for a long time. @Ayush1325 - can you verify that you've done reliable perf measurements with these changes for long-ish periods? @fgrandel would be a good source for that info (I think he had posted a table a while ago) I.e. is the link stable at <G frequencies? |
I will try to make zperf table as well. Do note that the zperf commands used #58439 (comment) is not usable, at least with the default config. The client runs out of Cache entry and never recovers. This has been the case since before the antenna patch. So let me adjust things. |
Ok, so here are the results. The config is just the default subg overlay with the following extra options:
I also tested removing GPIO toggling and using
As can be seen, there does not seem to be any regression (or improvement in performance) with the antenna patch, which is pretty much what was expected. But the GPIO toggling is definitely required. OutputsAntenna + No GPIO + IOC_PORT_RFC_GPO1uart:~$ zperf udp upload fe80::212:4b00:29b9:98f7 5001 10 64 200K
Remote port is 5001
Connecting to fe80::212:4b00:29b9:98f7
Duration: 10.00 s
Packet size: 64 bytes
Rate: 200 kbps
Starting...
Rate: 200 Kbps
Packet duration 2 ms
-
Upload completed!
Statistics: server (client)
Duration: 10.22 s (10.01 s)
Num packets: 804 (805)
Num packets out order: 0
Num packets lost: 0
Jitter: 7.76 ms
Rate: 40 Kbps (41 Kbps) Antenna + IOC_PORT_RFC_GPO1uart:~$ zperf udp upload fe80::212:4b00:29b9:98f7 5001 10 64 200K
Remote port is 5001
Connecting to fe80::212:4b00:29b9:98f7
Duration: 10.00 s
Packet size: 64 bytes
Rate: 200 kbps
Starting...
Rate: 200 Kbps
Packet duration 2 ms
-
Upload completed!
Statistics: server (client)
Duration: 10.17 s (10.01 s)
Num packets: 952 (953)
Num packets out order: 0
Num packets lost: 0
Jitter: 3.63 ms
Rate: 47 Kbps (48 Kbps) Antenna + No GPIO Patchuart:~$ zperf udp upload fe80::212:4b00:29b9:98f7 5001 10 64 200K
Remote port is 5001
Connecting to fe80::212:4b00:29b9:98f7
Duration: 10.00 s
Packet size: 64 bytes
Rate: 200 kbps
Starting...
Rate: 200 Kbps
Packet duration 2 ms
-
Upload completed!
Statistics: server (client)
Duration: 10.20 s (10.02 s)
Num packets: 724 (725)
Num packets out order: 0
Num packets lost: 0
Jitter: 5.27 ms
Rate: 36 Kbps (37 Kbps) Antennauart:~$ zperf udp upload fe80::212:4b00:29b9:98f7 5001 10 64 200K
Remote port is 5001
Connecting to fe80::212:4b00:29b9:98f7
Duration: 10.00 s
Packet size: 64 bytes
Rate: 200 kbps
Starting...
Rate: 200 Kbps
Packet duration 2 ms
-
Upload completed!
Statistics: server (client)
Duration: 10.14 s (10.01 s)
Num packets: 967 (968)
Num packets out order: 0
Num packets lost: 0
Jitter: 3.13 ms
Rate: 48 Kbps (49 Kbps) Mainlineuart:~$ zperf udp upload fe80::212:4b00:29b9:98f7 5001 10 64 200K
Remote port is 5001
Connecting to fe80::212:4b00:29b9:98f7
Duration: 10.00 s
Packet size: 64 bytes
Rate: 200 kbps
Starting...
ping fe80::212:4b00:29b9:98f7 timeout
Rate: 200 Kbps
Packet duration 2 ms
-
Upload completed!
Statistics: server (client)
Duration: 10.11 s (10.01 s)
Num packets: 949 (953)
Num packets out order: 0
Num packets lost: 0
Jitter: 3.64 ms
Rate: 48 Kbps (48 Kbps) Here is a branch with all the patches: https://github.com/Ayush1325/zephyr/tree/bct [edited by cfriedt] Comparison of above branch |
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.
Hi @Ayush1325 , thank you very much for removing inconsistencies between the BeagleConnect Freedom and the LaunchXL board. Very useful. My comments therefore focus on this intent, as you do not fully achieve it, yet, IMHO.
I'll ensure to re-review very quickly once you've made your changes so they can be included in the LTS release.
I have minimized the diff between ❯ diff boards/beagle/beagleconnect_freedom/board_antenna.c boards/ti/cc1352p1_launchxl/board_antenna.c
3,4d2
< * Copyright (c) 2021 Jason Kridner, BeagleBoard.org Foundation
< * Copyright (c) 2024 Ayush Singh <[email protected]>
26,30c24,31
< #define PINCTRL_STATE_ANT_SUBG 1
< #define PINCTRL_STATE_ANT_SUBG_PA 2
<
< #define BOARD_ANT_GPIO_PA 0
< #define BOARD_ANT_GPIO_SUBG 1
---
> #define PINCTRL_STATE_ANT_24G 1
> #define PINCTRL_STATE_ANT_24G_PA 2
> #define PINCTRL_STATE_ANT_SUBG 3
> #define PINCTRL_STATE_ANT_SUBG_PA 4
>
> #define BOARD_ANT_GPIO_24G 0
> #define BOARD_ANT_GPIO_PA 1
> #define BOARD_ANT_GPIO_SUBG 2
112a114,121
> }
> } else /* 2.4 GHz */ {
> if (paType == RF_TxPowerTable_HighPA) {
> pinctrl_apply_state(ant_pcfg, PINCTRL_STATE_ANT_24G_PA);
> } else {
> pinctrl_apply_state(ant_pcfg, PINCTRL_STATE_ANT_24G);
> /* Manually set the 2.4GHZ antenna switch DIO */
> gpio_pin_configure_dt(&ant_gpios[BOARD_ANT_GPIO_24G], 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.
Hi @Ayush1325, just minor stuff, that you may or may not fix. except for that ordering/readability problem, that should really be fixed.
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.
LGTM after realizing that there doesn't seem to be an ordering issue.
- Use antenna switch sky13317 instead of hack - Base the board_antenna file on cc1352p1_launchxl/board_antenna.c Signed-off-by: Ayush Singh <[email protected]>
- Fix formatting in board_antenna.c by using the standard config in Zephyr. - Reduce diff with cc1352p1_launchxl/board_antenna.c as much as possible Signed-off-by: Ayush Singh <[email protected]>
- Minimize diff between beagle/beagleconnect_freedom/board_antenna.c - Make functions static - Minor formatting - Remove unused ANTENNA_MUX - Use DT_FOREACH_PROP_ELEM_SEP for GPIO array Signed-off-by: Ayush Singh <[email protected]>
I approve. I think we can make it a bit more readable and flexible, but this is reasonable and it will take some time to refactor for any improvements as I'm not yet sure how to express in states in DT. |
Moving milestone to 4.0 as this is adding a new feature and we are way past rc1 |
Can you explain what you mean by new feature? The antenna switch was already working before this commit. The PR just moves stuff like GPIO to device tree instead of hardcoding the GPIOs here. It does not cause any impact on performance or well, anything else really. Just makes stuff more Zephyr way. |
Fixes #71285