All,
I am setting up 2 sensors and 1 hub to talk on ANT protocol. Both sensors acts as master and broadcast data continuously, while hub acts as slave and collects data. Each sensor was tested independently with hub and it worked fine. Problem comes when I collect data from both sensor together. As I am new to ANT protocol usage, I believe there is something wrong in setup of freq, period, devno, devtype, etc.
Below is some code for my slave. When Device1_config ONLY is called, I get proper broadcast data. If Device2_config ONLY is called, I get proper broadcast data. When both Dev1 and Dev2 config are called, I get broadcast data of device2 only.
uint8_t chtype = 0;
uint16_t devno = 0x0000;
uint8_t devtype = 0x00;
uint8_t manid = 0x01;
uint8_t srchto = 50;
void Device1_config (void)
{
ANT_ResetSystem();
delay(20);
ANT_RequestMessage(CHAN0, MESG_CAPABILITIES_ID);
delay(20);
ANT_AssignChannel(CHAN0, chtype, NET0);
delay(20);
ANT_SetChannelId(CHAN0, devno, devtype, manid);
delay(20);
ANT_SetNetworkKey(NET0, DEVICE_KEY);
delay(20);
ANT_SetChannelSearchTimeout(CHAN0,srchto);
delay(20);
ANT_SetChannelPeriod(CHAN0, gperiod);
delay(20);
ANT_SetChannelRFFreq(CHAN0, gfreq);
delay(20);
ANT_OpenChannel(CHAN0);
delay(20);
Serial.println(“Device1 Config Done”);
}
void Device2_config (void)
{
ANT_ResetSystem();
delay(20);
ANT_AssignChannel(CHAN1, chtype, NET0);
delay(20);
ANT_SetChannelId(CHAN1, devno, devtype, 0x00);
delay(20);
ANT_OpenChannel(CHAN1);
delay(20);
Serial.println(“Device2 Config Done”);
}
Do channels need to be on different frequency, period, net, etc. to work properly?