Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Trouble with shared channels

Rank

Total Posts: 6

Joined 2013-03-01

PM

Hi,

First of all I'm sorry if it's not the right place to put this post but I didn't know where to do it.

I'm trying to set up a shared channel with arduino boards and radio modules ( http://proto-pic.co.uk/transceiver-nrf24ap1-with-trace-antenna/ ). My aim is to make 4 or 5 arduino boards send messages to a central one.

I have managed to make two of them communicate together with an independant channel but when i'm trying to set up a shared channel it does not work anymore. I think it must be the configuration of each board because it's the only thing I change between the two versions. To build this configuration I've use this guide : http://www.sparkfun.com/datasheets/Wireless/Nordic/ANT-UserGuide.pdf .

Here is the configuration of my transmitters :
#define ANT_CH_ID    0x00
#define ANT_CH_TYPE  0x20
#define ANT_NET_ID   0x00
#define ANT_DEV_ID1  0x03
#define ANT_DEV_ID2  0x03
#define ANT_DEV_TYPE 0x03
#define ANT_TX_TYPE  0x03
#define ANT_CH_FREQ  66
#define ANT_CH_PER   2370
#define TIMEOUT      0x10 


Here is the configuration of my receiver :
#define ANT_CH_ID    0x00
#define ANT_CH_TYPE  0x30
#define ANT_NET_ID   0x00
#define ANT_DEV_ID1  0x03
#define ANT_DEV_ID2  0x03
#define ANT_DEV_TYPE 0x03
#define ANT_TX_TYPE  0x03
#define ANT_CH_FREQ  66
#define ANT_CH_PER   2370
#define TIMEOUT      0x10 

I can't figure out what's wrong with this.

You can also find attached my full code.

Thanks for your help.      

File Attachments

Avatar
RankRankRankRank

Total Posts: 235

Joined 2012-08-31

PM

Hi!

First of all, the datasheet you link is 5 years out of date, so you might find it helpful to download the current version from our downloads page (http://www.thisisant.com/developer/resources/downloads/#documents_tab). It's the ANT Message Protocol and Usage doc version 5.0. Also you will probably find it helpful to look at AN07 Auto Shared Channel Master Example, as it contains the most detail about shared channels.

I can't see anything obviously wrong in your channel configuration. You have the right channel type and the transmission type you are using specifies 2 byte shared addressing. I am assuming your ANT_DEV_ID 1 & 2 refer to the device number (which is also fine).

In addition to the set up you have described your host application needs to handle the addressing for each node. Each slave needs a different address, and the master needs to know what all the addresses are. If you aren't sure how to handle this then the application note and example application should help you (AN07).

Unfortunately I can't download your code - if this answer doesn't help then you could try reposting it as a text file, and I should be able to see it then.

Hope that helps,

Kat
     
Rank

Total Posts: 6

Joined 2013-03-01

PM

Thanks for your reply.

I didn't do the handshaking. I'll try it now.
I just have one more question about the messages mentioned in AN07. Do I have to send them like that or with the typical message structure ?
I mean do I have to send [FF][FF][FF][00][00][04][01][00] or this sequence of bytes is the data part of a Serial message ?

Thanks for your help.      
Avatar
RankRankRankRank

Total Posts: 235

Joined 2012-08-31

PM

The data pages described in AN07 are examples, showing a set of data messages that could be used to manage dynamically assigning addresses to slaves. You could choose another method. But you do need the top two bytes of any data message you send to represent the shared channel address.      
Rank

Total Posts: 6

Joined 2013-03-01

PM

I still can't make it work. I'm stuck on the handshaking. One of my nodes asks for an address in the shared channel but the central one does not receive anything even though the top two bytes of any data message I send represent the shared channel address (FFFF).

I can't figure out what's wrong so I'm sending you my code :
receiver (central node) : http://infolimon.iutmontp.univ-montp2.fr/~martinr/receiver.txt
transmitter : http://infolimon.iutmontp.univ-montp2.fr/~martinr/transmitter.txt

Thanks again for your help, I appreciate it.      
Avatar
RankRankRankRank

Total Posts: 235

Joined 2012-08-31

PM

Hi again,

OK, a couple of pieces of knowledge that will probably help here:

- Each slave should end up with it's own unique shared address. You can assign these dynamically (as described in AN07) OR if you already know what addresses you want to use you can assign them when you open the slave's channel.

- The slave's host sets it's shared address by sending a broadcast message where byte 0-1 represent it's shared address.

A simpler example, that may be helpful is in the ANT message protocol and usage doc, section 8.2.

Let me know if this solves it for you!      
Rank

Total Posts: 6

Joined 2013-03-01

PM

Hi,

I'm sorry to disturb you again but I still can't make it work.
I'm first trying to solve some problems I've got with an independant channel but I still have these channel event messages : [A4] [3] [40] [0] [1] [2] [chksum] and after a few of these frames received I do not receive any message anymore. According to the "message guide" it seems to be an EVENT_RX_FAIL but I don't understand why it happens and how to solve this.

I also try to make a shared channel but I do not receive any message. One of my transmitter tries to acquire a unique shared address using a broadcast frame where bytes 0-1 are set to 0xFF but my receiver does not receive anything.

Thanks for your help.      
Avatar
RankRankRankRank

Total Posts: 235

Joined 2012-08-31

PM

Hi Vodkajin,

Can you post your logs of the serial messages for your current set up and I'll take a look?

Thanks!      
Rank

Total Posts: 6

Joined 2013-03-01

PM

Hi again !

I managed to make it work, but there is still one little problem : Everything is received by the receiver, but here is what the output looks like :

On the transmitter side :
A4 9 4E 0 0 0 0 0 0 0 0 0 E3
A4 9 4E 0 0 0 0 0 0 0 0 1 E2
A4 9 4E 0 0 0 0 0 0 0 0 2 E1
A4 9 4E 0 0 0 0 0 0 0 0 3 E0


On the receiver side :
A4 9 4E 0 0 0 0 0 0 0 0 1 E2
A4 9 4E 0 0 0 0 0 0 0 0 1 E2
A4 9 4E 0 0 0 0 0 0 0 0 1 E2
A4 9 4E 0 0 0 0 0 0 0 0 1 E2
A4 9 4E 0 0 0 0 0 0 0 0 1 E2
A4 9 4E 0 0 0 0 0 0 0 0 1 E2
A4 9 4E 0 0 0 0 0 0 0 0 2 E1
A4 9 4E 0 0 0 0 0 0 0 0 2 E1
A4 9 4E 0 0 0 0 0 0 0 0 2 E1
A4 9 4E 0 0 0 0 0 0 0 0 2 E1
A4 9 4E 0 0 0 0 0 0 0 0 2 E1
A4 9 4E 0 0 0 0 0 0 0 0 2 E1
A4 9 4E 0 0 0 0 0 0 0 0 2 E1
A4 9 4E 0 0 0 0 0 0 0 0 2 E1
A4 9 4E 0 0 0 0 0 0 0 0 2 E1
A4 9 4E 0 0 0 0 0 0 0 0 3 E0
A4 9 4E 0 0 0 0 0 0 0 0 3 E0
A4 9 4E 0 0 0 0 0 0 0 0 3 E0
...


As you can see, each frame is received several times. My thinking is that, as I only send a frame every two seconds, the receiver must read the buffer's content over and over. And I guess the buffer's content remains the same as long as another frame has nos been sent.

Would you happen to know how I could fix this ?

Again, I really appreciate your help on this grin

PS : I updated the files on my FTP :
receiver : http://infolimon.iutmontp.univ-montp2.fr/~martinr/receiver.txt
transmitter : http://infolimon.iutmontp.univ-montp2.fr/~martinr/receiver.txt
ant_lib (receiver side) : http://infolimon.iutmontp.univ-montp2.fr/~martinr/ant_lib.txt      
Avatar
RankRankRankRank

Total Posts: 235

Joined 2012-08-31

PM

Hi! Congrats on getting it sorted smile

What you are seeing now is normal. When you send a message from your transmitter's application layer to ANT, ANT will transmit it every channel period until you send a new message to ANT. It keeps sending what is in the buffer and this is what you are seeing at your receiver.

As you say you are providing messages to ANT every 2 seconds you could reduce the channel period to 0.5Hz, and then the rates would match. But having the message sent more often has some advantages, e.g.
- in the case of RX fails, you have more chances to receive the message.
- faster channel periods make the search and acquisition process faster - so expect it to take longer for your device to connect if you go to 0.5Hz.

We often use sequence numbers or event counters in the data messages, so the receiver knows when it has received a "new" message.      
Rank

Total Posts: 6

Joined 2013-03-01

PM

Everything is working properly now ! Thank you for your help !
However is still have a last question.

A4 3 40 0 1 3 E5
I receive a lot of messages like the one above when I'm on a shared channel. Is it normal? Is there a way to avoid them?      
Avatar
RankRankRankRank

Total Posts: 235

Joined 2012-08-31

PM

That's a channel event message telling you that a broadcast message was sent successfully. They are generated automatically and are normal.

You can't stop these messages on an AP1. You'd need a chip that supported event filtering to do that.

If you aren't what other messages mean, the quickest place to look them up is section 9.3 in the ANT Message Protocol and Usage doc.