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

Difficulies to implement acknoledgement on ant asynchrone link.

Hello,

I have some difficulties to make an ant acknoledgement with my nrf51422 (s210), and i would be grateful if you could help me with it. (SDK used 12.2)

I have 2 modules nrf51422 that communicate in ant:

  • A master (configuration : CHANNEL_TYPE_MASTER | ASYNCRONE_TX_MODE | FAST_INIT) The master sends sd_ant_acknowledge_message_tx to a slave and resents 10 times if not acknoledged.

  • A slave (configuration : CHANNEL_TYPE_SLAVE | EXT_PARAM_ALWAYS_SEARCH) The slave receives the message (Configurated leds are blincking) and should acknoledge the received message but it doesn't acknowledge.

My questions are :

  1. Is the acknoledgement directly managed by library?
  2. If not (1), which functions should I use for (sd_ant_acknowledge_message_tx?)
  3. If yes (2), could or should i use the same channel?
  4. Is there an exemple I could have or find to help me implement it?

Thanks in advance for your answers and sorry for my poor english.

Best regards from France.

Extract of the receiver code :

void ant_evt_dispatch(ant_evt_t * p_ant_evt)
{
    uint32_t err_code;
    if (p_ant_evt->channel == ANT_SCANNER_CHANNEL_NUMBER)
    {
        ANT_MESSAGE * p_message = (ANT_MESSAGE *)p_ant_evt->evt_buffer;
        switch (p_ant_evt->event)
        {

		//If a message has been received 
            case EVENT_RX:
                if (p_message->ANT_MESSAGE_ucMesgID == MESG_BROADCAST_DATA_ID
                    || p_message->ANT_MESSAGE_ucMesgID == MESG_ACKNOWLEDGED_DATA_ID
                    || p_message->ANT_MESSAGE_ucMesgID == MESG_BURST_DATA_ID)
			{

			//Make the led n°1 blink
			err_code = bsp_indication_set(BSP_INDICATE_RCV_OK);
			APP_ERROR_CHECK(err_code);

			//If the message have the right data make the led 2 blink
			if (p_message->ANT_MESSAGE_aucPayload[7]==0x50)
				{
				LEDS_ON(BSP_LED_2_MASK);						
				}
		
			//If the message is an aknoledge message, sent it back!
			//I totally not sure that it s the right way to acknowledge the received message
			//I make an eco of the received message	
			if (p_message->ANT_MESSAGE_ucMesgID ==MESG_ACKNOWLEDGED_DATA_ID)
				{
				err_code = sd_ant_acknowledge_message_tx( ANT_SCANNER_CHANNEL_NUMBER,8,p_message->ANT_MESSAGE_aucPayload);
				}
													
			}
                break;

            default:
                break;
        }
    }
}

Patrice.

Related