This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2564C: SPP port closing after connection

Part Number: CC2564C

btsnoop����A���7���t���u2����3��
���;3���k���������	

��g
	�^��8��LGG��^D�������������?���a���> �������������?[���!V��'IV��(>m��,Ym��-��0"��0���4G��5	S���7�S�
(` ��88z��<�z��=� ��HU ���I� 

��Pc @��Q1 ��U� �������Vq ��^I ���_z* ��iz* ��j� ��q� ��rv�������=��w��xF�������) ����) ����. �����. ����E����E���hG���sG���C���qC����$Z����$���Q ���������������S����xS�
(` ���������y������f�Redmi���������R�	Redmi����R���M ���� �:�x�j�J���0 ���� �I#�
*2���Y ��Z ��0XJ��7 ��B� ܐ�׭����C� ��_r 7�K{|���`� ��w� ��=*����x� ���� mذIk~\v��� ���� �}0G�j����� ���� ��g��,���� ��� ��e{�J�

���{ �+p�:b���J �����R�	Redmi���R���T�����U���T����T��K�ܐf��cT���T�Kh�7�K��,KT���-4T����k��:9T���:�T�>��m�p��KT���K�T����}p��k�T���lhT���s��g��trT���uKT������e��x�T���y�&`��}�&����~�R�	Redmi���[R�����	R�	Redmi���]R�����YR�	Redmi	���mR�����%R�	Redmi
���xR�����ER�	Redmi

���@R��3�:3����<C:��="��A}��B5��PE��Q��\G��\���b%��b���ed��f��t$����uR�	Redmi
��ykR����z;R�	Redmi
��~�R����mR�	Redmi
����R������R�	Redmi
���R������R�	Redmi
����R���������ۦ���e������������R�	Redmi
2���bR����$�R�	Redmi
/2��9[R����ȩR�	Redmi
/2��ԟR�����`R�	Redmi
-/2����R�2l�Y��2w!Y�*dQ���.'Y���<Y��/�5���\Y���	�Y���1���Y�����Y�����Ӹ�Y����	Y�v�C���Y����Y�e���B�Y���MY���_�d�Y��t�Y��������K��Redmi��T�����p�R�	Redmi
-/2��zR���3W�

���W����DW��

���=W����l @@���� ���U �� ��#���-���C�:3��..��Ip>+���)�Z�	 �]E@m�J�k��h	��b�<���L�:��b���u&���������������Redmi��������׊R�	Redmi
-/2����R���,:3�����:��"���5t��P��Ve		��m%3��
��wD���s/���	�P$(��	MIBOX3

�..�ɵ>+���)�Z�	 �]E@m�J�k��h	��b�<������	���	� ��� ��`���<`����W�

��W�����+�Redmi��4�����R�R�	Redmi
-/2��\�R�����Redmi�������R�	Redmi
-/2���R���:3�����:�����!��.��'��W�

�'�rW��'�iW��

�(
W��(5% @@�(DI �(n� �(�t �(�B�(�4		�(�3��
�(��(��>���L����(�">���L��	DAC��,3�/���	�P$(��	MIBOX3

��=�1>���L����=��>���L��	DAC��?1��?4J�?4� �?9� �?:*`��?;�`��?<�W�

�?E�W��J�CW�

�J�W��K�S���L��		�L��L�
���L����L0��V��=���L���Wk����L��DAC���2 ��ZO ����
���L������t		��rw���L��

��s����L��

���
���L��		�������L������
���L��0000

���+

���L����Y����L���!�m��~���U>���^����L����� �������Z ���� 

������?����
����$7@		���o7���.�����6��/���{������L���#
������m��	
����		��
��l��| ���~: 

���s��% ��� @������ �@��� �����k @����/���� 
�������
� 
@���� �5�5
�������s 
@5���� �@������ �@��2 A��#&���T �A���� �����o A����y 
�����������P 
A���� �5�5
���� ZTT��~� OKAFC5A5?	
	5	555	%Serial Port Server Port 1���H 	�A������B! 	�A�����������$^
���L����$k0�.�����L���.���.�N 

�.�&�.��
��.�%��.��.��
		�.�G
�.��
		�/�
�/�7@		�/�7�/G�/	��/
w��/���{��/[�/
��/>#
�//��/��/�
		�/_
�/$z�/%b��/%���/+`�/F@ ��/GK 

�/U��/�G �/С B�/ۥ�0W� �B�0Y� ���0a� B��0b� 
��0c`�0mR�0~� 
B�++�0� &"�5��_�4��5
���0�.TT�15 OKBFC5A5?	
	5	555	%Serial Port Server Port 1�1p �B�1^�1� �B�1�� C�1���2
� �C�2� CO�2� ���2 
��2 ��2!��2�� 
C�

�2�� �?�2�

�3� Cs��3� �����p�3(��3�� C���I��3���3�		�3�����L���3�N���L���!�m��~���U>�

�3�
���L���4��4��4��4�G

�4�N �?Y�4̅

�4�G Cs��4�1 C�	�
��4�� ��	��p�4�K��4�� ��	�
p		�4���5��5`�5`� C�	���

�fY� CS��:��tI�%��?����r�R�	Redmi
-/2�ER�����R�	Redmi-/2��R�����R�	Redmi-/2�
�R�
.�$R�
97$���
\�R�	Redmi-/2�
f�R���
�R�	Redmi-/2�
�RR���
�R�	Redmi
-/2�
�hR

�
�� �S����
�BR�	Redmi-/2�
e�
�R���OR�	Redmi-/2�
R���
�R�	Redmi-/2�R���{R�	Redmi-/2�"R�����;�v���l��d�� �� 

�Z" �S��Z1��ZA*�ZC��Zd�i�&�j��
btsnoop��k���k�z�kӂ�k�:2�k��3��
�k��3�k���k�g��k�=	

�k��
	�^��8�k��GG�kUD�������������?���a���> ����k��k������?[��k
�V�k9V�km�k�m�k��k$��k&��k,�k-�S��k7�S�
(` �k8�z�k>cz�k?� �kD� ��kEL 

�kJ� @�kL� �kW4 ������kYC �k^c ��k_�* �kjq* �kk� �kr� �kw��������=�k���k���k���k�v) �k�}) �k�M. ��k��. �k�]E�k�3E�k��G�k��G�k��C�k��C�k�$Z�k�$�k�` �k�b�kŪ�k���kѾS��k�XS�
(` �k�����kݸ����k��Redmi�k�F���k�R�	Redmi�k�rR�k�� �k	U 
&�����k
# �k!� ��w���k"� �kG �8�_k)��kG� �ke� Im�
���kf� �k�� �H�/�n�k�| �k�o ���
�x&�k�> �k�� M	̼�;v�k�i �k� �¬;���k� �k	6 j��`�i3��k
4 �k'| �����

�k(2 ��
&x�k*D ���k*�R�	Redmi�k16R�k1�T�!*,�B�k4aT��k4�T�1`�j�n�k8gT��k9T�@����V�k>�T��k�Y&`�k�>&���k��R�	Redmi�k��R���k�	R�	Redmi�k��R���k��R�	Redmi	�k�R���k��R�	Redmi
�k�\R���k��R�	Redmi

�k�TR�kBX:3���kM�:�kNV�kP��kQ?�kbn�kc��kr!�kr��k~��kF�k���k�!�k� ���k��R�	Redmi
�k��R���k�R�	Redmi
�k�R���k��R�	Redmi
�k��R���k�IR�	Redmi
�k��R���k�HR�	Redmi
�k�6R�k4��kE��kFu�k]��k_�ku����k W�R�	Redmi
/�k b�R���k!"sR�	Redmi
-/�k!-�R���k!I{R�	Redmi
-/�k!UkR���k!xBR�	Redmi
-/2�k!�R�k�b�
���L����k�p��k�����L���k����k��D 

�k��k��
��k�"P
		�k�%R
�k�&17@		�k�(�7�k�);�k�,�k�,���/���{��k�-��k�5�k�5�#
�k�7�
���L���k�f�k�f��k�g.����L��DAC�k�g��k�hm��k�j��k�k�
�k�l��		�k�n�
�k�t4 ��k�~� 

�k�@�k��� �k��� @�k�
N�k�6 �@�k�� ���k�w @��k璖�k�% 
��k�
�k篇 
@�++�k籪 &"�5��_�4��5
���k绺TT�k�3� OK@FC5A5?	
	5	555	%Serial Port Server Port 4�k�5Z �@�k�?n�k跛 �@�k躵 A�k����k�Hz �A�k�I� AO�k�J� ���k�J� 
��k�Z��k�[��k��h 
A�

�k��q �?�k��7

�k�@ As��k�Aa �����p�k�Q��k�� A���I��k�)�k��		�k�d���L���k�'���L���!�m��~���U>�

�k�l
���L��		�k�����L���l)0k
���L��0000

�l)E�

���L���l*����L���L1@�Io�(�B}Ct=o�l*��l*�3�l+��l+@�
���L���l+D5�l+��

�l+�� �#?��l+������L��DAC�l+���l+�� 	B�l+��

�l+�� A#s�l+�� ��	�#�p�l+���		�l+��l+�} A�	�#
��l+� ��	�#
p�l, 	�B�l,b 
���l,5
�l,7t B��l,8� 
��l,9��l,< A�	�#���l,>h�l,D�l,Uc 	A!���l,c^ 

B��l,e& �5�5
���l,o��l,�G 
B5�l,ކ �B�l,�1�l-\A �B�l-]� C�l-h.�l-�I �C�l-� 
���l-�? C��l-�� 
��l-�	�l-�t�l-�X 
C��l.i �5�5
���l. TT�l.s# OKCFC5A5?	
	5	555	%Serial Port Server Port 4�l.u �C�l.(�l.�� �C�lp�� 
	�#�	gg
F�lp�"�l�� 
�#�
gghh
Z�l��'�l�5 
�#�
gghh
Z�l� x�l��� 	A!���l��E 
�#�
gghh
Z�l��T�m�y
 ��m˛		�m��$ �m��8Y��m��=Y��ek�q�n�� 
�#�
gghh
Z�n�%��n�� 	A!���n� 
�#�
gghh
Z�n���n��9 
�#�
gghh
Z�n���n�M� 	A!���n�) 
�#�
gghh
Z�n�j��o.a 
�#�
gghh
Z�o?��o� 	A!���ox 
�#�
gghh
Z�o*�o

 ��o7�		�o8<$ �oZ@I
 ��oZL�		�oZ^�$ 

�o[� �#S(�o\p

�o\l� A#s

�o\v� �S��o\�+

�o\�� As��o\�H �A�o]��o]u� �A�o~'��p`�8�pa*�paA��paY����pa�/R�	Redmi
-/2�pa��R���pa�,R�	Redmi-/2�pa�R���pb`R�	Redmi-/2�pb0R�pbQ{$R�pbw�$���pb�oR�	Redmi-/2�pb�\R���pb��R�	Redmi-/2�pb��R���pb��R�	Redmi
-/2�pb��R���pb��R�	Redmi-/2�pb�R���pc|R�	Redmi-/2�pcR���pc�R�	Redmi-/2�pcxR���pc�R�	Redmi-/2�pc |R�pc ��pc&P�pc&��pc(��pc(��pc-p�pc-��pc25�pc2| �pc7t �pf4�pg 

Hello,

I'm trying to connect Android device to CC2564C via SPP (Serial Bluetooth Terminal app), basing on FreeRTOS SPPLE Demo. It works very rarely, usually 20 s after connecting to device from Android, the port is being closed. I tested it on Android 6 and 10. Logs:

Server Opened: Server Port 4, Serial Port ID 1.
Server Port Context Stored.

atPINCodeRequest: 0xA450466DEC32
Respond with: PINCodeResponse
GAP_Authentication_Response(), Pin Code Response Success.

SPP+LE>
atLinkKeyCreation: 0xA450466DEC32
Link Key Stored.

atLinkKeyRequest: 0xA450466DEC32
GAP_Authentication_Response success.

SPP+LE>
SPP Open Indication, ID: 0x0001, Board: 0xA450466DEC32.

SPP+LE>
SPP Port Status Indication: 0x0001, Status: 0x000B, Break Status: 0x0000, Length: 0x0000.

SPP Close Port, ID: 0x0001

I'm also attaching btsnoop logs from successful and unsuccessful attempts (code was still the same).

  • Hi,

    Do you see the same issue with the SPPDemo, which is a simpler SPP demo that does not have functionality such as LE support enabled?

    Regards,

    Michael

  • Yes, I see exactly the same with SPPDemo.

  • Hi,

    Running the SPPDemo on my STM32 FreeRTOS setup, I do not see the same issue - my Android phone is able to connect to the CC2564C without any issues. See the below log for the commands I ran:

    OpenStack().
    Bluetooth Stack ID: 1
    Device Chipset: Unknown (greater 4.1)
    BTPS Version  : 4.2.1.0
    PLAT Version  : 1.0
    App Name      : SPPDemo
    App Version   : 0.3
    Project Type  : 6
    FW Version    : 12.23
    Local BD_ADDR: 0x985DAD120381
    
    ******************************************************************
    * Command Options: Server, Client, Help                          *
    ******************************************************************
    
    Choose Mode>server
    
    ******************************************************************
    * Command Options: Inquiry, DisplayInquiryList, Pair,            *
    *                  EndPairing, PINCodeResponse, PassKeyResponse, *
    *                  UserConfirmationResponse,                     *
    *                  SetDiscoverabilityMode, SetConnectabilityMode,*
    *                  SetPairabilityMode,                           *
    *                  ChangeSimplePairingParameters,                *
    *                  GetLocalAddress, GetLocalName, SetLocalName,  *
    *                  GetClassOfDevice, SetClassOfDevice,           *
    *                  GetRemoteName, SniffMode, ExitSniffMode,      *
    *                  Open, Close, Read, Write,                     *
    *                  GetConfigParams, SetConfigParams,             *
    *                  GetQueueParams, SetQueueParams,               *
    *                  Loopback, DisplayRawModeData,                 *
    *                  AutomaticReadMode, SetBaudRate, Send          *
    *                  Help, Quit                                    *
    ******************************************************************
    
    Server>open 1
    Server Opened: 1.
    
    Server>getlocalname
    Name of Local Device is: SPPDemo.
    
    Server>setdiscoverabilitymode 2
    Discoverability: General.
    
    Server>setconnectabilitymode 1
    Connectability Mode: Connectable.
    
    Server>setpairabilitymode 1
    Pairability Mode Changed to pmPairableMode.
    
    Server>
    atPINCodeRequest: 0xC418E98E28EA
    Respond with: PINCodeResponse
    
    Server>pincoderesponse 0000
    GAP_Authentication_Response(), Pin Code Response Success.
    
    Server>
    atLinkKeyCreation: 0xC418E98E28EA
    Link Key Stored.
    
    Server>
    atLinkKeyRequest: 0xC418E98E28EA
    
    GAP_Authentication_Response success.
    
    Server>
    SPP Open Indication, ID: 0x0001, Board: 0xC418E98E28EA.
    HCI Connection Handle: 0x0001.
    
    Server>
    SPP Port Status Indication: 0x0001, Status: 0x000B, Break Status: 0x0000, Length: 0x0000.
    
    Server>
    SPP Data Indication, ID: 0x0001, Length: 0x000D.
    
    Server>read 11
    Read: 13.
    Message: hello world
    
    Read: 0.
    
    Server>
    HCI Mode Change Event, Status: 0x00, Connection Handle: 1, Mode: Sniff, Interval: 792
    
    Server>

    Which Android app are you using for testing? I am using "Bluetooth Terminal HC-05". Do you get different results if you use that app?


    Regards,

    Michael

  • Hi,

    I was using "Serial Bluetooth Terminal". I downloaded the app you proposed and on the first try it worked, but on the second it didn't. I tried few more times and sometimes it worked, sometimes not, I really don't know why. Did you try to do it more than once?

    Also, I have to add that I don't open the server by typing commands, but I'm doing it in one of the threads of my application:

    void SPPMainThread()
    {
    
       int                           Result;
       BTPS_Initialization_t         BTPS_Initialization;
       HCI_DriverInformation_t       HCI_DriverInformation;
       HCI_HCILLConfiguration_t      HCILLConfig;
       HCI_Driver_Reconfigure_Data_t DriverReconfigureData;
    
       /* Configure the UART Parameters.                                    */
       HCI_DRIVER_SET_COMM_INFORMATION(&HCI_DriverInformation, 7, VENDOR_BAUD_RATE, cp3Wire);
       HCI_DriverInformation.DriverInformation.COMMDriverInformation.InitializationDelay = 100;
    
       /* Set up the application callbacks.                                 */
       BTPS_Initialization.MessageOutputCallback = DbgPrintfCallback;
    
       /* Initialize the application.                                       */
       if((Result = InitializeApplication(&HCI_DriverInformation, &BTPS_Initialization)) > 0)
       {
    	   /* Register a sleep mode callback if we are using HCILL Mode.     */
    	   if((HCI_DriverInformation.DriverInformation.COMMDriverInformation.Protocol == cpHCILL) || (HCI_DriverInformation.DriverInformation.COMMDriverInformation.Protocol == cpHCILL_RTS_CTS))
    	   {
    		   HCILLConfig.SleepCallbackFunction        = Sleep_Indication_Callback;
    		   HCILLConfig.SleepCallbackParameter       = 0;
    		   DriverReconfigureData.ReconfigureCommand = HCI_COMM_DRIVER_RECONFIGURE_DATA_COMMAND_CHANGE_HCILL_PARAMETERS;
    		   DriverReconfigureData.ReconfigureData    = (void *)&HCILLConfig;
    
    		   /* Register the sleep mode callback.  Note that if this        */
    		   /* function returns greater than 0 then sleep is currently     */
    		   /* enabled.                                                    */
    		   Result = HCI_Reconfigure_Driver((unsigned int)Result, FALSE, &DriverReconfigureData);
    		   if(Result > 0)
    		   {
    			   /* Flag that sleep mode is enabled.                         */
    			   DbgPrintf(("Sleep is allowed.\r\n"));
    		   }
    	   }
    
        ServerMode(NULL);
        BTPS_Delay(500);
        ParameterList_t server_params;
        server_params.NumberofParameters = 1;
        server_params.Params[0].intParam = 1;
        OpenServer(&server_params);
    
          /* Loop forever and process UART characters.                      */
          while(1)
          {
        	  BTPS_Delay(200);
          }
       }
    }

    Maybe I'm missing something...

    Regards,

    Marek

  • Hi Marek,

    With the Bluetooth Terminal HC-05 app I can repeatedly connect to the SPPDemo without issues.

    Are you using your own custom board, or are you using a TI EVM?

    Regards,

    Michael

  • Im using custom board with CC2564C and STM32F7 (I ported Bluetopia from F4 to F7).

  • Hi,

    Would it be possible for you to test your code with an EVM, to ensure that you are not running into issues due to your custom board? If you used an STM32F4, you'd also be able to see if your modified porting layer is the cause of your issue.

    Regards,

    Michael