Hi Kimberly,
Currently, I am using the api of p2p communication and I would like to understand how it work( type of communication, buffer, maximum message length to send..), electronic part (relation between stm32 and nRF51822 to do this type of communication) and what are the necessary elements made in the firmware to achieve that?
Thank you for your help!
peer to peer communication
Re: peer to peer communication
Hi,
Most of the information you are seeking is documented, at a high-level, in the Crazyflie firmware: https://www.bitcraze.io/documentation/r ... s/p2p_api/
At a lower level, the best for you is to follow the code, it will show you exactly what is happening.
In essence, P2P packets are sent as a CRTP packet with a P2P port.
When sending a broadcast packet:
- The CRTP packet is sent to the nRF51 as a syslink packet (syslink is the protocol used over UART between the nRF51 and the STM32)
- The nRF51 takes over the radio and send the packet using the broadcast ESB address (an address all Crazyflie listen-to). Note that "take over" is an important detail there: if you send P2P packets in a tight loop you will effectively disable RX on the radio. There is work ongoing by the comunity to share a bit more the radio between Crazyradio link and P2P but I do not know the progress of it.
To receive a P2P broadcast packet:
- the nRF51 normally IDLEs in RX mode, waiting for packets from crazyradio
- When the P2P packet is received, the nRF51 recognize that it comes from the broadcast address so it is no acked.
- The nRF51 send the packet over syslink to the STM32
- The radiolink.c file calls the p2p packet callback.
Most of the information you are seeking is documented, at a high-level, in the Crazyflie firmware: https://www.bitcraze.io/documentation/r ... s/p2p_api/
At a lower level, the best for you is to follow the code, it will show you exactly what is happening.
In essence, P2P packets are sent as a CRTP packet with a P2P port.
When sending a broadcast packet:
- The CRTP packet is sent to the nRF51 as a syslink packet (syslink is the protocol used over UART between the nRF51 and the STM32)
- The nRF51 takes over the radio and send the packet using the broadcast ESB address (an address all Crazyflie listen-to). Note that "take over" is an important detail there: if you send P2P packets in a tight loop you will effectively disable RX on the radio. There is work ongoing by the comunity to share a bit more the radio between Crazyradio link and P2P but I do not know the progress of it.
To receive a P2P broadcast packet:
- the nRF51 normally IDLEs in RX mode, waiting for packets from crazyradio
- When the P2P packet is received, the nRF51 recognize that it comes from the broadcast address so it is no acked.
- The nRF51 send the packet over syslink to the STM32
- The radiolink.c file calls the p2p packet callback.