Thursday, April 25, 2024

Why Does Raytac AT-Command Module Not Require An End Code Mechanism?

Developers may be familiar with using ‘\n’ (hex 0x0A) or ‘\r’ (hex 0x0D) as end codes to determine the end of a data packet when writing programs. In the original Nordic SDK example code, ble_app_uart, is to consider the reception of 244 bytes or the presence of ‘\n’ (hex 0x0A) or ‘\r’ (hex 0x0D) as end code as the end of a data packet. The program then sends this received data via BLE to APP.



Developers encountering Raytac AT-Command module for the first time may find it very unfamiliar and be puzzled by the absence of 0x0A or 0x0D end code. You may raise questions about how to receive complete information without relying on these end code? Therefore, we’ll provide explanations for common use cases of AT-Command in both connected and disconnected scenarios:


In the connected condition –
Raytac’s AT-Command module operates in Pass-Through mode. For instance, when the APP sends 0x41 0x42 0x43 (3 bytes) through the module to the MCU, the MCU will receive only 0x41 0x42 0x43 (3 bytes). When APP sends these 3 bytes, there is no need to include the 0x0D end code or 0x0A end code at the end. The same approach applies when the direction of transmission is reversed (i.e., when the MCU sends to the module and then to the APP).

Here, it’s crucial to note that there is a specific consideration for the “Data Interval” (DI) setting between transmitting one data packet and the next. Failure to configure the DI appropriately may result in packet loss and lead to Bluetooth disconnection shortly after data transmission. The recommended DI values vary at different Baud rates, and you can refer to the AT-Command specification for suggested DI values.
As an example, consider Raytac AT-Command module in the scenario of “Mobile App -> Module (MDBT42V-AT) -> MCU,” with a Baud rate of 9600, no flow control, and a data length of 244 bytes. In this case, the DI value for transmitting data must be at least 250ms to prevent packet loss.





In the unconnected condition –
Providing explanations to the Bluetooth module by sending AT commands from the MCU (or Console) is illustrated below. There is no need for 0D or 0A end codes at the end.
AT?NAME
AT+NAMESQ-BT
AT?NAME










Edited by Sales Manager: Ms. Vicky Huang


Raytac Corporation 勁達國際電子股份有限公司  A company of Abietec
Bluetooth & WiFi module maker based on Nordic nRF54, nRF53, nRF52, nRF7002 solution
BT5.4 &BT5.3 & BT5.2 & BT5.1 Qualified, FCC/IC/CE/Telec/KC/RCM/SRRC/NCC Pre-Certified. Bluetooth Solution: nRF54, nRF5340, nRF52840, nRF52833, nRF52832, nRF52820, nRF52811, nRF52810, nRF52805, nRF51822 WiFi Solution: nRF7002
http://www.raytac.com
email:service@raytac.com
Tel: +886.2.3234.020

No comments:

Post a Comment