Hi
I'm encountering a problem than the ANT device cannot be scanned. you can use project "ble_ant_app_hrm_v324"(ncs 324), and modify "

Hi
I'm encountering a problem than the ANT device cannot be scanned. you can use project "ble_ant_app_hrm_v324"(ncs 324), and modify "

Hello,
If I remember correctly ant_channel_open() return 0x4015 means channel is in wrong state.
Are you sure the channel is in closed state? E.g. wait for EVENT_CHANNEL_CLOSED before you open it again. When the issue occurs, what does sd_ant_channel_status_get() return?
Kenneth
Hi,
This issue occur then I do ant_channel_close and can't get EVENT_CHANNEL_CLOSED response. And ant_channel_status_get() always is 2.
Hi Kenneth,
Any update? Does the issue can be reproduced in your side?
Hello,
Sorry, not had time to try this yet.
Kenneth
Hi Kenneth
Briefly, the main test in this project is to repeatedly ANT scan open and close
I have reworked this project to make it more rigorous. To ensure that each close operation is successful, after executing ant_channel_close(ANT_BS_CHANNEL_NUMBER); I use a semaphore and continuously monitor for the callback below. The semaphore is released only after receiving the signal that the channel has been closed.

From the test results, everything runs normally at the beginning, but after about 2-3 minutes, the following exception occurs.

It can be seen that the ANT channel can no longer be closed normally, and this log continues indefinitely. It looks like the ANT thread can no longer recover and is permanently stuck in the logic that reports the channel close failure.
This example can be easily reproduced by using the following standard ANT device for testing. The test device is shown below:



Also, this issue seems to occur only on SDK-ANT 2.1.0; older versions do not have this issue.
Below it is reproduce project:
BR
Hello, we're looking into your issue now. I was able to reproduce it with your sample.
What was the reasoning behind introducing prints into the event handler? Have you seen this issue without the prints/sleep in place? I was not able to see it in that case, the scan loop runs to completion. It also seems that the issue doesn't occur using CONFIG_LOG_MODE_DEFERRED=y instead of CONFIG_LOG_MODE_IMMEDIATE. Since the ANT work queue that handles events is cooperative, blocking in the handler starves event dispatch and is discouraged by Zephyr's work queue constraints.
I hope one of those options can unblock your development while we look for a root cause.
Hi,
I have moved my bussiness code in "antplus_evt_handler" to another thread, including the printfs, and the issue not happen for now. But we still hope to know the root cause, and fix it.
Thank you.
Hi,
I have moved my bussiness code in "antplus_evt_handler" to another thread, including the printfs, and the issue not happen for now. But we still hope to know the root cause, and fix it.
Thank you.