<?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>Reverse direction: send message from slave</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/17939/reverse-direction-send-message-from-slave</link><description>Hello Nordic, 
 I have a question: how do I send a message from a slave to a master? I want to do the same as sd_ant_acknowledge_message_tx, starting the communication from the slave. Right now I am trying with that same function but I get an error </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 28 Nov 2016 13:00:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/17939/reverse-direction-send-message-from-slave" /><item><title>RE: Reverse direction: send message from slave</title><link>https://devzone.nordicsemi.com/thread/69188?ContentTypeID=1</link><pubDate>Mon, 28 Nov 2016 13:00:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ea2884e-6c6d-4a89-9b58-19d590d44635</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;I&amp;#39;m sorry, I don&amp;#39;t understand what the problem is. And I think we have drifted way too far from the original question. Please try to ask unrelated questions separately. I think you should make a new question and explain in detail what the problem is, link to this question if you feel it&amp;#39;s relevant. And maybe you can add an answer to this one? Or close it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reverse direction: send message from slave</title><link>https://devzone.nordicsemi.com/thread/69187?ContentTypeID=1</link><pubDate>Mon, 28 Nov 2016 11:53:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:486f71ab-3849-410a-b8be-366ed737ff5d</guid><dc:creator>angel</dc:creator><description>&lt;p&gt;Hi Petter!&lt;/p&gt;
&lt;p&gt;Is there a way of getting an event sooner than EVENT_RX_SEARCH_TIMEOUT? Not even EVENT_CHANNEL_CLOSED? Maybe the one called GO_TO_SEARCH? My main problem is that even if I sucessfully send sd_ant_channel_close() (the error code is 0x0000), I don&amp;#39;t get the event to trigger, and my whole program is waiting for this to happen...&lt;/p&gt;
&lt;p&gt;The reason why I would close the channel before the message is ACK&amp;#39;d is because it is a user input from the button. The user presses a button to: close the channel, wildcard the channel ID and start to search for a new master. As I do these things one after the other, respecting each interrupt happening, if one of those interrupts doesn&amp;#39;t trigger (now, EVENT_CHANNEL_CLOSED is not triggering), the program gets stuck.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reverse direction: send message from slave</title><link>https://devzone.nordicsemi.com/thread/69186?ContentTypeID=1</link><pubDate>Mon, 28 Nov 2016 11:30:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d60c1e4-2b35-4d48-9ca8-584f8ee13984</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Great!&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;If there aren&amp;#39;t any masters matching the channel ID criteria you will not get any event until you get EVENT_RX_SEARCH_TIMEOUT.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Yes. Yes.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Are you calling APP_ERROR_CHECK() with the returned error code of sd_ant_channel_close()? What is the returned error code of sd_ant_channel_close()? Why would you not wait for the ack of an ACK message you have sent?&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reverse direction: send message from slave</title><link>https://devzone.nordicsemi.com/thread/69189?ContentTypeID=1</link><pubDate>Sat, 26 Nov 2016 10:54:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bbb81232-281a-44f6-9ee0-aeaa69258afc</guid><dc:creator>angel</dc:creator><description>&lt;p&gt;Hi again!&lt;/p&gt;
&lt;p&gt;Ok, I finally got the system to send ACK messages from the slave to the master. Have some questions now:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;When a channel is open from the slave, it starts searching for a master until it finds it or until it times out. While the slave is searching, which event is triggered? EVENT_RX? The thing is that I don&amp;#39;t get any ANT events in slave when I start a channel and I don&amp;#39;t have any master connected. Any events at all.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;When a channel is open from the master, what does it do? Does it trigger EVENT_TX at every channel period? Even if we don&amp;#39;t fill the payload with information (using sd_ant_xxx_message_tx...)?&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;I don&amp;#39;t know why this is happening, but if I open a channel from the slave, start sending ACK messages to the master, and after a while, try to close the channel (with a button press, for example), the microprocessor resets itself, and the event EVENT_CHANNEL_CLOSED never triggers (this situation drives to HardFault). Why is that? To close the channel sucessfully without this happening, I have to first allow the slave to finish sending the data that is pending in the stack(i.e. wait for EVENT_TRANSFER_TX_COMPLETED), and then, close the channel. What is happening? (Myabe this question is related? &lt;a href="https://devzone.nordicsemi.com/question/18382/no-event_rx_search_timeout-event/)"&gt;devzone.nordicsemi.com/.../)&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The reason I want to close the channel is to change the channel ID and reopen.&lt;/p&gt;
&lt;p&gt;Thanks again for the help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reverse direction: send message from slave</title><link>https://devzone.nordicsemi.com/thread/69192?ContentTypeID=1</link><pubDate>Fri, 25 Nov 2016 08:54:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8cc4fc0e-db8b-46f8-9490-b538b06f2761</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;So I think you should receive TRANSFER_TX_COMPLETED, TX_TRANSFER_FAILED or GO_TO_SEARCH. What do you mean by that you are not receiving anything right after? Do you receive anything later?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reverse direction: send message from slave</title><link>https://devzone.nordicsemi.com/thread/69191?ContentTypeID=1</link><pubDate>Fri, 25 Nov 2016 08:52:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35dc56ff-6136-4d39-b711-b0c635f6818e</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Acknowledged data messages can be sent from a slave to a master. In this case the message is sent immediately after a message is received from the master. If the acknowledged data message is sent successfully, this will be indicated by the channel event TRANSFER_TX_COMPLETED. If no acknowledgement is received from the master, this will be indicated by TX_TRANSFER_FAILED, which either means that the message failed to reach the master, or that the response from the master failed to reach the slave. In this case the slave’s application layer may retry the message. A third possible scenario is that the channel is dropped and the slave begins to search; in this case the event GO_TO_SEARCH will be received, instead of either of the other two commands. If GO_TO_SEARCH is received then the acknowledged message will not be sent, and the channel should be unassigned&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reverse direction: send message from slave</title><link>https://devzone.nordicsemi.com/thread/69190?ContentTypeID=1</link><pubDate>Fri, 25 Nov 2016 08:52:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ec8ff56-0b98-4f9b-92f0-8e1ce095bc29</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;From the ANT Message Protocol and Usage:&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reverse direction: send message from slave</title><link>https://devzone.nordicsemi.com/thread/69193?ContentTypeID=1</link><pubDate>Thu, 24 Nov 2016 16:26:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:02ac10e5-7ba2-495b-b7e2-181e168265a2</guid><dc:creator>angel</dc:creator><description>&lt;p&gt;Ok, right now I do it right after opening the channel and it does it correctly (weird that for sd_ant_broadcast_message_tx it can be done before opening)&lt;/p&gt;
&lt;p&gt;Now, I am not getting EVENT_TRANSFER_TX_COMPLETED or EVENT_TRANSFER_TX_FAILED right after, is this expected behaviour just because the one that initiates the communication is the master?&lt;/p&gt;
&lt;p&gt;So, the solution was, I had to send the first message (sd_ant_acknowledge_message_tx) &lt;strong&gt;after&lt;/strong&gt; opening the channel, and not before, as it can be done in the case of a master node.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reverse direction: send message from slave</title><link>https://devzone.nordicsemi.com/thread/69185?ContentTypeID=1</link><pubDate>Thu, 24 Nov 2016 12:48:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d4b6c768-fbf4-4f2b-b5b8-6d9223b7eae0</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;I think this is expected behavior. It works after you have opened the channel?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reverse direction: send message from slave</title><link>https://devzone.nordicsemi.com/thread/69184?ContentTypeID=1</link><pubDate>Thu, 24 Nov 2016 11:49:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d856484-3731-4596-9bf1-da4297fb514b</guid><dc:creator>angel</dc:creator><description>&lt;p&gt;Well, first I do the init() of the channel, and then to fill the buffer I send the message (sd_ant_acknowledge_message_tx), and then open the channel. Same order as the broadcast_tx actually, which works good when CHANNEL_TYPE_MASTER is set, but not when CHANNEL_TYPE_SLAVE.&lt;/p&gt;
&lt;p&gt;Any ideas? Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reverse direction: send message from slave</title><link>https://devzone.nordicsemi.com/thread/69183?ContentTypeID=1</link><pubDate>Thu, 24 Nov 2016 11:08:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e74dd93-feeb-4ae2-a31b-ce6a9a8141e1</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;What do you mean by starting the communication from the slave? 0x4015 is NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE see ant_error.h. Is the channel open? Are you using the CHANNEL_TYPE_SLAVE channel type?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reverse direction: send message from slave</title><link>https://devzone.nordicsemi.com/thread/69181?ContentTypeID=1</link><pubDate>Thu, 24 Nov 2016 08:52:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe80f832-2900-47d6-b991-83f0b51fd95f</guid><dc:creator>angel</dc:creator><description>&lt;p&gt;OK Artucas!, thanks anyhow for the help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reverse direction: send message from slave</title><link>https://devzone.nordicsemi.com/thread/69180?ContentTypeID=1</link><pubDate>Thu, 24 Nov 2016 08:35:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa5b461a-6a83-4180-805f-fe03fe57a037</guid><dc:creator>Artucas</dc:creator><description>&lt;p&gt;Oh my bad, i didn&amp;#39;t read your full message. You are ussing ANT here, rigth? I thought you are asking for bluetooth LE. I haven&amp;#39;t done anything with ANT, so really can&amp;#39;t help. You will have to wait for another answers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reverse direction: send message from slave</title><link>https://devzone.nordicsemi.com/thread/69179?ContentTypeID=1</link><pubDate>Thu, 24 Nov 2016 08:35:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b786ca64-02d3-4426-8e49-e5128c67a15a</guid><dc:creator>Artucas</dc:creator><description>&lt;p&gt;You can simply broadcast your packets by allowing your device to periodically transmit data packets in the air (Beacon type). However, in that case, you can only be sure that you will achieve a packet if your central is in range, but that does not give any strict timing. It might take some time for a central to find those packets. I believe the only way to make sure that your packets arrive is to do it via connection. When you connect to your peripheral, you could just enable characteristic notification and periodically send a notification to the central. That way you are guaranteed to get the message.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reverse direction: send message from slave</title><link>https://devzone.nordicsemi.com/thread/69182?ContentTypeID=1</link><pubDate>Thu, 24 Nov 2016 06:50:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e3020b5-f2a4-4ec4-afeb-fd9cbc6a3589</guid><dc:creator>angel</dc:creator><description>&lt;p&gt;I want to periodically send packages from slave to master, and somehow make sure that they have arrived. What I thought of so far is, I start the communication with the master, with sd_ant_acknowledge_tx, and then, when I receive this in the slave (EVENT_RX in slave), I do sd_ant_broadcast_message_tx in slave, and manage it in EVENT_TX in master. Is this the only way of doing what I intend?&lt;/p&gt;
&lt;p&gt;I had no idea of the existence of such advertisement that you mention. Could you explain a bit more?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
&lt;p&gt;Best,&lt;/p&gt;
&lt;p&gt;Angel.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reverse direction: send message from slave</title><link>https://devzone.nordicsemi.com/thread/69178?ContentTypeID=1</link><pubDate>Wed, 23 Nov 2016 21:53:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:491b3463-b425-4d90-8f28-76b0fa1d71dd</guid><dc:creator>Artucas</dc:creator><description>&lt;p&gt;Could you elaborate a little more what you really want to do? Do you know that you can put any data in advertisement packet and master will receive it when scanning for devices? Or do you want to do that in a connection?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>