Hi,
I am using codeless existing service, to communicate with smartphone. So, I send ATrl+"message to be communicated" to the ble chip, and it writes this message on to this characteristic, and I read it from my smartphone.
这个“要传达的消息”的升高限制约为120个字节左右。我想问一下我是否可以通过增加分配此特征的数据库空间来增加这一点。
Can you please tell me where in the code I will have to make changes so as to achieve this. And upto how much can I extend this?
谢谢!
设备:
Hi krishnanag,
请配置DEF_CUST1_INBOUND_LENand thedef_cust1_outbound_len.definitions of the user_custs1_def.h header file in order to increase the database space allocated for this characteristic with the value that you prefer. According to BLE core specifications, be aware that the maximum length of an attribute value shall be up to 512 octets.
Thanks, PM_Dialog
我将这两个定义都改为500,但仍然是我发送atrl +“字符串”,其中字符串有超过160个字符,然后发生一些溢出,只有很少的字符传输。
你能帮助我弄清楚为什么正在发生吗?
I did come across CMD_BUFFER_SIZE, and other sizes in user_cmd_parser.h, but changing those didn't help either. I am programming the sram of the chip.
Hi krishnanag,
Could you please change thefor(uint8_t i=0;i<160;i++)tofor(Uint8_t i = 0; i <500; i ++)在extract_args()功能on of the user_cmd_parser.c file? Are you able to send more than 160bytes now?Also, you should define the DEF_CUST1_INBOUND_LEN, the DEF_CUST1_OUTBOUND_LEN and the CMD_BUFFER_SIZE to 500bytes.
Thanks, PM_Dialog
是的,我改变了所有这些。但是,当我发送超过160时,它会传输160个字符,并回复错误,然后再做。
我无法理解为什么。
Hi krishnanag,
您能否澄清应用程序回复的错误?
Thanks, PM_Dialog
It just sends ERROR. When I send ATrl+"string" where string is nearly 160 characters.
Hi krishnanag,
我们正在努力,以便复制您的问题,并确保您能够发送超过160字节。我会尽快通知你。
Thanks, PM_Dialog
谢谢!
Hi krishnanag,
I assume that you are trying to use theATr+PRINT= 或者更简单| 在从移动应用程序中编写特征的值。那是对的吗?
Thanks, PM_Dialog
I am sending ATrl+"string" from micro controller to da14580 using UART.
Hi,
无附庸不具有支持您使用的格式的扩展命令。ATI(或ATRI用作远程命令)是非扩展命令(意味着它不具有'+')。ATI应该用作返回标识物理设备的硬件和软件的一组字符的请求。您是否以无附带的延长命令实施了?
If you want to send data over Bluetooth using already defined commands in CodeLess, you should use either the
ATr+PRINT=
或使用“|”的简化版本或“管道”字符:
| <文本发送>
Both of these commands require that you are in a Bluetooth connected state when the command is issued.
/ mhv.
哇!
I didn't know that. Somehow ATrl+"string" works.
I will try it your way and get back.
Thanks a lot.
它将“工作”,因为无附件将其留给智能手机应用以验证命令。因此,除非您的应用检查语法,否则您不会意识到它是错误的。
/ mhv.
CodeLess uses sprintf to generate some of the responses which limits the response length to 255 characters. You can safely expand CodeLess to handle 255 characters following the instructions provided below. You should ensure that the remote end (in your case the smartphone app) responds either 'OK' or 'ERROR' to every data transmission from your microcontroller. Unless you use the "pipe" command as described above, CodeLess will expect to receive a reply from the remote end before it is ready for the next transmission and you may not be able to send any new data until a reply has been received. Using the "pipe" command removes the need for a reply.
Here is how you can change the implementation to support 255 characters:
In da1458x_config_basic.h:
Add a define
#define CMD_BUFFER_SIZE 255
(将定义移动到此文件允许我们全局访问它)
In user_cmd_parser.h:
Out-comment the old define
#define CMD_BUFFER_SIZE 160
Like this
//#define cmd_buffer_size 160
在同一文件中,更改:
#define cmd_max_arg_length 160.
to
#define cmd_max_arg_length cmd_buffer_size.
In user_custs1_def.h
改变
#define def_cust1_inbound_len 160.
至
#define DEF_CUST1_INBOUND_LEN CMD_BUFFER_SIZE
并且,在同一文件中,更改
#define DEF_CUST1_OUTBOUND_LEN 160
至
#define DEF_CUST1_OUTBOUND_LEN CMD_BUFFER_SIZE
在user_cmd_parser.c文件的extract_args()函数中
改变
for(uint8_t i=0;i< 160 ;i++)
to
for(Uint32_t i = 0; i
In the uart2_rec_data_avail_isr() function of the user_uart2.h file
改变
if(readData == 0x0D || bytesIn > 150)
to
if(readdata == 0x0d || bytesin> cmd_buffer_size)
In codeless_env_t struct of the user_cmd_interpreter
改变
char current_cmd[160];
to
char current_cmd [cmd_buffer_size];
您可以将CMD_BUFFER_SIZE更改为512(我没有测试此问题),但无附加无附件的所有回复都将减少为“确定”或“错误”
/ mhv.
谢谢!
你真的很有帮助。
I am sorry, but I have just one more question, When you said :
"You should ensure that the remote end (in your case the smartphone app) responds either 'OK' or 'ERROR' to every data transmission from your microcontroller. Unless you use the "pipe" command as described above, CodeLess will expect to receive a reply from the remote end before it is ready for the next transmission and you may not be able to send any new data until a reply has been received. Using the "pipe" command removes the need for a reply"
这里ATR + PRINT =文本正在工作,即使没有智能手机的任何回复。
If I were to reply from my smart phone, How would I do that? By writing to one of the characteristics?
虽然ATR + PRINT =在没有响应的情况下似乎工作,但由于它依赖于简化的消息流可能会感到困惑,以便跟踪是否应该返回响应或远程对等方。蓝牙。使用'|'命令可确保这不会导致问题。
智能手机回到设备的回复与写入自定义服务的第一个特征一样简单(UUID = 914F8FB9-E8CD-411D-B7D1-14594DE45425)
顺便说一下:如果您在第三种特征上订阅它们(UUID = E2048B39-D4F9-4A45-9F25-1856C10D5639,则智能手机将在新数据可用于读取操作时接收通知。
/ mhv.
谢谢!