大家好,
我现在在DA14580 BLE模块上使用SDK 5.0.4工作,我无法通过ARCH_PRINTF命令发送0。
发送0时,FW跳转到HardFault_Handler.c文件到第141行并留在那里。
if((getword16(sys_stat_reg)&dbg_is_up)== dbg_is_up)
__asm(“bkpt#0 \ n”);
任何帮助都会很棒。
关键词:
Device:
嗨yehudanovode,
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 hw_config_pro_dk.
#define uart2_tx_gpio_port gpio_port_0.
#define UART2_TX_GPIO_PIN GPIO_PIN_4
#define uart2_rx_gpio_port gpio_port_0.
#define uart2_rx_gpio_pin gpio_pin_5.
如果您有其他我们的DKS或者您正在使用自定义板,请用适当的GPIO修改上面的定义
如果我理解任何错误,请告诉我你想要完成的东西或让我很热,以调用arch_printf()进入您的代码。
谢谢,PM_DIALOG.
对不起,不够清楚。
是的,我可以通过ARCH_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:
Examplearr [2] = {0x01,0x02};
and I'm trying to run:
ARCH_PRINTF(examplearr);
打印出是01,02,这正是我想要的。问题开始,当Examplearr的第一个元素为0x00时,则SW运行
if((getword16(sys_stat_reg)&dbg_is_up)== dbg_is_up)
__asm(“bkpt#0 \ n”);
error.
如果第二个元素为0x00,则没有问题。
When I'm trying to use arch_printf to print 0 like this:
examplevar = 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...
嗨yehudanovode,
Could you please try this code snippet?
uint8_t ExampleArr[3] = {0x00, 0x01 , 0x02};
for(Uint8_t i = 0; I <3; I ++)
{
ARCH_PRINTF(“%X”,EXAMPLEARR [I]);
}
ARCH_PRINTF(“\ n \ r”);
Otherwise, please provide me your code snippet as you are using it into your firmware.
谢谢,PM_DIALOG.
你好,
正如我所提到的,ARCH_PRINTF函数通过地址ARCH_PRINTF(EXAMPLEARR)来打印阵列,而不是按value ARCH_PRINTF(Examplearr [i])打印。要更清晰,如果我有一个名为examplevar = 0x01的变量,那么编写Arch_printf(&examplevar)将结束1,在终端上打印,但如果exalvar = 0x00,则Arch_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)
examplevar = 0x01;
ARCH_PRINTF(&examplevar);
打印出:1
examplevar = 0x00;
ARCH_PRINTF(&examplevar);
Print out is: error
2)
examplevar = 0x01;
ARCH_PRINTF(“%x”,examplevar);
打印出:31
examplevar = 0x00;
ARCH_PRINTF(“%x”,examplevar);
打印出:30
I really hope the problem is clear now...
嗨yehudanovode,
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:
examplevar = 0x01;
ARCH_PRINTF(“%x”,examplevar);
打印出:1(and NOT 31 which is the ASCII character of 1)
examplevar = 0x00;
ARCH_PRINTF(“%x”,examplevar);
打印为:0(不是30,即0的ASCII字符)
如果您已修改ARCH_PRINTF()函数的源代码,请您告诉我吗?您能否在新的SDK路径中尝试这样做?请注意,我正在使用D14580系列的最新SDK(SDK5.0.4)
谢谢,PM_DIALOG.
你好,
不,我根本没有修改Arch_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.
嗨yehudanovode,
由于您没有修改ARCH_PRINF()函数,因此有点奇怪,因为我得到了来自的不同结果。顺便说一下,你很高兴你识上你的问题,为你的迹象表明。
谢谢,PM_DIALOG.
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.
谢谢,PM_DIALOG.
Hi YehudaNovodes,
you might try my code which can send hex, as follows:
extern void UART_CALLBALL(UINT8_T RES);
UINT8_T数据= 0x00;
UART2_WRITE(&DATA,1,UART_CALLBACK);
嗨Chenpenglai,
Thanks for your indication.
Regards, PM_DIalog