Hi,
thanks both for the help, my theory was correct, in fact I tried recompile with the old pico-sdk which has the older btstack release and it worked. As Matthias said it was the increased default security requirements.
For the moment I set the security to the old defaults as I find in the manual:
The default SMP configuration in BTstack is to be as open as possible:
-
accept all Short Term Key (STK) Generation methods,
-
accept encryption key size from 7..16 bytes,
-
expect no authentication requirements,
-
don't require LE Secure Connections, and
-
IO Capabilities set to IO_CAPABILITY_NO_INPUT_NO_OUTPUT.
// Set to old defaults
sm_set_accepted_stk_generation_methods(SM_STK_GENERATION_METHOD_JUST_WORKS);
sm_set_encryption_key_size_range(7,16);
sm_set_authentication_requirements(SM_AUTHREQ_BONDING);
sm_set_io_capabilities(IO_CAPABILITY_DISPLAY_ONLY);
With this configuration everything works even if it's not secure but I look more into it later.
I have another question I'm trying to connect from the pico to my phone directly, the MAC address of the phone is saved in pico's memory and they are already paired.
How can i do it?
Referring Matthias'
example if I call the function a2dp_sink_establish_stream(device_addr, &myConnection->a2dp_cid);
the a2dp_packet_handler callback reports that the connection failed mostly with error 0x66 which is L2CAP_CONNECTION_BASEBAND_DISCONNECT.
I'm experimenting with l2cap_create_channel(l2cap_packet_handler, device_addr, 0x01, HCI_ACL_PAYLOAD_SIZE, &local_cid) to establish a connection and it connects to the phone
but I need to establish the a2dp sink connection so i call a2dp_sink_establish_stream(...), the system seems to hang for like 15-20 seconds but the other tasks continue to run (I'm using FreeRTOS and I can use the touchscreen in the meantime) and then it establish the stream and everything works.
I know I'm missing something and probably the way I'm doing it's not correct.
Mattia.