How does DA14531 realize the serial port to receive data of variable length?

4 posts / 0 new
Last post
MrWeng
Offline
Last seen:2 weeks 1 day ago
加入:2020-02-13 08:56
How does DA14531 realize the serial port to receive data of variable length?

I am a novice, because I don’t know the length of the data to be received, so how do I use DA14531's UART1 to receive data of variable length? Thank you very much!

Device:
Martin.Ge
Offline
Last seen:13 hours 5 min ago
Staff
加入:2020-01-06 06:51
Hi Mr. Weng,

Hi Mr. Weng,

I am little confused. Do you mean that you want to know how to measure the data length?

And by the way, you are welcome to ask any questions. : )

Br

MrWeng
Offline
Last seen:2 weeks 1 day ago
加入:2020-02-13 08:56
In the SDK, I want to use the

In the SDK, I want to use the function void“uart_receive (uart_t * uart_id uint8_t *哒ta, uint16_t len, UART_OP_CFG op) ”to receive data, but before using this function, you must know the length of the received data, that is, you need to know in advance The value of len, because I am not sure about the length of the data received through the serial port, so I cannot determine the value of len. Is there a way to accept data without being uncertain about the value of len?

Martin.Ge
Offline
Last seen:13 hours 5 min ago
Staff
加入:2020-01-06 06:51
Before use “uart_receive(uart

Before use“uart_receive (uart_t * uart_id uint8_t *哒ta, uint16_t len, UART_OP_CFG op) ",you need to set up a callback functionuart_register_rx_cb(uart_t *uart_id, uart_cb_t cb),in which the functionuart_cb_tcontains the data length parameter. You can find these inuart.cfile