Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KR920 LBT test faillure #1532

Open
dennisvbussel opened this issue Apr 14, 2023 · 0 comments
Open

KR920 LBT test faillure #1532

dennisvbussel opened this issue Apr 14, 2023 · 0 comments

Comments

@dennisvbussel
Copy link

dennisvbussel commented Apr 14, 2023

Hi,

We are attempting to approbate region KR920 and the test house reports failure on the listen-before-talk test.

Looking at the following code snippet:

bool RadioIsChannelFree( uint32_t freq, uint32_t rxBandwidth, int16_t rssiThresh, uint32_t maxCarrierSenseTime )
{
bool status = true;
int16_t rssi = 0;
uint32_t carrierSenseTime = 0;
RadioSetModem( MODEM_FSK );
RadioSetChannel( freq );
// Set Rx bandwidth. Other parameters are not used.
RadioSetRxConfig( MODEM_FSK, rxBandwidth, 600, 0, rxBandwidth, 3, 0, false,
0, false, 0, 0, false, true );
RadioRx( 0 );
DelayMs( 1 );
carrierSenseTime = TimerGetCurrentTime( );
// Perform carrier sense for maxCarrierSenseTime
while( TimerGetElapsedTime( carrierSenseTime ) < maxCarrierSenseTime )
{
rssi = RadioRssi( MODEM_FSK );
if( rssi > rssiThresh )
{
status = false;
break;
}
}
RadioSleep( );
return status;
}

The default return value bool status = true; Seems to be problematic in our case. For some reason (probably a race-condition) the loop while( TimerGetElapsedTime( carrierSenseTime ) < maxCarrierSenseTime ) exits immediately without measuring the RSSI even once and the function returns true

Adding a check rssi != 0 resolves this problem.

Example solution:

bool RadioIsChannelFree( uint32_t freq, uint32_t rxBandwidth, int16_t rssiThresh, uint32_t maxCarrierSenseTime )
{
    ...
    RadioSleep( );
    // Make sure that the carrier sense is executed once
    return (rssi != 0) ? status : false; 
}

Or maybe nicer, change while -> do while:

bool RadioIsChannelFree( uint32_t freq, uint32_t rxBandwidth, int16_t rssiThresh, uint32_t maxCarrierSenseTime )
{
    bool     status           = true;
    int16_t  rssi             = 0;
    uint32_t carrierSenseTime = 0;

    RadioSetModem( MODEM_FSK );

    RadioSetChannel( freq );

    // Set Rx bandwidth. Other parameters are not used.
    RadioSetRxConfig( MODEM_FSK, rxBandwidth, 600, 0, rxBandwidth, 3, 0, false,
                      0, false, 0, 0, false, true );
    RadioRx( 0 );

    DelayMs( 1 );

    carrierSenseTime = TimerGetCurrentTime( );

    // Perform carrier sense for maxCarrierSenseTime
    do 
    {
        rssi = RadioRssi( MODEM_FSK );

        if( rssi > rssiThresh )
        {
            status = false;
            break;
        }
    }
    while( TimerGetElapsedTime( carrierSenseTime ) < maxCarrierSenseTime );

    RadioSleep( );
    return status;
}

What is your opinion on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant