Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

SPI Byte Synchronous Messaging Issues

RankRankRankRank

Total Posts: 523

Joined 2012-11-15

PM

I’m trying to communicate with an ANT+ heart-rate monitor and am having an issue with the SetNetworkKey command (0x46); this command never returns an event message.

I’m using the AP2 module using the synchronous serial byte flow control. After receiving the 0xA5 I send the following data: 0x09,0x46,0x00,0xB9,0xA5,0x21,0xFB,0xBD,0x72,0xC3,0x45,0x65.

This command does not send me a ‘command success’ notification event message (0x40) – it sends nothing. From what I’ve read I should receive the event message (0x40) string: 0xA4, 0x03, 0x40, 0x00, 0x46, 0x00, 0xA0.

If is send a different key (i.e. 8 bytes of 0x20) I receive an event message 0x40 from ANT AP2, success; (this is what I expect to always happen). However, if is change one of the values in the key (i.e byte 7 from 0x20 to 0xC3) then I receive nothing.

The checksum is being calculated properly; all other commands are communicating properly in byte synchronous mode.

So it appears this command, SetNetworkKey, selectively returns the status event message 0x40.

It would be a small effort for me to check if the SetNetworkKey returns status via RS232; I’m currently set up with Byte Synchronous SPI communication.

I’m wondering if this could be an issue with Byte Synchronous firmware of the AP2 module?

My question is: does the SetNetworkKey command (0x46) supposed to respond with a notification event message (0x40)after sending the ANT+ managed Network Key?

Thank you.      
Rank

Total Posts: 3

Joined 0

PM

I’m trying to connect to an ANT+ heart-rate monitor and am having an issue with the SetNetworkKey command (0x46); this command does not return an event message when I enter the ANT+ key.

I’m communicating to the AP2 using synchronous byte flow protocol.

This command does not send me a ‘command success’ notification event message (0x40) – it sends nothing. From what I’ve read I should receive the event message (0x40) string: 0xA4, 0x03, 0x40, 0x00, 0x46, 0x00, 0xA0.

My question is: does the SetNetworkKey command (0x46) supposed to respond with a notification event message (0x40)when I send the ANT+ key?

If is send a different key (i.e. 8 bytes of 0x20) I receive an event message 0x40 from ANT, success; (this is what I expect to always happen). However, if is change one of the values in the key (i.e byte 7 from 0x20 to 0xC3) then I receive nothing.

The checksum is being calculated properly; all other commands are communicating properly in byte synchronous mode.

So it appears this command, SetNetworkKey, selectively returns the status event message 0x40.

I’m wondering if this could be an issue with Byte Synchronous firmware of the AP2 module?      
Rank

Total Posts: 3

Joined 0

PM

For a sanity check I sent the ANT+ Network Key command via RS232 (which requires the A4) to the AP2; it responds correctly with a status event message.



RS232 ANT+ Key Command: 0xA4,0x09,0x46,0x00,0xB9,0xA5,0x21,0xFB,0xBD,0x72,0xC3,0x45,0x64



Response: 0xA4,0x03,0x40,0x00,0x46,0x00,0xA1



In synchronous serial mode I wait for the AP2 to send me the 0xA5 and then send the command data: 0x09,0x46,0x00,0xB9,0xA5,0x21,0xFB,0xBD,0x72,0xC3,0x45,0x65; this does not work.



If I send a bogus key in synchronous serial mode (i.e. all 0x20) with the proper checksum (using the 0xA5 in the checksum calculation) the Network key command responds correctly with a status event message.



The difference is the checksum byte. Maybe the AP2 firmware is incorrectly including the checksum byte in the ANT+ key; this checksum byte is different in Synchronous Serial communication because the start byte is a 0xA5, not 0xA4? The command fails if I force the checksum byte to a 0x64 and the key fails because the checksum byte is 0x65?      
RankRank

Total Posts: 47

Joined 2010-07-08

PM

To answer your first question, yes the SetNetworkKey command 0x46 should always respond with a 0x40, even with the ANT+ key. I also do not think that this is an issue with the AP2 module - the network key functionality has been well tested / proven over many implementations.

It is more likely that your issue is related to how you are handling your serial messaging.

Note that the ANT+ key contains an "A5" which is one of the valid values for the sync byte, and this might possibly be "confusing" your code. This might be why a different network key without an A5 returns a response. It would be easy to test this by putting the A5 into your test network key.

If you are still stuck, a logic analyzer can be a good way to troubleshoot by comparing what you think you are sending with what you are actually sending.