New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sayma HMC830: update interface and register writes. #1068
Conversation
hartytp
commented
Jun 11, 2018
- Break the HMC830 init into separate functions for general purpose (but, integer-N) init, setting dividers and checking lock
- Use 1.6mA ICP (which the loop filter was optimized for)
- Go through the data sheet carefully and set all registers to the correct value (e.g. ensure that all settings are correctly optimized for integer-N usage)
- Change divider values (now using 100MHz PFD, which should give lower noise in theory)
- Tested at Oxford and all locked reliably well here, but someone else should check this before merging!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks conceptually fine. Haven't tested it.
Ok(()) | ||
} | ||
|
||
pub fn set_dividers(r_div: u32, n_div: u32, m_div: u32, out_div: u32) -> Result<(), &'static str> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't need a Result<>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will fix.
@@ -113,18 +80,66 @@ mod hmc830 { | |||
} | |||
|
|||
pub fn init() -> Result<(), &'static str> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't need a Result<>
anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks! will fix.
Do you want this all squashed into a single commit at the end?
* fvco = (refclk / r_divider) * n_divider | ||
* fout = fvco/2 | ||
* | ||
* HMC7043 config: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That part of the comment shouldn't be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I'm happy to revert that change.
My thinking was:
* fvco = (refclk / r_divider) * n_divider
that's information is now here, which seems like a better place for it: https://github.com/hartytp/artiq/blob/2621782f8c6bcf05f0e0ca85df42704922e5945b/artiq/firmware/libboard_artiq/hmc830_7043.rs#L113
- * fout = fvco/2
- *
- * HMC7043 config:
That information is now here https://github.com/hartytp/artiq/blob/2621782f8c6bcf05f0e0ca85df42704922e5945b/artiq/firmware/libboard_artiq/hmc830_7043.rs#L161-L182 and here https://github.com/hartytp/artiq/blob/2621782f8c6bcf05f0e0ca85df42704922e5945b/artiq/firmware/libboard_artiq/hmc830_7043.rs#L335
Personally, I don't like duplicating this kind of information in comments at the top of the file, since it's easy for people to forget to update them when changing the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To check, which bit of the comment do you want back?
* HMC7043 config:
* dac clock: 600MHz (div=2)
* fpga clock: 150MHz (div=8)
* sysref clock: 9.375MHz (div=128)
or this bit
- * fvco = (refclk / r_divider) * n_divider
- * fout = fvco/2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry. I meant just the hmc7043 comment should not get lost.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I'll reintroduce that if you'd prefer.
This still seems a bit redundant to me given https://github.com/hartytp/artiq/blob/ddb47524fb030c88ed4bd82f8dfdbd602ffd7366/artiq/firmware/libboard_artiq/hmc830_7043.rs#L159-L180 What about I just add the frequencies to the comments where the divider values are defined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect. I just wanted to avoid having to calculate the frequencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
write(0x6, 0x307ca); // integer-N mode (NB data sheet table 5.8 not self-consistent) | ||
write(0x7, 0x4d); // digital lock detect, 1/2 cycle window (6.5ns window) | ||
write(0x9, 0x2850); // charge pump: 1.6mA, no offset | ||
write(0xa, 0x2045); // for wideband devices like the HMC830 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you are OK with not doing a review of the values, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra reviews are always welcome. However, in this case I don't think it's necessary. I've checked this all through against the data sheet carefully and tested it on my hardware. I'm inclined to say that if it works reliably on other HW as well then further review isn't worth the time it would take (but if you have spare time then go for it!).
@marmeladapk @jbqubit @sbourdeauducq it would be great if one or more of you could check that this works on your boards before we merge this. Thanks! |
I'll check this on sayma-2 in HK. |
FWIW, I still don't like this https://github.com/hartytp/artiq/blob/2db82806235a2cebe0d1b2650df1c64a48cf61a1/artiq/firmware/libboard_artiq/hmc830_7043.rs#L309-L324 as it goes back to hard-coding divider values. So, if you change |
Yes. But please don't go overboard with the generalization and interdependency of that code. Abstracting the over the register map and feature sets of those chips won't work. |
Agreed, I'm keen to keep this as simple as possible. |
This is your branched merge into master (with cb6e44b)
That's the first memory test failure I have seen in a long time.
|
Is that reproducible over several loads/power cycles? |
Uurgh, that's horrible. But, I can't see how that can be related to any of the firmware changes I made in those two commits. Does it go away if you revert the changes? Looks like similar symptoms to #1066. |
I've seen it 3/10 with that firmware. Each time accompanied with a shift of the window.
followed by lock up (in the bios! i.e. the corruption in this case is not just sdram) And 1/10 with a9d9710 (without your changes). Also accompanied with a shift of the window. At least the fact that the firmware doesn't make a difference is reassuring. |
I'm fine with merging this if you either revert the "...done"/"...locked" change or also change the one on the hmc7043 "...done". And please fix the conflict. |
@jordens / @sbourdeauducq can you repeat that without the RTM connected? That will tell us if this is related to any RTM-based noise source. Anyway, the HMC7043 should be held in the reset state during bios/mem test so it can't be that this time... |
Thanks. Squashing was the right thing to do. |