大家好,
我现在正在使用sdk5.0.4开发DA14580 BLE模块,无法通过arch\u printf命令发送0。
当发送0时,FW跳转到hardfault\u handler.c文件的第141行并停留在那里。
if((GetWord16(SYS\u STAT\u REG)&DBG\u IS\u UP)==DBG\u IS\u UP)
__asm(“BKPT#0\n”);
任何帮助都会很好。
关键词:
Device:
嗨,耶胡达诺沃德斯,
I tried to replicate the issue that you have mentioned but I am able to send “0” via arch_printf(). I worked on the ble_app_barebone example of the SDK 5.0.4 and I used the Pro-DK. Let me describe what I did and make sure that you have done the same configurations.
#elif硬件配置\u专业\u DK
#定义UART2\U TX\U GPIO\U端口GPIO\U端口0
#define UART2_TX_GPIO_PIN GPIO_PIN_4
#定义UART2\U RX\U GPIO\U端口GPIO\U端口0
#定义UART2\U RX\U GPIO\U引脚GPIO\U引脚5
如果您有我们的另一个DK,或者您正在使用自定义板,请使用适当的GPIO修改上述定义
如果我理解错了什么,请让我知道你想要完成什么,或者让我在你的代码中调用arch\u printf()。
谢谢,下午好
抱歉说得不够清楚。
是的,我可以通过arch\u printf发送0。
问题是当我试图通过UART回显输入时。如果插入的字节中有一个是0x00,那么当我试图打印包含这个字节的数组元素时,就会出现这个错误。我认为原因是0没有考虑作为“值”,所以当我试图打印它时,它找不到要打印的内容,因此出现错误。
我检查了一下这个问题more and I think I'm sure what is the problem now.
I use the arch_printf function to print an array. So if, for example, the content of the array is:
示例arr[2]={0x01,0x02};
and I'm trying to run:
arch_printf(示例arr);
打印出来的是01,02这正是我想要的。当ExampleArr的第一个元素为0x00时,问题就开始了,然后软件运行到
if((GetWord16(SYS\u STAT\u REG)&DBG\u IS\u UP)==DBG\u IS\u UP)
__asm(“BKPT#0\n”);
error.
如果第二个元素是0x00,则没有问题。
When I'm trying to use arch_printf to print 0 like this:
示例var=0;
arch_printf(“%x”,ExampleVar);
there's no error but what's actually printed is the ASCII value of 0, which is 30. I need the 0 value to be printed, not the symbol...
嗨,耶胡达诺沃德斯,
Could you please try this code snippet?
uint8_t ExampleArr[3] = {0x00, 0x01 , 0x02};
对于(uint8\t i=0;i<3;i++)
{
arch_printf(“%x”,示例arr[i]);
}
arch_printf(“\n\r”);
Otherwise, please provide me your code snippet as you are using it into your firmware.
谢谢,下午好
你好,
如前所述,arch\u printf函数通过地址arch\u printf(ExampleArr)而不是值arch\u printf(ExampleArr[I])获取要打印的数组。更清楚地说,如果我有一个名为ExampleVar=0x01的变量,那么写arch\u printf(&ExampleVar)的结果是1,打印在终端上,但是如果ExampleVar=0x00,arch\u printf(&ExampleVar)的结果是错误!!
我之所以不使用您的方式,是因为打印出来的值不是实际值,而是ASCII兼容的值。所以,如果我回到上一个例子,这是两种情况下的情况:
1)
示例var=0x01;
arch\u printf(示例变量)(&ExampleVar);
打印输出为:1
例如var=0x00;
arch\u printf(示例变量)(&ExampleVar);
Print out is: error
2)
示例var=0x01;
arch_printf(“%x”,ExampleVar);
打印日期:31
例如var=0x00;
arch_printf(“%x”,ExampleVar);
打印时间:30
I really hope the problem is clear now...
嗨,耶胡达诺沃德斯,
Apologies for the delay. I tried to test your code, this code snippet arch_printf(&ExampleVar) cannot be built by the Keil. This is a quite strange situation, because if I understood correctly this can be built from your side. Also, I have different results than yours. Please check the following:
示例var=0x01;
arch_printf(“%x”,ExampleVar);
打印输出为:1(and NOT 31 which is the ASCII character of 1)
例如var=0x00;
arch_printf(“%x”,ExampleVar);
打印输出为:0(而不是0的ASCII字符30)
如果您修改了arch\u printf()函数的源代码,请告诉我好吗?请尝试在新的SDK路径中执行相同的操作好吗?请注意,我使用的是D14580系列的最新SDK(SDK5.0.4)
谢谢,下午好
你好,
不,我根本没有修改你的arch\u prinf源代码。
But I have a better solution. For printing an array of any value at any location, I just used the uart2_write(*arr, Size, NULL) function, when *arr is the pointer to the printed array, Size is the size to be printed, in bytes, and NULL is the NULL pointer, as required in the description of the function.
嗨,耶胡达诺沃德斯,
因为您没有修改arch\u prinf()函数,所以有点奇怪,因为我得到的结果与您的不同。顺便说一句,很高兴你找到了你的问题,这是你的指示。
谢谢,下午好
Dear forum experts,
I'm working on DA14580 with the sdk5.0.4.
我想知道主机是如何接收从机的SMP请求的。
我已经运行了我的代码,在下面附加,嗅探从属,但在用户函数中没有回调。
好像是无效的?
主机如何从从属服务器接收SMP请求?
Thanks in advcance,
酒神
嗨,狄奥尼索斯,
Thanks for your question but it is not related with this forum thread. If I understood correctly the DA14580 is acting as a central. Since you are a central, you cannot request security from a peripheral. If you have any other follow-up questions, please create a new forum thread. If you don’t know hot to create a new forum thread, please let me know and I will provide you the appropriate steps.
谢谢,下午好
Hi YehudaNovodes,
you might try my code which can send hex, as follows:
外部无效uart\u回调(uint8\u t res);
uint8\t数据=0x00;
uart2\u write(&data,1,uart\u回调);
你好,陈蓬莱,
Thanks for your indication.
Regards, PM_DIalog