Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

ANT Burst Message

Rank

Total Posts: 3

Joined 2013-03-01

PM

Hi,

I am using the nrF51422 SOC and I have been trying to send burst data from a PCA1003 EK to a USB dongle.

I have attached a file with the code I am using.

I am having problems when trying to send data which is larger than > 256 bytes. If I use a BURST_START for a buffer of 128 bytes and then a BURST_END with another 128 bytes, the data is sent without problems.
However if I increase the buffer size to 256, the transfer will fail upon sending the end packet.

Has anyone ever encountered this sort of problem?


What I am trying to do is to test the maximum data rate that I can reach with this SOC. The ANT protocol states that I should be able to burst up to 20kbps or 60kbps for advanced bursts. If you have any code examples that would help me a lot.

Thank you!      

File Attachments

Rank

Total Posts: 4

Joined 2013-01-07

PM

Hello,


Glad to hear you are developing with the nrf51422! grin

I'm unable to download your code due to it being a '.c' file. Would you be able to re-upload it as a '.txt' file so I can take a look?


Cheers,
Chris      
Rank

Total Posts: 3

Joined 2013-03-01

PM

Hi,

Sure, I have re-uploaded the file.


Adrian      

File Attachments

Rank

Total Posts: 4

Joined 2013-01-07

PM

Hello,

I checked the provided code and found one minor issue. The calls to "ant_burst_handler_request()" specify a block size of 255 bytes rather than 256. As specified the comments for this function (found in "ant_interface.h"), the message block size (usSize) must be a value divisible by 8. Try changing the size of "big_buff" to 256 and for each call to "ant_burst_handler_request()" change usSize from 255 to 256.

I made these changes on my end and I was able to successfully send burst data messages in two 256 byte blocks. If these doesn't resolve your issues, what are the return values after each call to "ant_burst_handler_request()"?

Cheers,
Chris      
Rank

Total Posts: 3

Joined 2013-03-01

PM

Hi,

Thank you for your help!

Yes you are right, that was one of the problems. The other one was that if the channel is not opened (board connected to the dongle), when you try to transmit data it will generate an error message and a TX FAIL event.

The program always locked itself in that APP_ERROR_CHECK routine.

My solution was simple but not a very robust one. I am always sending an acknowledged packet and if there is a TX_FAIL_EVENT then the program loops that packet until a connection is established. This does the trick for now.

Do you know of another way to check if the channel is opened (connected) ?


Best Regards,

Adrian      
Rank

Total Posts: 4

Joined 2013-01-07

PM

Hello,

Glad to hear you have the issues resolved.

There are several different solutions to determine whether is safe to send a Burst message from one device to another. However, it depends on how you have initialized the channel on the nrf51422. Is the nrf51422 being used as a master or a slave device?

If being used as a master, the nrf51422 will continuously transmit broadcast messages at its configured message period. To determine whether a slave is tracking (or listening) to the master device, you could implement the project as you proposed by having the master continuously transmit Acknowledge messages until a EVENT_TRANSFER_TX_COMPLETED occurs. This event shows that an Acknowledge message has been received and it is safe to transmit a Burst message. A second (and very similar) solution would be to continuously transmit burst messages, repeating the burst data transmission everytime an EVENT_TRANSFER_TX_FAILED occurs. This is similar as only one burst packet will be sent until you get the event when a slave is not tracking nrf51422 I should mention that both solutions are not very power efficient.

If being used as a slave, after opening the channel the nrf51422 will continuously search for a master device and then begin tracking a master once one is found. The function "ant_channel_status_get()" can be used to determine the status of the ant channel. If the status is returned to be STATUS_TRACKING_CHANNEL, it will signal to your application that it is safe for the nrf51422 to begin sending a burst data message as it is successfully tracking a master.

There are several different solutions (not all mentioned above) for your question. It really depends on your use case. What is a high level description of the use case involved for your application? This will allow us to find the optimal solution for your needs.

If you haven't already done so, I would recommend reading Section 8 of "AN04 Burst Transfers" which goes over the various event messages used for Burst transfer as you may likely wish to incorporate handling the applicable events into your code. It can be found at:
http://www.thisisant.com/developer/resources/downloads/#documents_tab

Cheers,
Chris