This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

ANT+ pre-event timing

Hi,

I have a simple question. How should I handle situation, when need to collect data and process them before the computed data are sended via ANT+ profile which runs on 4Hz update rate? I had an idea to use repeated timer, but it is not possible, because for example when I set timer interval to 240ms to have 10ms for data processing before they are sended, the gap between data processing is getting bigger in time. Acceptable would be if the data processing would be handled 10-20ms before ANT+ data send event every time. So please, any suggestion, what should I do?

thanks,

Pepam

Parents Reply
  • Hi , I have other problem with radio notification. I have added timer measuring to SWI1_IRQ handler to see if the timing is correct. Radio notifications are configured to fire handler on inactive radio event, 2480us after radio has been disabled, but when I print time that have passed from previous event, it is a bit weird. It shows 11ms and then 235ms. These numbers occur periodically. It looks like something using the SWI1 handler also? Please see attached print screen with code.

    Regards,

    Pepam

Children
  • The radio nofification signal may also be triggered by other activity such as timeslots due to flash operations or other radio activity (e.g. searching, BLE if you support that) etc. Can this be the case here?

    Maybe it is better idea to sync on an event from ANT, e.g. start an app_timer on EVENT_TRANSFER_TX_COMPLETED event that timeout before the next ANT interval?

  • Hi , thanks for reply and idea. But please could you explain me or point to some threads where could I learn in which way should I work with EVENT_TRANSFER_TX_COMPLETED event? How should I sense this event? Is it possible to interconnect it via PPI and fire timer task start after this event? Or does it have some interrupt handler? My goal is to let cpu sleep as much as possible due to power consumption so hope that it is not required cpu to wait and be listening for this event. 

  • Typically in ant_evt_handler() you will get an EVENT_TX. Then you can start an single shot app_timer that for instance will timeout after 240ms (this might be a reasonable timeout if for instance the ANT interval is 250ms), then on the timeout handler you can run sensor sampling and write to new data to ANT using sd_ant_broadcast_message_tx().

    Best regards,
    Kenneth

Related