Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Getting DEMO_DLL to work

Rank

Total Posts: 16

Joined 2012-11-28

PM

I can build the DEMO_DLL (part of ANT_Libraries) in Visual Studio 2008. I'm trying to get it to communicate with a Garmin ANT stick and a Garmin Cadence/Speed sensor. But nothing happens. I don't get any errors. I added some logging to the program and here is what is happening. 'R:' is logged in the response_callback() and 'C:' are messages in the channel_callback(). One thing that I'm not sure about is what the USER_NETWORK_KEY needs to be. I've tried these with no luck:

#define USER_NETWORK_KEY {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
#define USER_NETWORK_KEY {Edit: Public Network Key (refer to Link below)}

I've also set these:
#define USER_BAUDRATE (57600) // For AP1, use 50000; for AT3/AP2, use 57600
#define USER_DEVICETYPE (121) // cadence/speed sensor

I'm not receiving any other callback messages. Why isn't this working?

Thanks,
Bob


init()
ANT Library loaded
ANT Library Version AOA3.000
Initialization was successful!

R: RESET Complete, reason: R: RESET_CMD
R: Network key set
R: Assigning channel...
R: Channel assigned
R: Setting Channel ID...
R: Channel ID set
R: Setting Radio Frequency...
R: Radio Frequency set
R: Opening channel...
R: Channel opened
R: Enabling extended messages...
R: Extended messages enabled

'q' hit, calling ANT_CloseChannel

C: Channel Closed
C: Unassigning Channel...
C: 01 07 00 00 00 00 00 00

R: Channel unassigned
R: Press enter to exit

Disconnecting module...
Demo has completed successfully!

EDIT: Network Key under license removed from public post. Refer to
ANT+ Network Keys Page.      
RankRankRankRank

Total Posts: 156

Joined 2013-01-07

PM

Hi Bob,

It seems that you are using an invalid network key {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} and a public network key {EDIT: Public Network Key} while attempting to connect to an ANT+ device. For ANT+ devices, it is required to use the ANT+ network key.

The ANT+ Network Key can be found on the Network Keys page:
http://www.thisisant.com/developer/ant-plus/ant-plus-basics/network-keys

For information on channel configuration settings for your device, please view the Bicycle Speed and Cadence Device Profile document in the Documents Download Page.
http://www.thisisant.com/developer/resources/downloads/

In the Bicycle Speed and Cadence Device Profile document, please refer to Section 4.1.1: Receiver Channel Configuration (p.12), to ensure that all configuration parameters are set correctly, meeting the requirements for a compatible receiver device.

Configuration Parameters to Consider:
-Channel Type
-Network Key!!
-RF Channel
-Transmission Type
-Device Type
-Device Number
-Message Period



Good Luck,
Usama
     
Rank

Total Posts: 1

Joined 2013-01-30

PM

Usama,

I've been having similar problems, but after following your post I've managed to change everything except message period. I can't seem to find that one in the demo code (I must be blind). I'm now connecting to my device, but getting Rx Fail errors, which must be related to the message period. Any tips on how to change the message period?

Thanks!      
Rank

Total Posts: 16

Joined 2012-11-28

PM


I use this:

ANT_SetChannelPeriod(chan_num, period);

     
Rank

Total Posts: 2

Joined 0

PM

Nevermind.      
Rank

Total Posts: 1

Joined 2013-02-25

PM

If you want to change the channel period you can just add 2 lines of code. The first line in the beginning of the code in the definition part, and the second line immediately after below line :

#define USER_ANTPERIOD (1024) // this is the first line, 1024 for example
.
.
.
bStatus = pclMessageObject->SetChannelRFFrequency(USER_ANTCHANNEL, USER_RADIOFREQ, MESSAGE_TIMEOUT); // find this line in demo.cpp and add below line after that

bStatus = pclMessageObject->SetChannelPeriod(USER_ANTCHANNEL, USER_ANTPERIOD, MESSAGE_TIMEOUT); // this is the second line that you need to add      
Rank

Total Posts: 4

Joined 2014-01-27

PM

usamak - 10 January 2013 02:57 PM
Hi Bob,

It seems that you are using an invalid network key {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} and a public network key {{Edit: Public Network Key (refer to Link below)} while attempting to connect to an ANT+ device. For ANT+ devices, it is required to use the ANT+ network key.

The ANT+ Network Key can be found on the Network Keys page:
http://www.thisisant.com/developer/ant-plus/ant-plus-basics/network-keys



Hi,usama,
I also met similar issue when running DEMO_DLL,but I tested it just with two ANT USBStick2(Version AP2USB1.05),what network key should I set ? Souce code of DEMO_DLL is {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

BTW,I plugged the sticks on different PCs. One as Master and the other as Slave, Master works fine,after opening channel,TX msg. But Slave can not search the Master,what should I do?

Does it support work on two PCs?

Thanks in advace. Looking forward your reply.

EDIT: Network Key under license removed from public post. Refer to
ANT+ Network Keys for the ANT network keys.      
RankRankRankRank

Total Posts: 156

Joined 2013-01-07

PM

The application should work on two PCs. I don't see why that should be a problem.

Please confirm that the channel parameters for your master and slave meet the requirements for pairing as described in the ANT Pairing Application note: (http://www.thisisant.com/resources/an02-device-pairing/).

I would recommend using the public network key available on the ANT Network Keys
page: (http://www.thisisant.com/developer/ant-plus/ant-plus-basics/network-keys) for development. If you would like to be able to connect to ANT+ devices, you should use the ANT+ Network Key.

     
Rank

Total Posts: 4

Joined 2014-01-27

PM

usamak - 10 February 2014 11:48 AM
The application should work on two PCs. I don't see why that should be a problem.

Please confirm that the channel parameters for your master and slave meet the requirements for pairing as described in the ANT Pairing Application note: (http://www.thisisant.com/resources/an02-device-pairing/).

I would recommend using the public network key available on the ANT Network Keys
page: (http://www.thisisant.com/developer/ant-plus/ant-plus-basics/network-keys) for development. If you would like to be able to connect to ANT+ devices, you should use the ANT+ Network Key.



Hi,usamak,thanks for your reply.I changed one of the PCs to the one which without any security software,Now it works fine. Maybe it was casued by some security software. But I don't know why.