First message from ANT sensor ?

Dear Members,

Can we do this to capture the first message from ANT transmitter ?

void ant_bsc_disp_evt_handler(ant_evt_t * p_ant_evt, void * p_context)
{
    ant_bsc_profile_t * p_profile = (ant_bsc_profile_t *)p_context;
    NRF_LOG_INFO("ant_bsc_disp_evt_handler\r\n"); 
    if (p_ant_evt->channel == p_profile->channel_number)
    {
        switch (p_ant_evt->event)
        {
            case EVENT_RX:
                if (p_ant_evt->message.ANT_MESSAGE_ucMesgID == SEQUENCE_FIRST_MESSAGE)
								 {
								   1st message;
								 }

Kind regards,

Rixtronix LAB

Parents Reply Children
  • Hi Sigurd,

    Thanks for the reply,

    We need to save RevCount0 from the sensor, as a base for distance calculation and configuration for Odo meter,

    Attached is the formula

    and the log we got from the receiver and sensor :

    50822V1capture.txt

    Function :

    void ant_bsc_disp_evt_handler(ant_evt_t * p_ant_evt, void * p_context)
    {
        ant_bsc_profile_t * p_profile = (ant_bsc_profile_t *)p_context;
        NRF_LOG_INFO("ant_bsc_disp_evt_handler\r\n"); 
        if (p_ant_evt->channel == p_profile->channel_number)
        {
            switch (p_ant_evt->event)
            {
                case EVENT_RX:
    							  /*********************DEBUG THE message Rixtronix LAB 4Aug22*****************/
    						      NRF_LOG_INFO("p_ant_evt->message.ANT_MESSAGE_ucMesgID 0x%02X", p_ant_evt->message.ANT_MESSAGE_ucMesgID);   
    						      if (p_ant_evt->message.ANT_MESSAGE_ucMesgID == SEQUENCE_FIRST_MESSAGE)
    								 {
    									 //write rev_cnt to eeprom here
    									 NRF_LOG_INFO("First ANT message!\r\n"); 
    								 }	 
    								 if (p_ant_evt->message.ANT_MESSAGE_ucMesgID == MESG_BURST_DATA_ID)
    								 {
    									 //write rev_cnt to eeprom here
    									 NRF_LOG_INFO("MESG_BURST_DATA_ID!\r\n"); 
    									 NRF_LOG_INFO("First ANT message!\r\n");
    								 }	     
    						
                    
    								/*********************DEBUG THE message Rixtronix LAB 4Aug22*****************/ 
    								 
                    if (p_ant_evt->message.ANT_MESSAGE_ucMesgID == MESG_BROADCAST_DATA_ID
                     || p_ant_evt->message.ANT_MESSAGE_ucMesgID == MESG_ACKNOWLEDGED_DATA_ID
                     || p_ant_evt->message.ANT_MESSAGE_ucMesgID == MESG_BURST_DATA_ID)
                    {
                        disp_message_decode(p_profile, p_ant_evt->message.ANT_MESSAGE_aucPayload);
    									  NRF_LOG_INFO("p_ant_evt->message.ANT_MESSAGE_ucMesgID 0x%02X", p_ant_evt->message.ANT_MESSAGE_ucMesgID); 
                    }
                    break;
                default:
                    break;
            }
        }
    }

    Await for the response,

    Kind regards,

    Rixtronix LAB

  • Hi Sigurd,

    Thanks for the reply,

    How can we use these define :

    // ////////////////////////////////////////////
    /** @name Rx Burst Message Sequencing Defines
     *  @{ */
    // ////////////////////////////////////////////
    #define CHANNEL_NUMBER_MASK                        ((uint8_t)0x1F) ///< Valid bitfields for channel number
    #define SEQUENCE_NUMBER_MASK                       ((uint8_t)0xE0) ///< Valid bitfields for burst sequence
    #define SEQUENCE_NUMBER_ROLLOVER                   ((uint8_t)0x60) ///< Sequence rollover
    #define SEQUENCE_FIRST_MESSAGE                     ((uint8_t)0x00) ///< Sequence indicating first burst message
    #define SEQUENCE_LAST_MESSAGE                      ((uint8_t)0x80) ///< Sequence indicating last burst message
    #define SEQUENCE_NUMBER_INC                        ((uint8_t)0x20) ///< Incremental sequence value
    /** @} */

    Line 250

    E:\nRF5_SDK_17.0.2_d674dde\components\softdevice\SoftDevice\headers\include\ant_parameters.h

    Kind regards,

    Rixtronix LAB

Related