Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

callback function with strange passed value

RankRankRankRank

Total Posts: 523

Joined 2012-11-15

PM

Goodmorning,
i'm creating a software simulating a sensor in master mode.
I'm working with the channel 0 and a pre-set network key.
The problem concern the channel event that pass as arguments
values different to 0, as possible to see in the following log.
Can someone help me with such kind of explanations or solutions?
( the value can variate) :dry:
Kindly regards.

Usb connected!
->ANT_AssignResponseFunction assigned.
->ANT_AssignChannelEventFunction assigned.
Cmd - Reset
Cmd - SetNetworkKey(0; [B9] [A5] [21] [FB] [BD] [72] [C3] [45])
Ack - SetNetworkKey
Cmd - AssignChannel(0; 16, 0)
Ack - AssignChannel
Cmd - SetChannelId(0; 12345; 121; 1)
Ack - SetChannelID
Cmd - SetChannelPeriod(0; 16172)
Cmd - SetChannelSearchTimeout(0: 4)
Ack - SetChannelPeriod
Ack - SetChannelSearchTimeout
Cmd - SetChannelRFFreq(0; 57)
Ack - SetRFFreq
Cmd - OpenChannel
Ack - Open
->Channel:152 ucEvent: 0
->Channel:152 ucEvent: 0
->Channel:152 ucEvent: 0
->Channel:152 ucEvent: 0
->Channel:152 ucEvent: 0
->Channel:152 ucEvent: 0
->Channel:152 ucEvent: 0
->Channel:152 ucEvent: 0
->Channel:152 ucEvent: 0
Usb disconnected!      
RankRankRank

Total Posts: 95

Joined 2010-05-03

PM

Hi,

Looking at the command 'SetChannelId' and the device type value, it looks like you are trying to simulate a combined bike speed and cadence sensor.

I highly encourage using our ANT+ simulator tool. This simulator tool implements ANT+ device profiles; including 'Bike Speed and Cadence Sensor'. Therefore, you can use this tool to help in the development of your custom simulator. Also, there is a source code available for the ANT+ simulator tool in the ANT website. Please refer to this code as it is a good example of how to properly set and configure an ANT channel as well as how to correctly handle channel responses and events.

As you are building a custom simulator, it is appreciated to not use the ANT+ network key in your simulator; please use your own network key.      
RankRankRankRank

Total Posts: 523

Joined 2012-11-15

PM

Please can you explain me the reasons of this arguments values regarding the call back procedure (CHANNEL_EVENT_FUNC)?

->Channel:152 ucEvent: 0

channel should be a value between 0 and 8, in this case should e be 0, because i'm using only channell 0.

thks.      
RankRankRankRank

Total Posts: 523

Joined 2012-11-15

PM

Goodmorning,
someone can explain me the reason because @CHANNEL_EVENT_FUNC return values gives me channel 152 and the other parameter 0.

Channel parametere should be between 0 and 7 ,isn't it?
Can someone help me?

Kindly,
Marco      
RankRankRank

Total Posts: 95

Joined 2010-05-03

PM

It is hard to tell why you are getting these strange response values. If you could send the device log, it will be a good starting point for finding out the reason for this behavior.      
RankRankRankRank

Total Posts: 523

Joined 2012-11-15

PM

Device0.txt, many tanks!


2.0000 Tx - [A4][01][4A][00][EF][00][00]
3.0000 Tx - [A4][09][46][00][00][00][00][00][00][00][00][00][EB][00][00]
3.0000 Rx - [A4][03][40][00][46][00][A1]
3.0000 Tx - [A4][03][42][00][10][00][F5][00][00]
3.0000 Rx - [A4][03][40][00][42][00][A5]
3.0000 Tx - [A4][05][51][00][39][30][79][01][81][00][00]
3.0000 Rx - [A4][03][40][00][51][00][B6]
3.0000 Tx - [A4][03][43][00][2C][3F][F7][00][00]
3.0000 Rx - [A4][03][40][00][43][00][A4]
3.0000 Tx - [A4][02][44][00][04][E6][00][00]
3.0000 Rx - [A4][03][40][00][44][00][A3]
3.0000 Tx - [A4][02][45][00][39][DA][00][00]
3.0000 Rx - [A4][03][40][00][45][00][A2]
3.0000 Tx - [A4][01][4B][00][EE][00][00]
3.0000 Rx - [A4][03][40][00][4B][00][AC]
3.0000 Rx - [A4][03][40][00][01][03][E5]
4.0000 Rx - [A4][03][40][00][01][03][E5]
4.0000 Rx - [A4][03][40][00][01][03][E5]
5.0000 Rx - [A4][03][40][00][01][03][E5]
5.0000 Rx - [A4][03][40][00][01][03][E5]
6.0000 Rx - [A4][03][40][00][01][03][E5]
6.0000 Rx - [A4][03][40][00][01][03][E5]
7.0000 Rx - [A4][03][40][00][01][03][E5]
7.0000 Rx - [A4][03][40][00][01][03][E5]
8.0000 Rx - [A4][03][40][00][01][03][E5]
8.0000 Rx - [A4][03][40][00][01][03][E5]
9.0000 Rx - [A4][03][40][00][01][03][E5]
9.0000 Tx - [A4][01][4A][00][EF][00][00]      
RankRankRank

Total Posts: 95

Joined 2010-05-03

PM

Hi Marco,

Looking into the "Device0.txt" log you have posted, all message commands used for channel configuration are correct. Also, the responses to those message commands indicate that there are no errors. Therefore, configuring and opening the channel is correct.

After opening the channel, the log shows channel events; "EVENT_TX"([A4][03][40][00][01][03][E5]). These events indicate that messages are being transmitted at the specified channel period. Unless you specify the content of the messages, the messages' content is garbage.
You can specify the content of messages by using for example the message command 0x4E "ANT_SendBroadcastData" (more details is available in the ANT Message Protocol and Usage" document).

Moreover, I did not find "Channel:152 ucEvent: 0" values you have mentioned earlier in the posted device log. If these values are in the device log, please send that part to explore the reasons for such values. Otherwise, the channel responses correspond to the correct channel; that is channel 0.      
Avatar
Rank

Total Posts: 8

Joined 2009-02-05

PM

Goodmorning,
the "Channel:152 ucEvent: 0" parameter are passed by the call back function. The function had been set with ANT_AssignChannelEventFunction(0,@CHANNEL_EVENT_FUNC,pucRxBuffer);
so i don't think this appears in the device0.log file.isn't it?

My debug log to make the connection to start the transmittion is
(as Example):
Usb connected!
->ANT_AssignResponseFunction assigned.
->ANT_AssignChannelEventFunction assigned.
Cmd - Reset
Cmd - SetNetworkKey(0; [00] [00] [00] [00] [00] [00] [00] [00])
Ack - SetNetworkKey
Cmd - AssignChannel(0; 16, 0)
Ack - AssignChannel
Cmd - SetChannelId(0; 12345; 121; 1)
Ack - SetChannelID
Cmd - SetChannelPeriod(0; 16172)
Cmd - SetChannelSearchTimeout(0: 4)
Ack - SetChannelPeriod
Ack - SetChannelSearchTimeout
Cmd - SetChannelRFFreq(0; 57)
Ack - SetRFFreq
Cmd - OpenChannel
Ack - Open
->Channel:152 ucEvent: 0
->Channel:152 ucEvent: 0
->Channel:152 ucEvent: 0
->Channel:152 ucEvent: 0
->Channel:152 ucEvent: 0
->Channel:152 ucEvent: 0
->Channel:152 ucEvent: 0
->Channel:152 ucEvent: 0
Usb disconnected!


Kindly      
RankRankRank

Total Posts: 95

Joined 2010-05-03

PM

Well, the device log shows that opening and configuring the ANT channel is correct.

Therefore, "Channel:152 ucEvent: 0" responses might be as a result of not reading the buffer correctly or not setting the callback function correctly.

Please have a look at "DEMO_DLL" project in ANT library windows package; available in the ANT website. The "DEMO_DLL" can be used as a reference on how to correctly set the callback functions as well as how to correctly read the buffer.