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.

AFE7900EVM: NCO frequency configuration

Expert 1730 points
Part Number: AFE7900EVM

Hello,

     For our application we need to rapidly change the NCO frequency (in a way to scan the frequency spectrum). The SPI command approach is slow for this. 

In one of the forum posts there was a mention about how some GPIO pins can be used to switch the NCO to pre-determined frequencies. 

I had already asked this question : https://e2e.ti.com/support/rf-microwave-group/rf-microwave/f/rf-microwave-forum/1285010/afe7900evm-nco-frequency-configuration

However I did not receive an answer for my follow up query. We need to switch across multiple frequency bands (not just 2 bands). 

Please advise,

  • Hi SM,

    The script below can be used to configure the AFE such that the selected NCO is set through GPIO.

    ##############		Read me			##############
    #In HSDC Pro DAC tab, Select AFE79xx_2x2TX_44210; Data Rate = 491.52M
    #In HSDC Pro ADC tab, Select AFE79xx_2x2RX_44210; Data Rate = 491.52M ---> To capture 4 RX channels
    
    sysParams=AFE.systemParams
    sysParams.__init__();sysParams.chipVersion=chipVersion
    
    setupParams.skipFpga = 1 # setup FPGA (TSW14J56) using HSDC Pro 
    ##############		Top Level			##############
    sysParams.FRef			= 491.52
    sysParams.FadcRx		= 2949.12
    sysParams.FadcFb		= 2949.12
    sysParams.Fdac			= 2949.12*4
    sysParams.externalClockRx=False
    sysParams.externalClockTx=False
    													
    ##############		Digital Chain		##############
    
    		#####	RX	#####
    sysParams.ddcFactorRx	=	[6,6,6,6]				#DDC decimation factor for RX A, B, C and D
    sysParams.rxNco0		= 	[[5400,5400],			#Band0, Band1 for RXA 
    							[500,500],        		#Band0, Band1 for RXB 
    							[2500,2500],        	#Band0, Band1 for RXC 
    							[1800,1800]]        	#Band0, Band1 for RXD 
    
    		#####	FB	#####
    sysParams.fbEnable		=	[False,False]
    sysParams.ddcFactorFb	=	[6,6]					#DDC decimation factor for FB 1 and 2
    sysParams.fbNco0		= 	[500,1800]				#Band0 for FB1 and FB2 
    
    		#####	TX	#####
    sysParams.ducFactorTx	=	[18,18,18,18]			#DUC interpolation factor for TX A, B, C and D
    sysParams.txNco0		= 	[[5400,5400],			#Band0, Band1 for TXA 
    							[500,500],        		#Band0, Band1 for TXB 
    							[2500,2500],        	#Band0, Band1 for TXC 
    							[1800,1800]]        	#Band0, Band1 for TXD
    
    
    ##############		JESD		##############
    
    		#####	ADC-JESD	#####
    sysParams.jesdSystemMode= [3,3]
    													#SystemMode 0:	2R1F-FDD						; rx1-rx2-fb -fb
    													#SystemMode 1:	1R1F-FDD						; rx -rx -fb -fb
    													#SystemMode 2:	2R-FDD							; rx1-rx1-rx2-rx2
    													#SystemMode 3:	1R								; rx -rx -rx -rx
    													#SystemMode 4:	1F								; fb -fb- fb -fb
    													#SystemMode 5:	1R1F-TDD						; rx/fb-rx/fb-rx/fb-rx/fb
    													
    sysParams.jesdTxProtocol= [0,0]						# 0 - 8b/10b encoding; 2 - 64b/66b encoding 
    sysParams.LMFSHdRx		= ["44210","44210","44210","44210"]
    													# The 2nd and 4th are valid only for jesdSystemMode values in (0,2).
    													# For other modes, select 4 converter modes for 1st and 3rd.
    sysParams.LMFSHdFb		= ["22210","22210"]
    
    sysParams.rxJesdTxScr	= [True,True,True,True]
    sysParams.fbJesdTxScr	= [True,True]
    
    sysParams.rxJesdTxK		= [16,16,16,16]
    sysParams.fbJesdTxK		= [16,16]
    
    sysParams.jesdTxLaneMux	= [0,1,2,3,4,5,6,7]			# Enter which lanes you want in each location. 
    													# For example, if you want to exchange the first two lines of each 2T,
    													#		this should be [[1,0,2,3],[5,4,6,7]]
    
    		#####	DAC-JESD	#####
    sysParams.jesdRxProtocol= [0,0]
    sysParams.LMFSHdTx		= ["44210","44210","44210","44210"]
    sysParams.jesdRxLaneMux	= [0,1,2,3,4,5,6,7]			# Enter which lanes you want in each location.
    													# For example, if you want to exchange the first two lines of each 2R
    													#		this should be [[1,0,2,3],[5,4,6,7]]
    sysParams.jesdRxRbd		= [4, 4]
    sysParams.jesdRxScr		= [True,True,True,True]
    sysParams.jesdRxK		= [16,16,16,16]
    
    		#####	JESD Common	#####
    
    sysParams.jesdABLvdsSync= True
    sysParams.jesdCDLvdsSync= True
    sysParams.syncLoopBack	= True	#JESD Sync signal is connected to FPGA
    
    ##############		GPIO		##############
    sysParams.gpioMapping	= {
    						'H8': 'ADC_SYNC0',
    						'H7': 'ADC_SYNC1',
    						'N8': 'ADC_SYNC2',
    						'N7': 'ADC_SYNC3',
    						'H9': 'DAC_SYNC0',
    						'G9': 'DAC_SYNC1',
    						'N9': 'DAC_SYNC2',
    						'P9': 'DAC_SYNC3',
    						'P14': 'GLOBAL_PDN',
    						'K14': 'FBABTDD',
    						'R6': 'FBCDTDD',
    						'H15': ['TXATDD','TXBTDD'],
    						'V5': ['TXCTDD','TXDTDD'],
    						'E7': ['RXATDD','RXBTDD'],
    						'R15': ['RXCTDD','RXDTDD'],
    						'E6': 'TX_NCOSEL_0',
    						'C5': 'TX_NCOSEL_1',
    						'P16': 'TX_NCOSEL_2',
    						'C6': 'TX_NCOSEL_3',
    						'G6': 'RX_NCOSEL_0',
    						'G7': 'RX_NCOSEL_1',
    						'G8': 'RX_NCOSEL_2',
    						'R5': 'RX_NCOSEL_3',
    						'C6': 'TX_NCOSEL_3',}
    
    ##############		LMK Params		##############
    lmkParams.pllEn			= True
    lmkParams.inputClk		= 983.04 # Valid only when lmkParams.pllEn = False
    lmkParams.lmkFrefClk	= True
    setupParams.fpgaRefClk	= 245.76 # Should be equal to LaneRate/40 for TSW14J56
    
    ##############		Logging		##############
    logDumpInst.setFileName(ASTERIX_DIR+DEVICES_DIR+r"\Afe79xxPg1.txt")
    logDumpInst.logFormat=0x0 #Modify to 0x1 to save register scequence to log file. Script takes more time to execute.
    logDumpInst.rewriteFile=1
    logDumpInst.rewriteFileFormat4=1
    device.optimizeWrites=0
    device.rawWriteLogEn=1
    lmk.rawWriteLogEn=1
    
    ##############		16 NCO Params		##############
    sysParams.ncoFreqMode	= "FCW"
    
    sysParams.ncoRxMode		=	[6,6]
    sysParams.broadcastRxNcoSel = 1
    sysParams.numRxNCO		=	2
    
    sysStatus.txChainDirectCtrl=True
    sysParams.txChainDirectCtrl=True
    sysParams.ncoTxMode		=	[3,3]
    sysParams.broadcastTxNcoSel = 1
    sysParams.numTxNCO		=	2
    
    
    device.delay_time = 0
    #-------------------------------------------------------------------------------------------------#
    AFE.deviceBringup()
    
    AFE.TOP.overrideTdd(15,3,15)	# bit-wise; 4R,2F,4T
    
    for i in range(16):
    	for j in range(3):
    		AFE.updateRxNcoInfiniteNcoMode(j,5400+50*i,i)
    		AFE.updateTxNcoInfiniteNcoMode(j,5400+50*i,i)
    
    for i in range(2):	
    	for j in range(2):
    		device.TT[j].TXDIG[i].TXDIG.REGGROUP_4.config_fmixer_update_pulse = 0
    		device.TT[j].TXDIG[i].TXDIG.REGGROUP_4.config_fmixer_update_pulse = 1
    
    # AFE.IOWRAP.overrideFunction('TX_NCOSEL_0',1,1)
    # AFE.IOWRAP.overrideFunction('TX_NCOSEL_2',1,1)
    # AFE.IOWRAP.overrideFunction('TX_NCOSEL_1',1,1)
    # AFE.IOWRAP.overrideFunction('TX_NCOSEL_3',1,1)
    
    # AFE.IOWRAP.overrideFunction('RX_NCOSEL_0',0,0)
    # AFE.IOWRAP.overrideFunction('RX_NCOSEL_1',0,0)
    # AFE.IOWRAP.overrideFunction('RX_NCOSEL_2',0,0)
    # AFE.IOWRAP.overrideFunction('RX_NCOSEL_3',0,0)

    To update the NCO frequencies please use the below functions.

    • Use command AFE.updateRxNcoInfiniteNcoMode(ch_num, NCO_freq, NCO_num) to update RX NCO frequencies ch_num -> 0 to 3; NCO_freq in MHz; NCO_num -> 0 to 15
    • Use command AFE.updateTxNcoInfiniteNcoMode(ch_num, NCO_freq, NCO_num) to update TX NCO frequencies ch_num -> 0 to 3; NCO_freq in MHz; NCO_num -> 0 to 15

     

    Program update_pulse bit from 0 -> 1 using below register writes to update TX NCO frequencies immediately. TX NCO Frequencies are also automatically updated when NCOs are switched.

    device.TT[0].TXDIG[0].TXDIG.REGGROUP_4.config_fmixer_update_pulse = 0

    device.TT[0].TXDIG[0].TXDIG.REGGROUP_4.config_fmixer_update_pulse = 1

     

     

    Note that for testing, GPIOs can be overridden from latte using ‘AFE.IOWRAP.overrideFunction’ command:

    • For example, to set TX_NCOSEL_0 to ‘1’, run AFE.IOWRAP.overrideFunction('TX_NCOSEL_0',1,1) # override_enable = 1; override_value = 1
    • To set TX_NCOSEL_0 to ‘0’, run AFE.IOWRAP.overrideFunction('TX_NCOSEL_0',1,0) # override_enable = 1; override_value = 1
    • To disable override, run AFE.IOWRAP.overrideFunction('TX_NCOSEL_0',0,0) # override_enable = 0

    Regards,

    David Chaparro