⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
13 posts / 0 new
Last post
YehudaNovodes
Offline
Last seen:2 years 3 months ago
加入:2018-11-11 12:38
Sending 0 via UART

Hi all,

I'm working now on the DA14580 BLE module with SDK 5.0.4 and I can't send 0 via arch_printf command.
When sending 0, the FW jumps to hardfault_handler.c file to line 141 and stay there.
if ((GetWord16(SYS_STAT_REG) & DBG_IS_UP) == DBG_IS_UP)
__asm("BKPT #0\n");

any help will be great.

Keywords:
设备:
PM_Dialog
Offline
Last seen:2 days 7 hours ago
Staff
加入:2018-02-08 11:03
Hi YehudaNovodes,

Hi YehudaNovodes,

我试图复制您提到的问题,但我能够通过ARCH_PRINTF()发送“0”。我工作在SDK 5.0.4的BLE_APP_BAREBONE示例中,我使用了PRO-DK。让我描述我做了什么,并确保你做过相同的配置。

  1. #define CFG_PRINTF in the da1458x_config_basic.h
  2. Change the uart ports of the fw and assign the UART_TX port/pin to P04 and UART_RX port/pin to P05 (make sure that the configuration that you have changed is under the HW_CONFIG_PRO_DK and that this the board declared in the HW_CONFIG definition).

#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

If you have one other of our DKs or if you are working on a custom board, please modify the definitions above with the appropriate GPIOs

  1. Include the arch_console.h file into user_barebone.c
  2. Invoke arch_printf("0"); into adv_data_update_timer_cb() function. So, I am sending “0” every 10 seconds.
  3. 将终端的波特率更改为115200。

If I understood anything wrong, please let me know what you are trying to accomplish or provide me hot to call the arch_printf() into your code.

Thanks, PM_Dialog

YehudaNovodes
Offline
Last seen:2 years 3 months ago
加入:2018-11-11 12:38
对不起,不清楚

对不起,不清楚enough.

Yes, I can send 0 via arch_printf.
The problem is when I'm trying to echo the input over UART. If one of the bytes inserted was 0x00, then when I'm trying to print the elements of an array that holds this byte, I get this error. I believe the reason is that 0 does not consider as a "value", so when I'm trying to print it, it can't find something to print and hence the error.

YehudaNovodes
Offline
Last seen:2 years 3 months ago
加入:2018-11-11 12:38
I checked the issue a bit

我多次检查过这个问题,我想我敢肯定现在的问题是什么。

我使用ARCH_PRINTF函数来打印数组。因此,如果例如,数组的内容是:

ExampleArr[2] = {0x01, 0x02};

我正在努力运行:

arch_printf (ExampleArr);

the print out is 01, 02 which is exactly what I want. The problem starts when the first element of ExampleArr is 0x00, then the SW runs into

if ((GetWord16(SYS_STAT_REG) & DBG_IS_UP) == DBG_IS_UP)
__asm("BKPT #0\n");

错误。
If the second element is 0x00 there's no problem.
当我尝试使用ARCH_PRINTF来打印0时:

ExampleVar = 0;
arch_printf("%x", ExampleVar);

没有错误,但实际打印的是0的ASCII值为0,即30。我需要打印0个值,而不是符号......

PM_Dialog
Offline
Last seen:2 days 7 hours ago
Staff
加入:2018-02-08 11:03
Hi YehudaNovodes,

Hi YehudaNovodes,

你能试试这个代码片段吗?

UInt8_t Examplearr [3] = {0x00,0x01,0x02};

for( uint8_t i = 0 ; i <3 ; i++)

{

arch_printf("%x",ExampleArr[i]);

}

arch_printf("\n\r");

否则,请在您将代码片段使用它进入固件时为我提供。

Thanks, PM_Dialog

YehudaNovodes
Offline
Last seen:2 years 3 months ago
加入:2018-11-11 12:38
Hi,

Hi,

As I mentioned, the arch_printf function gets the array to print by address arch_printf(ExampleArr) and not by value arch_printf(ExampleArr[i]). To be more clear, if I have a variable called ExampleVar = 0x01, then writing arch_printf (&ExampleVar) ends up with 1, printed on terminal but if ExampleVar = 0x00, the arch_printf(&ExampleVar) ends up with error!!

我不使用顺利的原因是打印出的值不是实际值,而是其ASCII兼容。所以,如果我返回我的前一个例子,这就是它在这两种情况下的样子:
1)
ExampleVar = 0x01;
arch_printf(&ExampleVar);
Print out is: 1

ExampleVar = 0x00;
arch_printf(&ExampleVar);
打印出:错误

2)
ExampleVar = 0x01;
arch_printf ("%x", ExampleVar);
Print out is: 31

ExampleVar = 0x00;
arch_printf ("%x", ExampleVar);
Print out is: 30

我真的希望这个问题现在很清楚......

PM_Dialog
Offline
Last seen:2 days 7 hours ago
Staff
加入:2018-02-08 11:03
Hi YehudaNovodes,

Hi YehudaNovodes,

为延迟道歉。我试图测试代码,这个代码段arch_printf(&examplevar)无法由Keil构建。这是一个非常奇怪的情况,因为如果我理解正确,这可以从你身边建造。此外,我的结果不同于你的结果。请检查以下内容:

ExampleVar = 0x01;

arch_printf ("%x", ExampleVar);

打印出:1(不是31,它是1的ASCII字符)

ExampleVar = 0x00;

arch_printf ("%x", ExampleVar);

Print out is: 0 (and NOT 30 which is the ASCII character of 0)

Could you please let me know if you have modified the source code of the arch_printf() function? Could you please try to do the same in a new SDK path? Be aware that I am using the latest SDK of D14580 series (SDK5.0.4)

Thanks, PM_Dialog

YehudaNovodes
Offline
Last seen:2 years 3 months ago
加入:2018-11-11 12:38
Hi,

Hi,

No, I haven't modified your source code of arch_prinf at all.
但我有一个更好的解决方案。对于在任何位置打印任何值的数组,我刚刚使用了UART2_WRITE(* arr,size,null)函数,当* arr是指向打印阵列的指针时,大小是要打印的大小,以字节为单位和null是空指针,如函数的描述中所需的。

PM_Dialog
Offline
Last seen:2 days 7 hours ago
Staff
加入:2018-02-08 11:03
Hi YehudaNovodes,

Hi YehudaNovodes,

Since that you didn’t modified the arch_prinf() function, it is a little bit strange because I get different results from yours. By the way, glad that you figured your issue out and that for your indication.

Thanks, PM_Dialog

Dionysus
Offline
Last seen:2 years 1 month ago
加入:2019-01-13 14:48
亲爱的论坛专家,

亲爱的论坛专家,
我正在使用SDK5.0.4工作DA14580。

I want to know How does the host receive SMP requests from the slave.
I had run my code,attach below,sniff the slave but there's no CALLBACK in the user functions.
it seems it was invalid?

How does the host receive SMP requests from the slave?

谢谢,劝告,
Dionysus

Attachment:
PM_Dialog
Offline
Last seen:2 days 7 hours ago
Staff
加入:2018-02-08 11:03
Hi Dionysus,

Hi Dionysus,

谢谢你的问题,但它与这个论坛线程无关。如果我理解正确,DA14580充当一个中心。由于您是一个中央,因此无法从外设请求安全性。如果您有任何其他后续问题,请创建一个新的论坛线程。如果您不知道热量创建一个新的论坛线程,请告诉我,我将为您提供合适的步骤。

Thanks, PM_Dialog

chenpenglai
Offline
Last seen:1 month 1 week ago
加入:2018-12-24 02:24
嗨yehudanovode,

嗨yehudanovode,

您可能会尝试可以发送十六进制的代码,如下所示:

extern void uart_callback(uint8_t res);

uint8_t data=0x00;

uart2_write(&data, 1, uart_callback);

PM_Dialog
Offline
Last seen:2 days 7 hours ago
Staff
加入:2018-02-08 11:03
Hi chenpenglai,

Hi chenpenglai,

谢谢你的迹象。

问候,pm_dialog