Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Can’t open channel 3 to 7

Rank

Total Posts: 2

Joined 0

PM

Hello,

I'm designing several master devices which are sending data through a nRF24AP1 to a PC (slave) which has a nRF24AP2 USB stick.

I wrote a piece of software in C++ using the ANT_DLL and it works perfectly fine with channels 0,1 and 2. But I can't open the channel 3 or above because an "Invalid message" answer occurs when I'm setting the network key.

I tried to see what's happening with ANTware II, and all the data from every channel are coming without any problem, including channels 3 to 7.

I'm not using wild card nor pairing and the network key is the same for every channel.

Do you have any idea of how can I solve my problem?

Thanks a lot      
RankRankRank

Total Posts: 55

Joined 2008-10-24

PM

The ANT will return message code "INVALID_MESSAGE" when it receives the message have invalid parameters.
please ensure the length of network key and other ANT related parameters are correct and no invalid parameters.      
Rank

Total Posts: 2

Joined 0

PM

Thanks for answering so quickly.

I just swapped the AP2 module which was on the USB stick with an AT3 module, and it works without changing the code.

But it doesn't tell me why it isn't working with the AP2.

The piece of code I'm using is:

UCHAR ucNetKey[8] USER_NETWORK_KEY;
ANT_SetNetworkKey(ANTCHANNELucNetKey); 


When ANTCHANNEL is defined as 0,1 or 2 the network key is set correctly; whereas when it's defined as 3 or higher it returns an "INVALID_MESSAGE". I guess I'm not using invalid parameters, otherwise it couldn't work with channels 0,1 & 2.

Cheers      
Avatar
RankRank

Total Posts: 39

Joined 2011-06-29

PM

ANT_SetNetworkKey(ANTCHANNEL, ucNetKey);

is used to set the network keys for the entire chip, in the case of your AP2 USB stick, the max number of network keys is 3 (that's why it is working for 0, 1, and 2).
If you want to open all your channels with the same network key you should use
ANT_SetNetworkKey(0, ucNetKey); //once to initialize network key 0
ANT_AssignChannel(ANTCHANNEL, ucChannelType, 0); //per wanted channel

This will initialize network key 0 to your ucNetKey, and tell each channel you assign to use that key.      
Rank

Total Posts: 2

Joined 0

PM

Perfect! My problem is solved.

Thanks so much.

Cheers