Hello,
I am currently trying to change the NCO of AFE8000EVM dynamically.
(I use zcu102 board and am bringing up the AFE using my firmware not your EVM software).
It doesn't need to change the frequency rapidly.
So, I decided to only use one NCO in a channel.
I first tried to change the nco value by writing frequency value in registers 110h ~ 113h in 2.14 RX DIG Register Map of AFE80xxPG1_TRM manual.
Frequency values that are required are 2100MHz and 2200MHz.
But, it didn't worked.
Below is my first try.
u8 wrVal;
u16 startAddr = 0x110;
// Select the rxDig page, refer to the page 120, AFE80xx GLOBAL Register Map of AFE80xxPG1_TRM_SBAU354_4th_March_2021.pdf
// Select all the RX DIG A, B, ~ , G, H
wrVal = 0xFF;
afe_spi_write(0x14 , wrVal);
// Sets the FCW_UPDATE word to zero
wrVal = 0x0;
afe_spi_write(0x14C, wrVal);
// Band 0 NCO setting
wrVal = Freq & 0xFF; // LSB bytes
afe_spi_write(startAddr , wrVal);
wrVal = (Freq >> 8) & 0xFF;
afe_spi_write(startAddr+1 , wrVal);
wrVal = (Freq >> 16) & 0xFF; // LSB bytes
afe_spi_write(startAddr+2 , wrVal);
wrVal = (Freq >> 24) & 0xFF;
afe_spi_write(startAddr+3 , wrVal);
// Sets the FCW_UPDATE word to one to apply the changes
wrVal = 0x1;
afe_spi_write(0x14C, wrVal);
// Deselect the RX DIG page
wrVal = 0x0;
afe_spi_write(0x14 , wrVal);
Second, I used a macro command.
I tested the macro ocode 0x38 that was given in the TRM.
Below is my procedures. After executing the macro 0x38, TUNE SYSTEM macro has been executed.
Of course, this also failed.
I want to know how I change the NCO value dynamically from my firmware.
Thank you.
u8 wrVal;
int i = 0;
// Page select
wrVal = 0x20;
afe_spi_write(0x18 , wrVal);
// Select all the RX DIG A, B, ~ , G, H
wrVal = 0xFF;
afe_spi_write(0xA0 , wrVal);
// NCO and band select
wrVal = 0x0;
afe_spi_write(0xA1, wrVal);
// Sets the frequency word
wrVal = Freq & 0xFF;
afe_spi_write(0xA2, wrVal);
// Sets the frequency word
wrVal = (Freq >> 8) & 0xFF;
afe_spi_write(0xA3, wrVal);
// Sets the frequency word
wrVal = (Freq >> 16) & 0xFF;
afe_spi_write(0xA4, wrVal);
// Sets the frequency word
wrVal = (Freq >> 24) & 0xFF;
afe_spi_write(0xA5, wrVal);
wrVal = 0x3;
afe_spi_write(0xA6, wrVal);
// macro execution
wrVal = 0x38;
afe_spi_write(0x193, wrVal);
while(i++ < 10000);
// Execute the Tune System Macro
wrVal = 0x0;
afe_spi_write(0xA0 , wrVal);
wrVal = 0x0;
afe_spi_write(0xA1 , wrVal);
wrVal = 0x0;
afe_spi_write(0xA2 , wrVal);
wrVal = 0x0;
afe_spi_write(0xA3 , wrVal);
wrVal = 0x0;
afe_spi_write(0xA4 , wrVal);
wrVal = 0x0;
afe_spi_write(0xA5 , wrVal);
// macro execution
wrVal = 0x36;
afe_spi_write(0x193, wrVal);
// Page deselect
wrVal = 0x20;
afe_spi_write(0x18 , wrVal);