Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
michael-myers opened this issue Jan 1, 2024 · 0 comments · May be fixed by #4
Open

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

michael-myers opened this issue Jan 1, 2024 · 0 comments · May be fixed by #4

Comments

@michael-myers
Copy link

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
@michael-myers michael-myers linked a pull request Jan 1, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant