Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Channel problems

Avatar
Rank

Total Posts: 21

Joined 0

PM

I am attempting to pair with a Sonyericcson Xperia Xmini pro with an Ant+ Bike display. I have had success with my custom hardware tx-rx with eachother on channel 0l; however I am having difficulty getting any other channel to work. Below is the code I am using.

ANY HELP WOULD BE APPRECIATED

Cy Drollinger

Main
Delayms(1000);
InitializeSystem();
Delayms(1000);
ANT_ResetSystem();
Delayms(1000);
ANT_AssignChannel();
Delayms(1000);
ANT_SetChannelId();
Delayms(1000);
ANT_SetChannelPeriod();
Delayms(1000);
ANT_OpenChannel();
Delayms(1000);
ANT_SendBroadcastData();

void SEND_ANT(int *ANT_data)
{
int i, Length = ANT_data[1];

put_ANT(ANT_data[0]); //SYNC
put_ANT(ANT_data[1]); //LENGTH
put_ANT(ANT_data[2]); //MESSAGE ID

for(i = 0; i < Length + 1; i++)
{
put_ANT(ANT_data[i+3]); //DATA
}
while(!ant_RTS);
while(ant_RTS);
}

void ANT_ResetSystem(void)
{ int buffer[5];

buffer[0] = 0xA4; //SYNC
buffer[1] = 0x01; //LENGTH
buffer[2] = 0x4A; //MESSAGE ID Reset
buffer[3] = 0x00; //DATA1
buffer[4] = buffer[0]^buffer[1]^buffer[2]^buffer[3];

SEND_ANT(buffer);
}


void ANT_AssignChannel(void)
{int buffer[7];
buffer[0] = 0xA4; //SYNC
buffer[1] = 0x03; //LENGTH
buffer[2] = 0x42; //MESSAGE
buffer[3] = 0x01; //DATA1 Channel Number
buffer[4] = 0x10; //DATA2 Tx channel
buffer[5] = 0x00; //DATA3 Network Number (0 for public)
buffer[6] = buffer[0]^buffer[1]^buffer[2]^buffer[3]^buffer[4]^buffer[5];
SEND_ANT(buffer);
}

void ANT_SetChannelPeriod(void)
{int buffer[6];
buffer[0] = 0xA4; //SYNC
buffer[1] = 0x02; //LENGTH
buffer[2] = 0x43; //MESSAGE ID
buffer[3] = 0x1F; //DATA1 Channel Period (default 8192 bike power = 8182)
buffer[4] = 0xF6; //DATA2 Tx channel
buffer[5] = buffer[0]^buffer[1]^buffer[2]^buffer[3]^buffer[4];
SEND_ANT(buffer);
}

void ANT_SetChannelId(void)
{int buffer[9];
buffer[0] =0xA4; //SYNC
buffer[1] =0x05; //LENGTH
buffer[2] =0x51; //MESSAGE ID
buffer[3] =0x01; //DATA1 Channel Number (57 for bike power)
buffer[4] =0x11; //DATA2 Device Number
buffer[5] =0x11; //DATA3 Device Number
buffer[6] =0x00; //DATA4 Device Type
buffer[7] =0x00; //DATA5 Device Transmission
buffer[8] = buffer[0]^buffer[1]^buffer[2]^buffer[3]^buffer[4]^buffer[5]^buffer[6]^buffer[7];
SEND_ANT(buffer);
}

void ANT_OpenChannel(void)
{int buffer[5];
buffer[0] =0xA4; //SYNC
buffer[1] =0x01; //LENGTH
buffer[2] =0x4B; //MESSAGE ID Open Channel
buffer[3] =0x01; //DATA1 Channel Number
buffer[4] = buffer[0]^buffer[1]^buffer[2]^buffer[3];
SEND_ANT(buffer);

}

void ANT_SendBroadcastData(void)
{int buffer[13];
buffer[0] =0xA4; //SYNC
buffer[1] =0x09; //LENGTH
buffer[2] =0x4E; //MESSAGE ID Send data
buffer[3] =0x01; //channel #
buffer[4] =0x61; //DATA0
buffer[5] =0x62; //DATA1
buffer[6] =0x63; //DATA2
buffer[7] =0x64; //DATA3
buffer[8] =0x65; //DATA4
buffer[9] =0x66; //DATA5
buffer[10] =0x67; //DATA6
buffer[11] =0x68; //DATA7
buffer[12] = buffer[0]^buffer[1]^buffer[2]^buffer[3]^buffer[4]^buffer[5]^buffer[6]^buffer[7]^buffer[8]^buffer[9]^buffer[10]^buffer[11];
SEND_ANT(buffer);
}      
RankRankRankRank

Total Posts: 523

Joined 2012-11-15

PM

The nRF24AP2 by Nordic Semiconductor has a chip with only one channel and therefore only Channel # 0 is available. There is an 8 channel chip but not on ER's devices.

Cy Drollinger      
Avatar
Rank

Total Posts: 21

Joined 0

PM

The nRF24AP chip utilized at ER is a one channel device and therefore according to the Ant Message Protocol AssignChannel(0x42) the channel is the maximum number of channels -1 so 0 is the only channel available.

Sincerely

Cy Drollinger      
Avatar
RankRank

Total Posts: 39

Joined 2011-06-29

PM

The code itself looks fine (I assume it is for the bike display since it includes the sync byte and a checksum), and if you say they successfully communicate on channel 0 chances are the code is not the issue.
My first question is whether your bike display module supports more than one channel. I know that the X10 mini supports up to 8 channels at once, but I am not sure which bike display you are using.
My second question is if you are trying to use both channels at the same time or just a single channel #1. A single channel on an ID greater than 0 shouldn't cause any problems unless the ANT chip is unable to process the request.

-Maurits