<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>How can an ANT slave re-connect to a different master?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/71716/how-can-an-ant-slave-re-connect-to-a-different-master</link><description>I have based my app on the ant_io_demo example and I have one master and one slave communicating successfully. 
 In my application I can have several masters from time time time, each using a different device number. I find that when one master switches</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 18 Feb 2021 10:06:03 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/71716/how-can-an-ant-slave-re-connect-to-a-different-master" /><item><title>RE: How can an ANT slave re-connect to a different master?</title><link>https://devzone.nordicsemi.com/thread/295036?ContentTypeID=1</link><pubDate>Thu, 18 Feb 2021 10:06:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f21464e7-89be-4b52-9957-bc856d6c8c85</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I can understand.&lt;/p&gt;
&lt;p&gt;If you are interested in ANT, you should check out &lt;a href="http://www.thisisant.com"&gt;www.thisisant.com&lt;/a&gt;&amp;nbsp;in general, and the ANT message protocol and usage document in specific:&lt;br /&gt;&lt;a href="https://www.thisisant.com/resources/ant-message-protocol-and-usage/"&gt;https://www.thisisant.com/resources/ant-message-protocol-and-usage/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In specific chapter 5 and 6 is something you should check out.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can an ANT slave re-connect to a different master?</title><link>https://devzone.nordicsemi.com/thread/295015?ContentTypeID=1</link><pubDate>Thu, 18 Feb 2021 09:04:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d678296-ab68-4409-9593-cf591c7e71a8</guid><dc:creator>Acutetech</dc:creator><description>&lt;p&gt;Thanks. I will try your ideas as soon as I can. This is my first ANT project, and I picked one of Nordic&amp;#39;s ANT demos that seemed similar to what I needed to do. That demo does not use many of the calls you mention, so of course these have not made their way into my own code...&lt;/p&gt;
&lt;p&gt;I guess the trouble with the demos is that they can be overly simplistic and fail when you try to push them a bit. Perhaps there is room for Nordic to create tutorials that provide background and guidance that are not found in either the example apps, nor the API specifications. I find myself often finding answers to my questions in these forums, where I join other newbies encountering the same problems as me.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can an ANT slave re-connect to a different master?</title><link>https://devzone.nordicsemi.com/thread/295000?ContentTypeID=1</link><pubDate>Thu, 18 Feb 2021 08:28:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce048f5e-1363-433a-bc2f-24c8acffdb48</guid><dc:creator>Kenneth</dc:creator><description>[quote user="Acutetech"]After the EVENT_RX_FAIL_GO_TO_SEARCH event my slave does see the first master if I power it back on, but does not see a second master.[/quote]
&lt;p&gt;Likely due to my initial reply:&lt;/p&gt;
&lt;p&gt;&amp;quot;&lt;span&gt;EVENT_RX_FAIL_GO_TO_SEARCH :&amp;nbsp;The channel has dropped to search mode after missing too many messages. &lt;span style="text-decoration:underline;"&gt;It will try to reconnect to the previous connected master.&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration:underline;"&gt;&amp;quot;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Acutetech"]I placed an sd_ant_channel_close() call in the EVENT_RX_FAIL_GO_TO_SEARCH event handler and immediately get a EVENT_CHANNEL_CLOSED event. In the EVENT_CHANNEL_CLOSED event handler I add an ant_search_init(), but it will not detect any master.[/quote]
&lt;p&gt;Did you follow my suggestion in initial reply:&lt;/p&gt;
&lt;p&gt;&amp;quot;&lt;span&gt;After channel is closed, then you&amp;nbsp;should be able to update channel ID to wildcards before opening channel again.&lt;/span&gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;So call&amp;nbsp;sd_ant_channel_id_set(make sure .device_number=0) and then call&amp;nbsp;sd_ant_channel_open().&amp;nbsp;&lt;/p&gt;
[quote user="Acutetech"]If I try the full ant_io_rx_setup() sequence (from the ant_io_demo example) of ant_channel_init(), search_init(), sd_ant_channel_open() it crashes.[/quote]
&lt;p&gt;You should look into what &amp;quot;crashes&amp;quot; means, if you are working on Debug (not Release) in SES, then typically the code should go to&amp;nbsp;app_error_fault_handler() where you can find the file name, line number, and error code that caused the crash. I suspect the problem may be that you have not&amp;nbsp;unassigned channel (see&amp;nbsp;sd_ant_channel_unassign()) after channel is closed, this is required if you want to do a complete re-init of the channel.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can an ANT slave re-connect to a different master?</title><link>https://devzone.nordicsemi.com/thread/294965?ContentTypeID=1</link><pubDate>Wed, 17 Feb 2021 21:23:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1fdba04b-ed25-4861-b3b6-f7581a4f861d</guid><dc:creator>Acutetech</dc:creator><description>&lt;p&gt;Hmmm. When I power off my master I get many EVENT_RX_FAIL events, then EVENT_RX_FAIL_GO_TO_SEARCH after 2s. I then see EVENT_RX_SEARCH_TIMEOUT and EVENT_CHANNEL_CLOSED after 30s, but only after I comment out this line (present in the ant_io_demo example):&lt;br /&gt;&lt;br /&gt;search_config.low_priority_timeout = ANT_LOW_PRIORITY_TIMEOUT_DISABLE&lt;br /&gt;&lt;br /&gt;After the EVENT_RX_FAIL_GO_TO_SEARCH event my slave does see the first master if I power it back on, but does not see a second master.&lt;br /&gt;&lt;br /&gt;I placed an sd_ant_channel_close() call in the EVENT_RX_FAIL_GO_TO_SEARCH event handler and immediately get a EVENT_CHANNEL_CLOSED event. In the EVENT_CHANNEL_CLOSED event handler I add an ant_search_init(), but it will not detect any master. If I add ant_search_init() then sd_ant_channel_open() it will detect my first master but not the second. If I try the full ant_io_rx_setup() sequence (from the ant_io_demo example) of ant_channel_init(), search_init(), sd_ant_channel_open() it crashes. So far the only way can communicate with a second master is to reset the nRF52 slave.&lt;br /&gt;&lt;br /&gt;Can I ask for specific instructions for establishing communications with a second master? Perhaps a variation of the ant_io_demo example with two masters?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can an ANT slave re-connect to a different master?</title><link>https://devzone.nordicsemi.com/thread/294903?ContentTypeID=1</link><pubDate>Wed, 17 Feb 2021 14:46:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f92f73e-2e1a-45cb-8106-7546e2e6489f</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;What happens typically when&amp;nbsp;a master is turned OFF is that the slave will experience some events in the following order:&lt;/p&gt;
&lt;p&gt;Several EVENT_RX_FAIL :&amp;nbsp;A&amp;nbsp;receive channel missed a message which it was expecting. This happens when a slave is tracking a master and is expecting a message at the set message rate.&lt;/p&gt;
&lt;p&gt;EVENT_RX_FAIL_GO_TO_SEARCH :&amp;nbsp;The channel has dropped to search mode after missing too many messages. It will try to reconnect to the previous connected master.&lt;/p&gt;
&lt;p&gt;EVENT_CHANNEL_CLOSED :&amp;nbsp;The channel has been successfully closed.&lt;/p&gt;
&lt;p&gt;Also see:&lt;br /&gt;&lt;a href="https://www.thisisant.com/resources/an11-ant-channel-search-and-background-scanning-channel/"&gt;https://www.thisisant.com/resources/an11-ant-channel-search-and-background-scanning-channel/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So I suspect in this case is that if you don&amp;#39;t wait for the channel closed then you may experience issues. After channel is closed, then you&amp;nbsp;should be able to update channel ID to wildcards before opening channel again.&lt;/p&gt;
&lt;p&gt;It&amp;#39;s also possible to close the channel by the close channel api, however I do believe you need to wait for the channel closed event before you do anything more with the channel (such as reconfigure and open again).&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>