Hello everyone!
I’ m writing because I have a problem with the ANT protocol.
I bought from Sparkfun some sensors, 2 Arduino boards and 2 transceivers ANT NRF24ap1 to create a WSN.
I connected the NRF24ap1 on the hardware serial port of the Arduino (pin 0 and 1), and I fed 3.3Volt.
Now, are many days that I try to establish communication, but the transceiver does not reply to my setup commands.
The nrf24ap1 should respond to nearly all setup commands, but I do not read anything with “serial.read”.
Can you tell me where is the error?
The manual of ANT, writes all commands in hexadecimal…
What format do I send them from Arduino to the transceiver? (BYTE…? I tried everything, but the BYTE format seems to be the “classic” method to send 8 bits)
I enclose a piece of my Arduino code:
int rts = 2;
int reply = 0;
void setup()
{
Serial.begin(4800);
pinMode(rts, INPUT); // RTS port
delay(1000);
rts=digitalRead(2);
//reset
if ( rts==LOW )
{
Serial.print(0xa4,BYTE); // SYNC Byte
delay(200);
Serial.print(0x01,BYTE); // LENGTH Byte
delay(200);
Serial.print(0x4a,BYTE); // Message ID Byte ( ANT_ResetSystem() )
delay(200);
Serial.print(0x00,BYTE); // Data Byte N (N=LENGTH)
delay(200);
Serial.print(0xef,BYTE); // Checksum
}
delay(1000);
rts=digitalRead(2);
//assignch()
if ( rts==LOW ) //controllo il PIN rts
{
Serial.print(0xa4,BYTE); // SYNC Byte
delay(200);
Serial.print(0x03,BYTE); // LENGTH Byte
delay(200);
Serial.print(0x42,BYTE); // Message ID Byte ( ANT_AssignChannel() )
delay(200);
Serial.print(0x00,BYTE); // Channel no. 0
delay(200);
Serial.print(0x10,BYTE); // Channel type (TX)
delay(200);
Serial.print(0x00,BYTE); // Network no. 0
delay(200);
Serial.print(0xf5,BYTE); // Checksum
}
delay(1000);
if (Serial.available() > 0) {
reply = Serial.read();
Serial.println(reply, DEC);
}else { Serial.println ("no answer");}
etc…
I don’t get response from the command “assignchannel”, even from other following commands…