Re: [PATCH v1 1/2] Bluetooth: btnxpuart: Add msleep() after changing the baudrate

From: Paul Menzel
Date: Thu Mar 27 2025 - 17:53:10 EST


Dear Neeraj,


Thank you for your patch. For the summary/title, I suggest:

Sleep 100 ms after baud rate change

Am 27.03.25 um 19:25 schrieb Neeraj Sanjay Kale:
This adds a 100 millisec sleep after change baudrate vendor command.

It is observed that when the baudrate change command changes the
baudrate from 3000000 to 115200, any immediate HCI command returns an
error -22 (Device Busy).

Really 3 million?

Is this happening with every change, or only decreasing the baud rate with the values you listed?

Adding a small delay after the change baudrate command complete event is
received helps fix the issue.

100 ms is not small to me. Is this issue documented in the hardware documentation? Are there other ways like polling, if the command succeeded?

Signed-off-by: Neeraj Sanjay Kale <neeraj.sanjaykale@xxxxxxx>
---
drivers/bluetooth/btnxpuart.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c
index 5091dea762a0..e26fabe8fb3d 100644
--- a/drivers/bluetooth/btnxpuart.c
+++ b/drivers/bluetooth/btnxpuart.c
@@ -1238,6 +1238,8 @@ static int nxp_set_baudrate_cmd(struct hci_dev *hdev, void *data)
if (*status == 0) {
serdev_device_set_baudrate(nxpdev->serdev, nxpdev->new_baudrate);
nxpdev->current_baudrate = nxpdev->new_baudrate;
+ /* Allow sufficiant time for chip to switch to new baudrate */

Please add the datasheet section.
sufficient

+ sleep(100);
}
bt_dev_dbg(hdev, "Set baudrate response: status=%d, baudrate=%d",
*status, nxpdev->new_baudrate);


Kind regards,

Paul