Hi there. I've run into the following problem which looks like it's a bug/corner case in the eHCILL implementation of the current CC2564B 1.0 v4.1 implementation.
The sequences to trigger this is:
-
Bluetooth init, setup LE, wait for incoming connection. During service discovery the app does some debug output which causes RTS to be high for longer than the ehCILL inactivity timeout (default 100 ms as far as I know).
-
after inactivity timeout (default 100 ms), baseband controller should decide to go into sleep mode and send SLEEP_IND, but as the as RTS is still high, it cannot start sending it
-
now, before the host release RTS, it starts sending an ACL packet (it didn't receive the SLEEP_IND yet)
-
after a few bytes of the outgoing data, hosts receives SLEEP_IND
-
hosts finishes sending packet
-
hosts sends SLEEP_ACK after the ACL packet
After this, no further communication arises as the host went into sleep mode, but the CC256x doesn't raise CTS.
Now.. here's another test. If the host waits after sending the packet for some time (it was 30 ms, but can also much longer), everything is fine and the CC246x later wakes the host again when it has data for it.
To me, it looks like receiving data after deciding to send SLEEP_IND gets the CC256x into some weird state, but it's interesting that a delay would help with it. Obviously, this wouldn't happen if the host wouldn't raise the RTS line for so long, but there's also no reasons why this shouldn't just work (without an addition delay).
I've integrated an additional delay into BTstack's HCI Transport implementation here for now: https://code.google.com/p/btstack/source/browse/trunk/src/hci_transport_h4_ehcill_dma.c
Here are logs from my Salea Logic 16 for both cases
-
https://dl.dropboxusercontent.com/u/5138628/ehCILL%20NOK%20no%20additional%20delay.logicdata
-
https://dl.dropboxusercontent.com/u/5138628/eHCILL%20OK%20with%2030%20ms%20delay.logicdata
(Logic is a free download for all platforms https://www.saleae.com/downloads):
If needed, I can also provide other forms of debug output. If this is too detailed for a public forum, please contact me directly at matthias@bluekitchen-gmbh.com