I am trying to write a custom linear sweep function for both amplitude and frequency. Neither are working. I have been trying to find the bug in the code or figure out which register commands I am missing for the past two days.
My code does the following:
Writes to register 0x00 -> 0x10 to activate channel 0
Writes to register 0x01 -> 0xD0, 0x00, 0x00 to activate multiplier and operate under two level modulation
Writes to register 0x03 -> 0x40, 0x43, 0x00 to set AFP to amplitude and to enable linear sweep
Writes to register 0x04 to set FTW for a 125MHz wave
Writes to register 0x06 -> to set  to logic 1 (amplitude multiplier enable) and set the amplitude scale factor for channel word 0
Writes to register 0x0A to set channel word 1
Writes to register 0x08 and 0x09 to set an identical rising and falling delta word (the tuning word is 2)
Writes to register 0x07 -> 0x01, 0x01 to set an arbitrary ramp rate
P0 is brought logic 0 or 1 depending on which direction you want to sweep
I have tried to narrow down the region where the bug is. When I run the function, the oscilloscope shows a SYNC_CLK output wave and a channel output wave form with the right multiplier enabled and the right frequency wave. I can likely rule out channel 0, 1, 4, and 6 being the problem due to my observations. I have also done extensive debugging to make sure that these register functions work when running other programs. I did some minimal modification to make my linear sweep function a 2-level modulation function instead. This function worked, and P0 toggled between the two frequencies. This allowed me to likely rule out register 0x0A as the problem.
The part where its broken: The output amplitude is that of channel word 0 when P0 is brought LOW. When I write P0 HIGH, the wave does not sweep up to the value in channel word 1. It remains at the channel word 0 value. The function is not sweeping at all. It sets everything up to sweep, and creates a reasonable starting output, but will not respond to P0.
So I think the problem is somewhere in register 3, 7, or 8 and 9, but I cannot find it. All of my code for amplitude modulation is attached below for review.
EDIT: I found another clue. In the CFR (register 0x03) when I enable bit 14, the linear sweep enable bit, the DDS outputs whatever is in register 0x0A with disregard to the logic level of the profile pin that is supposed to be controlling it.
EDIT2: Another clue, when ever I program bits [15:8] of the ramp rate register and leave [7:0] empty, I get a responsiveness to P0 where enabling HIGH loads 0x0A, and LOW loads 0x04. When I program [7:0] and leave [15:8] empty, I get P0 responsiveness, but in reverse. HIGH loads 0x04, and LOW loads 0x0A. If I program both byes into the register, I get no P0 responsiveness. Why is this happening? Am I sweeping if I only have half of the register programmed?