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.
Can you wait for a long period of time for test? E.g. 40seconds? I think default search time is around 30 seconds, I just want to understand if it closes at the end.
Kenneth
Hi Kenneth,
I have confirmed that when I do ant_channel_close, I can't get EVENT_CHANNEL_CLOSED even if timeout 50s. I have added the test project and test log.


Hi Kenneth,
Any update?
Hello,
Seems like the zip file is invalid, maybe it wasn't fully uploaded.
Have you tried to call close channel more than one time? Does it return any error?
Kenneth
Hello,
Seems like the zip file is invalid, maybe it wasn't fully uploaded.
Have you tried to call close channel more than one time? Does it return any error?
Kenneth
Hi Kenneth,
I have try to close many times, "ant_channel_close" return 0, and still no EVENT_CHANNEL_CLOSED. The file ”ble_ant_app_hrm_v324_0602.zip“ I have download and unzip is ok. Anyway, I have upload again. Please check.
Thanks.
ble_ant_app_hrm_v324_0603.zip
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.