Other Parts Discussed in Thread: TPS65217
Tool/software: Linux
Hi all,
Our product is using CPU frequency scaling with the "ondemand" governor. Most of the time, streaming music while changing the CPU frequency works just fine, but from time to time we have an issue with the HCI UART link. It seems that after a CPU frequency change, the host cannot communicate anymore with the BT controller.
This issue can be reproduced playing audio over A2DP and running the cpu_scaling.sh script in parallel (see link below). This scripts sets the CPU governor to "userspace" and changes the CPU frequency randomly, without creating any additional CPU load. Switching the frequency from 800 MHz to 1 GHz also triggers the issue, meaning it is not related to a CPU shortage but more to a freeze/lock happening when the kernel change the frequency of the CPU.
HCILL:
After disabling BT deep sleep and HCILL, when the issue happens the HCI link stops working for a few hundreds of milliseconds but recovers after. My guess is that with HCILL, the BT controller is going to deep sleep while the host is changing its CPU frequency, so the host is missing the information and cannot communicate with the BT controller anymore. Without HCILL, packets are just delayed creating a cut, but the communication is still alive.
I'm not able to capture the HCI lines with a logic analyzer on my board, the lines are on a PCB layer that is not accessible.UART loopback:
I did some low-level tests to try to isolate and reproduce the problem more easily without the BT controller (see serial_loopback.py below). To run the test, you have to connect UART TX/RX, run "./serial_loopback.py /dev/ttyO1" with the correct serial port and run cpu_scaling.sh in parallel.
test01_delay shows no issue, basic delays (at least time.sleep()) are respected even when changing frequency.
test11_serial_loopback shows that sometimes when changing the CPU frequency, the UART loopback takes up to ~750 ms to complete (~10 ms in the normal case). Recompiling the kernel with CONFIG_PREEMPT_VOLUNTARY=y reduces the normal loopback time to a few ms, but the issue with the ~750 ms loopback is still here.
Could you help understanding why this 750 ms delay happens? Do you have the same behavior on your boards? Is there a link between the CPU clock and the UART module?
Environment:
Thanks for your help.
-Julien