Skip to main content
maximevince
Visitor II
August 21, 2020
Question

Bug in Spirit1 and Spirit2 (S2-LP) firmware library regarding Channel Spacing

  • August 21, 2020
  • 0 replies
  • 504 views

In Spirit1:

SpiritRadioGetChannel() is flawed:

uint32_t SpiritRadioGetChannelSpace(void)
{
 uint8_t channelSpaceFactor;
 
 /* Reads the CHSPACE register, calculate the channel space and return it */
 g_xStatus = SpiritSpiReadRegisters(CHSPACE_BASE, 1, &channelSpaceFactor);
 
 /* Compute the Hertz value and return it */
 //BUG: return (((uint64_t)channelSpaceFactor*s_lXtalFrequency)/CHSPACE_DIVIDER);
 return ((((uint64_t)channelSpaceFactor)*s_lXtalFrequency)/CHSPACE_DIVIDER);
 
}

And in S2-LP S2LPRadioComputeChannelSpacingRegValue() is flawed:

uint8_t S2LPRadioComputeChannelSpacingRegValue(uint32_t lChannelSpace)
{
 //BUG: return (uint32_t)(((uint64_t)lChannelSpace)<<15)/s_lXtalFrequency;
 return (uint32_t)((((uint64_t)lChannelSpace)<<15)/s_lXtalFrequency);
}
 
 

   There might be other places as well, but these are the two I encountered for now...

   It's clear this code is not tested, also examples on how to use channels are lacking.

   It's sad to see this is continuously the case with ST products and firmware libraries over the years...

    This topic has been closed for replies.