Skip to content

ANT+ adapter responds to Writing with 0xAE (Serial Error) and 0x02 (invalid checksum) #3

@michael-myers

Description

@michael-myers

Hi, thanks for publishing this code to work with ANT+. I'm trying it out with some ANT+ equipment I have. The adapter is a Dynastream Innovations Inc. ANT USB-m.

With go-ant, though, every time it writes a message, my ANT+ adapter responds with a Serial Error Message and the code 0x2 for 'bad checksum'. It looks like the Encode() function offsets twice when finding the start of the content data bytes to XOR. I'll open a Pull Request with the fix.

Output I was getting:

2023/12/29 16:31:52 Starting Device
2023/12/29 16:31:52 Opening USB device
2023/12/29 16:31:52 USB Device opened
2023/12/29 16:31:52 Loop Started
2023/12/29 16:31:52 Writing:  [0xA4, 0x01, 0x4A, 0x00, 0xEF]
2023/12/29 16:31:52 Read: AntMessage (0x6F) [0x00]
2023/12/29 16:31:53 Writing:  [0xA4, 0x09, 0x46, 0x00, 0xB9, 0xA5, 0x21, 0xFB, 0xBD, 0x72, 0xC3, 0x45, 0xDD]
2023/12/29 16:31:53 Writing:  [0xA4, 0x03, 0x42, 0x00, 0x00, 0x00, 0xE5]  # Assign Channel Message
2023/12/29 16:31:53 Read: AntMessage (0xAE) [0x02, 0xA4, 0x09, 0x46, 0x00, 0xB9, 0xA5, 0x21, 0xFB, 0xBD, 0x72, 0xC3, 0x45, 0xDD]  # this is Serial Error Message, sent in response to a poorly formed USB data. The first byte of the data is “Error number 2 – the checksum of the ANT message was incorrect”
2023/12/29 16:31:53 Writing:  [0xA4, 0x05, 0x51, 0x00, 0x00, 0x00, 0x78, 0x00, 0x88]  # Set Channel ID Message
2023/12/29 16:31:53 Writing:  [0xA4, 0x02, 0x45, 0x00, 0x39, 0xE3]  # Set Channel RF Frequency Message
2023/12/29 16:31:53 Read: AntMessage (0x40) [0x00, 0x42, 0x00]
2023/12/29 16:31:53 Read: AntMessage (0x40) [0x00, 0x51, 0x00]
2023/12/29 16:31:53 Writing:  [0xA4, 0x03, 0x43, 0x00, 0x86, 0x1F, 0xFB]  # Set Channel Messaging Period Message
2023/12/29 16:31:53 Writing:  [0xA4, 0x02, 0x5B, 0x00, 0x01, 0xFD]
2023/12/29 16:31:53 Read: AntMessage (0xAE) [0x02, 0xA4, 0x02, 0x45, 0x00, 0x39, 0xE3] # again this is Serial Error Message, bad checksum
2023/12/29 16:31:53 Loop stopped!
2023/12/29 16:31:53 Closing USB device
2023/12/29 16:31:54 USB Device closed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions