In following the blog entry in how to get warmboot coefficients to work, I discovered the API code can't possibly work. The downloaded coefficients are always zero, and the uploaded coefficients are random data from memory.
In navassa/devices/adrv9001/public/src/adi_adrv9001_cals.c:906 this is in adi_adrv9001_cals_InitCals_WarmBoot_Coefficients_UniqueArray_Get().
ADI_EXPECT(adi_adrv9001_arm_Memory_Read, device, addr, calVal, size, 0); memcpy(calVal, memStartAddress, ADI_ADRV9001_WB_MAX_NUM_COEFF); memStartAddress+= ADI_ADRV9001_WB_MAX_NUM_COEFF;
Note this block reads the coefficient memory from the arm processor into calVal, then overwrites calVal with whatever data is in memStartAddress (aka the output buffer). In other words, the output buffer contents are never changed and calVal data is discarded.
In the same file, line 994, the bug is repeated in the opposite direction, but with worse consequences. This is in adi_adrv9001_cals_InitCals_WarmBoot_Coefficients_UniqueArray_Set().
memcpy(memStartAddress, calVal, ADI_ADRV9001_WB_MAX_NUM_COEFF); ADI_EXPECT(adi_adrv9001_arm_Memory_Write, device, addr, calVal, size, 0); memStartAddress += ADI_ADRV9001_WB_MAX_NUM_COEFF;
Note this version of the bug is much worse because calVal is totally uninitialized before the call to Memory_Write(). As a result, random data will be written to the radio as warmboot coefficients.
It's surprising this doesn't completely crash the radio.
Make it clear it's the API at fault, not the blog entry.
[edited by: SDRF at 7:37 PM (GMT -5) on 4 Mar 2023]