Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

You are here: Forum Home → ANT+ Forums → ANT+ Heart Rate Monitor → Thread

   

DEMO LIB configuration

Rank

Total Posts: 13

Joined 2014-07-09

PM

Hello;

I´m having problems making DEMO_LIB working for a HR device

When I use AntwareII whith the folowing configuration everything works fine;

Network key xx xx xx xx on network 0
Slave
Device # 0
Device Type 120
Trans Type 1
Channel Period 8070
Radio Frecuency 75

when I try to copy this configuration to Demo_Lib on demo.ccp

here...

#define USER_BAUDRATE (50000) // For AT3/AP2, use 57600
#define USER_RADIOFREQ (57)

#define USER_ANTCHANNEL (0)
#define USER_DEVICENUM (0)
#define USER_DEVICETYPE (120)
#define USER_TRANSTYPE (1)

#define USER_NETWORK_KEY {0xxx, 0xxx, 0xxx, 0xxx, 0xxx, 0xxx, 0xxx, 0xxx,}
#define USER_NETWORK_NUM (0) // The network key is assigned to this network number

#define MESSAGE_TIMEOUT (1000)

I get....

Go to search
Chan ID (43982/120/1) - Rx (0): -----[84], [00],[27],[a7],[0f],[ab],[b9],[54]
Rx Fail
Rx Fail
Rx Fail
Rx Fail
Rx Fail
Rx Fail
Rx Fail
Go To Search
And again the same.....

I Think the error is because I did not set up the channel Period but I dont see where is the variable to configure it.

Help please



     
Avatar
RankRankRankRank

Total Posts: 745

Joined 2012-09-14

PM

Hi,

Do a search for "pclMessageObject->SetChannelPeriod", you can set the channel period using:
SetChannelPeriod(USER_ANTCHANNEL, 8070, MESSAGE_TIMEOUT);      
Rank

Total Posts: 13

Joined 2014-07-09

PM

Sorry
I Cant Find "pclMessageObject->SetChannelPeriod" on DEMO_LIB (demo.h or demo.ccp)      
Avatar
RankRankRankRank

Total Posts: 745

Joined 2012-09-14

PM

Hi,

My apologies I was referencing an incorrect project. You will have to add the setting of channel period to the project yourself. You may replace a section of the setup sequence to also set the channel period, for example:

case MESG_CHANNEL_RADIO_FREQ_ID:
        
{
            
if (stMessage.aucData[2] != RESPONSE_NO_ERROR)
            
{
                printf
("Error configuring Radio Frequency: Code 0%d\n"stMessage.aucData[2]);
                break;
            
}
            printf
("Radio Frequency set\n");
            
printf("Setting Channel Period...\n");
            
bStatus pclMessageObject->SetChannelPeriod(USER_ANTCHANNEL8070MESSAGE_TIMEOUT);
            break;
        
}

        
case MESG_CHANNEL_MESG_PERIOD_ID:
        
{
            
if (stMessage.aucData[2] != RESPONSE_NO_ERROR)
            
{
                printf
("Error configuring Channel Period: Code 0%d\n"stMessage.aucData[2]);
                break;
            
}
            printf
("Channel Period set\n");
            
printf("Opening channel...\n");
            
bBroadcasting TRUE;
            
bStatus pclMessageObject->OpenChannel(USER_ANTCHANNELMESSAGE_TIMEOUT);
            break;
        


This snippet places setting the channel period after setting the RF channel and before opening the channel which you can find on line 571 of demo.cpp.      
Rank

Total Posts: 13

Joined 2014-07-09

PM

IT WORKS!!!!
THANKS
     
Avatar
RankRankRankRank

Total Posts: 745

Joined 2012-09-14

PM

Your Welcome smile