⚠️
你好。。谢谢你来参加论坛。令人兴奋的消息!我们现在正在移动到我们的新论坛平台,将提供更好的功能,并包含在主对话网站的过程。所有帖子和账号都已迁移。我们现在只接受新论坛上的流量-请在//www.xmece.com/support. 我们将在未来几天内修复bug/优化搜索和标记。
13个职位/0个新职位
最后一篇文章
耶胡达诺沃德斯
离线
最后一次见到:2年3个月前
已加入:2018-11-11 12:38
通过UART发送0

大家好,

我现在正在使用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:
PM\U对话框
离线
最后一次见到:1 day 13 hours ago
工作人员
已加入:2018-02-08 11:03
嗨,耶胡达诺沃德斯,

嗨,耶胡达诺沃德斯,

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.

  1. #在da1458x\u config\u basic.h中定义CFG\u PRINTF
  2. 更改fw的uart端口,并将uart\ U TX端口/引脚分配给P04,将uart\ U RX端口/引脚分配给P05(确保您更改的配置位于HW\ U CONFIG\ U PRO\ U DK下,并且该板在HW\ U CONFIG定义中声明)。

#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修改上述定义

  1. 将arch\u console.h文件包含到user\u barebone.c中
  2. 调用arch_printf(“0”);进入adv\u data\u update\u timer\u cb()函数。所以,我每10秒发送一次“0”。
  3. Change the baud rate of the terminal into 115200.

如果我理解错了什么,请让我知道你想要完成什么,或者让我在你的代码中调用arch\u printf()。

谢谢,下午好

耶胡达诺沃德斯
离线
最后一次见到:2年3个月前
已加入:2018-11-11 12:38
Sorry for not being clear

抱歉说得不够清楚。

是的,我可以通过arch\u printf发送0。
问题是当我试图通过UART回显输入时。如果插入的字节中有一个是0x00,那么当我试图打印包含这个字节的数组元素时,就会出现这个错误。我认为原因是0没有考虑作为“值”,所以当我试图打印它时,它找不到要打印的内容,因此出现错误。

耶胡达诺沃德斯
离线
最后一次见到:2年3个月前
已加入:2018-11-11 12:38
我检查了一下这个问题

我检查了一下这个问题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...

PM\U对话框
离线
最后一次见到:1 day 13 hours ago
工作人员
已加入:2018-02-08 11:03
嗨,耶胡达诺沃德斯,

嗨,耶胡达诺沃德斯,

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.

谢谢,下午好

耶胡达诺沃德斯
离线
最后一次见到:2年3个月前
已加入:2018-11-11 12:38
你好,

你好,

如前所述,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)的结果是错误!!

我没有使用你的方法的原因是价值e printed out is NOT the actual value but its ASCII compatible. So, if I'll return to my previous example, this is how it looks in both cases:
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...

PM\U对话框
离线
最后一次见到:1 day 13 hours ago
工作人员
已加入:2018-02-08 11:03
嗨,耶胡达诺沃德斯,

嗨,耶胡达诺沃德斯,

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)

谢谢,下午好

耶胡达诺沃德斯
离线
最后一次见到:2年3个月前
已加入:2018-11-11 12:38
你好,

你好,

不,我根本没有修改你的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.

PM\U对话框
离线
最后一次见到:1 day 13 hours ago
工作人员
已加入:2018-02-08 11:03
嗨,耶胡达诺沃德斯,

嗨,耶胡达诺沃德斯,

因为您没有修改arch\u prinf()函数,所以有点奇怪,因为我得到的结果与您的不同。顺便说一句,很高兴你找到了你的问题,这是你的指示。

谢谢,下午好

酒神
离线
最后一次见到:2 years 2 months ago
已加入:2019-01-13 14:48
Dear forum experts,

Dear forum experts,
I'm working on DA14580 with the sdk5.0.4.

我想知道主机是如何接收从机的SMP请求的。
我已经运行了我的代码,在下面附加,嗅探从属,但在用户函数中没有回调。
好像是无效的?

主机如何从从属服务器接收SMP请求?

Thanks in advcance,
酒神

PM\U对话框
离线
最后一次见到:1 day 13 hours ago
工作人员
已加入:2018-02-08 11:03
嗨,狄奥尼索斯,

嗨,狄奥尼索斯,

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.

谢谢,下午好

陈蓬莱
离线
最后一次见到:2个月5天前
已加入:2018-12-24 02:24
Hi YehudaNovodes,

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回调);

PM\U对话框
离线
最后一次见到:1 day 13 hours ago
工作人员
已加入:2018-02-08 11:03
你好,陈蓬莱,

你好,陈蓬莱,

Thanks for your indication.

Regards, PM_DIalog