This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AFE8000EVM: dynamic change of RX nco

Part Number: AFE8000EVM

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);

  • Is there anyone who can handle this problem?

  • Hi James,

    When you try the direct register writes what do you see on the ADC capture? Did the NCO not change at all or did it change to the incorrect frequency? Are you able to share how you are finding the FCW for new NCO frequency? 

    I have tested this on the AFE8000EVM and I was able to update the NCO frequency for all channels using the following lines the register writes given below. I also show how I calculate the NCO FCW. Can you give these a try on your setup? 

    F_ADC = 3000 # Sample Rate
    F_NCO = 2200 # NCO Frequency 
    FCW = int(((F_NCO%F_ADC)*2**32)/F_ADC)
    
    
    device.writeReg(0x14,0xFF) # select all Rx Dig pages;
    device.writeReg(0x113,(FCW>>24)&0xFF)
    device.writeReg(0x112,(FCW>>16)&0xFF)
    device.writeReg(0x111,(FCW>>8)&0xFF)
    device.writeReg(0x110,(FCW&0xFF)) # program Rx NCO0
    device.writeReg(0x14C,0x01) # NCO is loaded only when this bit is toggled from 0 -> 1
    device.writeReg(0x14C,0x00) # Toggle bit back to 0 for next NCO load 
    device.writeReg(0x14,0x0) # page close

    Regards,

    David Chaparro

  • Thanks, David.

    It resolved my issue.

    Have a good day.