software:nRF CONNECT SDK 1.6.1
CPU type:nrf5340
module:uarte
hi professor,
I want to trigger receiving interrupt when receiving timeout.I see the product specification there are rxto event in nrf5340.Do you have any example code for me?
software:nRF CONNECT SDK 1.6.1
CPU type:nrf5340
module:uarte
hi professor,
I want to trigger receiving interrupt when receiving timeout.I see the product specification there are rxto event in nrf5340.Do you have any example code for me?
Hello,
I don't think we have any example code showing you how to use the RXTO event directly, but it also doesn't do what you describe. The RXTO event is triggered if you use the STOP task register.
From what I understand from your question, you want to receive a buffer after a certain time, perhaps from the first byte. Is that correct? If so, you can look into the peripheral_uart sample found in NCS\nrf\samples\bluetooth\peripheral_uart.
In this sample, you will get a callback when the UART receives some bytes, and then stops. After a given amount of time, the UART will trigger a callback with all the bytes received before the timeout.
Best regards,
Edvin
hi professor,
I have uesd peripherl_uart example to test and it can meet my needs. But I must use path \zephyr\samples\bluetooth to create my project.Do you have any other suggestions
The reason is p_cb-<handle is NULL.
Ok, so you are trying to trigger a callback at NULL, then. Why is it NULL? Did you not set up a handler when you initialized the UART?
BR,
Edvin
I have used the uart_callback_set to set call back function.If don't use this function, what should I do?
sunnyyang said:If don't use this function, what should I do?
What do you mean?
I mean I have set callback by uart_callback_set function. But the p_cb-<handle is still NULL.
I mean I have set callback by uart_callback_set function. But the p_cb-<handle is still NULL.
Do you see the log from your application? What does uart_callback_set() return? Does it return 0 or something else? If you can see your log, you should see it printed
"uart set callback failure"
If it fails, it will print both lines (with your current implementation):
"uart set callback failure."
"uart set callback finished."
Which one is it? And if it fails, what does it fail with?
Try:
printf("uart set callback failure (err = %d)\n", err_code);