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

[Gen 4] change coexistence behavior in wifi connecting or wifi connected states with background BLE low prio activity #2764

Open
wants to merge 30 commits into
base: develop
Choose a base branch
from

Conversation

avtolstoy
Copy link
Member

TODO

volatile bool s_wifiConnectionState = false;
volatile bool s_tdmaSkip = false;

uint32_t s_coexTable[3] = {0x55555555, 0xaaaa5555, 0xf0ffffff};
Copy link
Member Author

Choose a reason for hiding this comment

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

0x55555555 == BT > WLAN, 0xaaaa5555 == WLAN high-Priority > BT > WLAN low-Priority

@scott-brust scott-brust modified the milestones: 5.8.1, 5.8.2 May 6, 2024
@avtolstoy avtolstoy force-pushed the fix/rtl872x-wifi-ble-coex branch 2 times, most recently from 62f327c to dc777df Compare May 22, 2024 13:54
Copy link
Member

@scott-brust scott-brust left a comment

Choose a reason for hiding this comment

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

Some general questions. Still need to try to understand the actual coexistence changes and their implications

@@ -1,8 +1,20 @@
MAIN_STACK_SIZE = 4096

# # FIXME
Copy link
Member

Choose a reason for hiding this comment

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

Are these fixed in the prebootloader-part1 makefile below?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, this should probably be removed.

configureDeepSleepWakeupSource(config);
enterDeepSleep();
// It should not reach here
} else {
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
Copy link
Member

Choose a reason for hiding this comment

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

This disables systick, which should stop the freertos scheduler from swapping in other tasks? So effectively we stop FreeRTOS at this point? Hibernate will restart, so we dont care about starting the OS again?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup. Exactly right.

* @param reserved
* @return int
*/
int hal_ble_internal(int type, void* data, size_t size, void* reserved);
Copy link
Member

Choose a reason for hiding this comment

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

Just double checking we still want to include this hook. I assume its still useful for testing stuff?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, let's leave it in, might want to tune things up in runtime.

#define OS_THREAD_PRIORITY_NETWORK (7)
#define OS_THREAD_PRIORITY_NETWORK_HIGH (8)
#define OS_THREAD_PRIORITY_NETWORK (6)
#define OS_THREAD_PRIORITY_NETWORK_HIGH (7)
Copy link
Member

Choose a reason for hiding this comment

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

Do these changes have any effect? Do we know what priority the SDK threads run at? Do we need to take into account their priorities perhaps?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is just fixing the general problem: MAC network threads should be below LwIP TCP/IP thread.

info.end = (uint32_t)&link_prebootloader_wifi_fw_ram_end;
DCache_CleanInvalidate((uint32_t)&info, sizeof(info));
rtl_wifi_fw_resp resp = {};
int r = km0_km4_ipc_send_request(KM0_KM4_IPC_CHANNEL_GENERIC, KM0_KM4_IPC_MSG_WIFI_FW_INIT, &info, sizeof(info), [](km0_km4_ipc_msg_t* msg, void* context) -> void {
Copy link
Member

Choose a reason for hiding this comment

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

What does the "wifi firmware" actually do? Why does it need to run on KM0?

Copy link
Member Author

Choose a reason for hiding this comment

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

It manages low power wifi modes and mainly for our use-case prioritization between wifi and bt slots. Pretty much the main thing it does in simple terms is set up an interrupt at TBTT interval (100ms generally, depends on AP settings) and depending on the coexistence configuration may switch the RF frontend between WiFi and BLE peripheral. Of course it's a bit more complex than simply that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants