Cant comunicate Arduino UNO => ANT+ AP2

Hello!

Im having some troubles with my arduino uno and ant+ ap2 chip. I cant get it to work :frowning:

Here is the wiring (AP2 pin => arduino)

1 => GND
2 -
3 => 3.3

4 => GND
5 -
6 => GND
7 => 3.3
8 -
9 => GND
10 => GND

11 => RX
12 => TX (with a voltage-devider made of two resistors)
13 => GND
14 => GND
15 => GND
16 => GND
17 -

I assume this set is up for 4800 async.

The code:
// test för att se om chippet fungerar, skickar bara ett meddelande och ser om vi får svar

#include <SoftwareSerial.h>

#define UCHAR unsigned char
#define MESG_TX_SYNC ((UCHAR)0xA4)
#define MESG_SYSTEM_RESET_ID ((UCHAR)0x4A)
#define MESG_CHANNEL_ID_ID ((UCHAR)0x51)

// set up serial communication pins (RX/TX)
SoftwareSerial Serial1(0, 1);

// setup serial communcation and send reset and SetChID message
void setup()
{
Serial1.begin(4800);
Serial.begin(115200);
delay(5000);
Serial1.flush();
reset();
delay(1000);
SetChID();
delay(1000);
}

// listen for message
void loop(){
int sbuflength = Serial1.available();
while(sbuflength > 0) {
Serial.print("got message: ");
}
}

// reset message
void reset (){
uint8_t buf[5];
buf[0] = MESG_TX_SYNC; // SYNC Byte
buf[1] = 0x01; // LENGTH Byte
buf[2] = MESG_SYSTEM_RESET_ID; // ID Byte
buf[3] = 0x00;
buf[4] = checkSum(buf,4);
ANTsend(buf,5);
}

// set channel id
void SetChID()
{
uint8_t buf[9];
buf[0] = MESG_TX_SYNC; // SYNC Byte
buf[1] = 0x05; // LENGTH Byte
buf[2] = MESG_CHANNEL_ID_ID; // Assign Channel ID 0x51
buf[3] = 0x00; // channel number
buf[4] = 0x05; // Device number
buf[5] = 0x00; // Device number
buf[6] = 0x0B; //Device type ID
buf[7] = 0x00; //Transmission type
buf[8] = checkSum(buf, 8);
ANTsend(buf,9);
}

// send message to chip
void ANTsend(uint8_t buf, int length){

Serial.print("Sent TX: ");

for(int i = 0 ; i <= length ; i++){
Serial.print(buf*, HEX);*

  • Serial.print(" “);*
    _ Serial1.write(buf*);_
    _
    }_
    _
    Serial.println(”");_
    _
    }_
    _
    // create checksum for message*_
    UCHAR checkSum(UCHAR *data, int length){
    * int i;*
    * UCHAR chksum = data[0];*
    * for (i = 1; i < length; i++){*
    _ chksum ^= data*;
    }
    return chksum;
    }*
    The qustions:
    a) Can I assume the code above should work as excepcted? Sending a reset, setChanId message and wait for a response from the chip?
    *b) If I measure with a multimeter on RX/TX they are high (5v) all the time, is this correct? *
    c) Since RX are +5v which are connected to the chip on TX (max 3.6v) have a broken the chip now? :frowning:
    Thanks in advance._

"ant +ap2 chip"??? How about posting links to the datasheets so we know what you mean?

http://www.thisisant.com/pages/developer-zone/product-data-sheets