Hello again,

I found some bugs from the M2AP receive:



in the end of the function, interrupt enable functions have to be called after the command strobe, otherwise the interrupts are cleared:

RF_CmdStrobe( RF_CoreStrobe_RX );   //AGAIDI, order changed  
RF1AIES = intr_eselect;                //AGAIDI, order changed  
RF1AIE  = intr_en;                    //AGAIDI, order changed  

Also in general, AIES must be set before AIE. Otherwise there is a possibility that wrong interrupt is triggered before AIES is set.


//AGAIDI -> must be another way around, otherwise over_thresh interrupt triggers
#define RFCONFIG_TXFIFO_INTON() do { \
    RF1AIES = (ot_u16)(RF_CoreIT_TXBelowThresh | RF_CoreIT_TXUnderflow); \
    RF1AIE = (ot_u16)((RF_CoreIT_TXBelowThresh | RF_CoreIT_TXUnderflow) >> 16); \
} while(0)


Foreground and background frames have different sync words. So I added following lines:


sub_syncword_config(1);  //AGAIDI


sub_syncword_config(0);  //AGAIDI

In the system.c, in sys_event_manager(), following lines starts the holdscan

if (sys.evt.HSS.event_no != 0) {
            sub_idlevt_ctrl(&sys.evt.HSS, &event_eta, ISF_ID(hold_scan_sequence) );
            if (sys.evt.HSS.nextevent <= 0) {
                sys.evt.process = &sysevt_holdscan;

First time, the sub_idlevt_ctrl() cannot put the right value to the event_eta, because sysevt_holdscan() gets the value from the ISF file. But in the next time the while loop is run, I do not reach these functions so that sub_idlevt_ctrl() could set the right event_eta. That is because the radio is in receive mode thus sys.mutex is not 0 anymore. That's why we added this fix to the sys_event_manager():

 /// Block any new sessions while the radio is engaged in any way
        if (sys.mutex != 0) {
             if (sys.evt.HSS.event_no != 0)        //Fix bscan AGAIDI
                sub_idlevt_ctrl(&sys.evt.HSS, &event_eta, ISF_ID(hold_scan_sequence) );//Fix bscan AGAIDI
            goto sys_event_manager_wrap;

now the right event_eta is set.

Best regards,

Antti Ropponen

 in tx flood i changed also following function:



sys.evt.adv_time = flood_duration; //AGAIDI this line has to be added to the function

if (m2advp_init_flood(session, sys.evt.adv_time) < 0) {   //AGAIDI

void rm2_txstop_flood() {
    radio.state = RADIO_STATE_TXDONE;
    //RF_CoreITConfig(RF_CoreIT_TXBelowThresh, DISABLE);   //AGAIDI
    RFCONFIG_INTS_OFF();                            //AGAIDI