Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Auto-Shared channel Slave example

Rank

Total Posts: 1

Joined 2010-05-20

PM

Hello everybody,

We are trying to make a network with one Master and several slaves in Auto-Shared channel configuration.

We have some problems implementing the state machine on the slaves side in order to receive the packets from master. We do not understand wich address we need to setup as initial shared adress on the slaves before the Auto-shared negotiation starts.
I mean, when I open the slave shared channel, I need to setup any shared adress at the begining ? wich ? 0x0000 or 0xFFFF ??
There are some example source code of the slave implementation of the Auto-shared Channel ?

Thank you in advance,
Regards,
Joan.      
RankRankRankRank

Total Posts: 523

Joined 2012-11-15

PM

Hi to everybody.

I had a problem with a slave in auto shared address mode.

Working with a fix salve address was working fine:
Slave start-up:
(1) ANTInterface_init();
(2) ANT_NetworkKey(..........);
(3) ANT_AssignChannel(..........);
(4) ANT_ChannelId(..........);
(5) ANT_ChannelPeriod(..........);
(6) ANT_ChannelRFFreq(..........);
(7) ANT_SearchTimeout(..........);
(8) ANT_SetProximitySearch(..........); // Disable in this case
(9) ANT_OpenChannel(..........);
(10) Send broadcast message with Shared Address to set slave shared address, If I don't send this message I can receive any from master.

With this process, the system is working fine. I was using 0x0001 as shared address.

Now I'm using auto shared address.
The master is working fine but the slave have problems.
I'm using the same process of start up, but the default shared address is 0xFFFF.
I can receive the 0xFFFF shared address messages but when the master send 0xFFFE I don't receive anything.

What I'm doing wrong ?
What will be the default shared address to set at start-up.
How can I receive messages without fixing the final shared slave value ?

Thanks

Miquel Soler I Mir      
Avatar
RankRankRankRank

Total Posts: 213

Joined 2011-05-02

PM

Hi,

Since the master has no knowledge of the slave's shared addresses in an auto-shared channel, handshaking is necessary to register the slave with the master and obtain a shared address than is then used to participate in the shared channel.

The master starts by sending the Address Available (0xFF) message to tell any interested slaves that space is available on the shared channel. This message contains the value of the next available shared address and the suggested data timeout value. The shared address of all of the messages used during the first stage of the handshake process is 0xFFFF. This shared address value should not be assigned to a slave and should be reserved ONLY for handshaking.

A slave listening for an Address Available message will send back the Request Address (0xFD) message. This message contains a 4 byte ID value that should be unique to the slave, and is sent as an acknowledged message. The slave will continue onto the next stage, ONLY if the master acknowledges this message.

After the Request Address message is received, the master will transmit the Busy Acquiring (0xFE) message in any free time slot. This message contains the unique ID the master received from the slave. The shared address of this message is changed to 0xFFFE. All subsequent messages for the rest of the handshaking process will have this address. 0xFFFE should NOT be assigned to any slave.

The slave then tries to send back the Confirm Acquire (0xFC) message. This message also contains the unique ID of the slave. It is sent as an acknowledged message, and if properly acknowledged the master and slave will have completed the initial handshake.

For more information, please read the Auto Shared Channel Application Note found in the Developer's Zone:

http://www.thisisant.com/pages/developer-zone/ant-application-notes      
Avatar
RankRankRankRank

Total Posts: 213

Joined 2011-05-02

PM

Hello,

Please refer to the "Auto Shared Address" forum post (link below):

http://www.thisisant.com/component/option,com_fireboard/Itemid,146/func,view/catid,25/id,1609/

The application note AN07 Auto Shared Channel (found in the Developer's Zone) outlines the message sequence for slave device registration:

http://www.thisisant.com/pages/developer-zone/ant-application-notes

Pay particular attention to page 4 of the application note. The initial shared address during the "Handshake" process should be 0xFFFF.

Unfortunately, there is no example source code for the slave implementation at this moment. However, there is an Embedded Reference Design in the ANT+ Adopter Zone:

http://www.thisisant.com/pages/ant/ant-embedded-reference-code

as well as master example source code contained in the application note Zip file.

I hope this helps,

Regards

Kassandra      
RankRankRankRank

Total Posts: 523

Joined 2012-11-15

PM

Hello,

yes, I know that app note.
May be the problem is that I do not understand properly the Shared Channel behaviour.

If I open a Shared slave channel, How can I set the shared address to the ant node ? If I understand well, this is done by sending a initial message that has the first couple of bytes with the shared adress I want to use in my slave node. In that case, I should use 0xFFFF as shared address. The problem is when the Auto shared Master state machine send to the slave the Busy acquiring frame (0xFE), the shared address used by the master is changed to 0xFFFE so the slave who has the shared 0xFFFF doesn't receive the packet.
I'm sure that I am confused on something but I do not know what is the problem.
I would like to know, the procedure openning the channel on the slave side. I need to set a initial packet with any specific shared address ?

I my opinion, all slaves with no address asigned, must open the channel with a shared address that enables the reception of all packets from the master. But, How can I do that ? Can I use the shared address 0x0000 ?

Thanks,
Joan.      
Avatar
RankRankRankRank

Total Posts: 213

Joined 2011-05-02

PM

Hi Joan,

If you are using an Auto-Shared Channel, it is assumed that the master device has no knowledge of the slaves' shared addresses, or the slave devices cannot be provided with unique shared addresses.
An ANT Auto-Shared Channel is useful if you wish to provide the ability for a master device to dynamically register slave devices and assign them unique shared addresses that they can use to participate in the shared channel.

I think your confusion is that the slave's shared address changes throughout the handshake process before it is set by the master.

Initially, the master will send the Address Available (0xFF) message with shared ID 0xFFFF indicating that slots are available. This message contains the next available shared address and the suggest data timeout.
The slave device that wishes to acquire a shared address from the master will have shared address 0xFFFF. If a listening slave receives the Address Available message, it will send back the Request Address (0xFD) message. This message is sent as ACKNOWLEDGED data. This message also has the shared address of 0xFFFF, and contains the Slave's unique serial number or device ID.
If this Request Address message is successfully received by the master, it will acknowledge it.
Upon receiving the acknowledge message, the slave should recognize that it must now change its shared address to 0xFFFE in anticipation for the next message from the master.
The master will then send the Busy Acquiring (0xFE) message with shared address 0xFFFE. This message contains the unique ID that the master received from the slave in the Request Address message
The slave (whose shared address is now 0xFFFE) will send the Confirm Acquire (0xFC) message with shared address 0xFFFE. This message is also sent as ACKNOWLEDGED data and contains the unique ID of the slave.
After the slave receives the acknowledgement from the master that the Confirm Acquire message was received successfully, the initial handshake is complete.
The slave will then change its shared address to the shared address received by the master in the initial Address Available message. After this, the slave device works the same as a shared channel slave device. If the master wishes to send the slave device a message it should use this shared address.

To implement an Auto-Shared slave device, it is important to note that its shared address needs to be explicitly changed throughout the handshake process.

I high recommend looking at the Embedded Reference Code available in the ANT+ Adopter Zone:

http://www.thisisant.com/pages/ant/ant-embedded-reference-code

Pay particular attention to Main_Demo3.c. This code provides an example slave device configured as auto-shared.

I hope this helped,

Kassandra      
Avatar
Rank

Total Posts: 13

Joined 2013-01-09

PM

I know this is an very old thread.
But I am running into the same problem.

Totally understood the concept and the application note and main_demo3.c in the reference design.

This problem I am having right now is in Nordic nrf51422, there is no command to "set" shared address, as Main_SetSharedAddress does through the serial port.

In nRF51422, the first broadcast message from a shared channel slave after the channel is open has the shared address set in the first 1 or 2 bytes.

Did I miss anything in Nordic's document?

Thanks

Paul
     

Signature

BLE and ANT Developer using Nordicsemi nRF51422, ON, Canada