mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-26 11:48:27 +08:00
firmware/hmc830_7043: put hmc7043 in sleep mode before hmc830 initialization
hmc7043 seems to generate broadband noise when not initialized. This allows isolating issues. If hmc830 still does not always lock correctly, then this is not related to hmc7043 broadband noise.
This commit is contained in:
parent
cd4477864a
commit
3c49eba0a0
@ -92,7 +92,7 @@ mod hmc830 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn init() -> Result<(), &'static str> {
|
pub fn detect() -> Result<(), &'static str> {
|
||||||
spi_setup();
|
spi_setup();
|
||||||
let id = read(0x00);
|
let id = read(0x00);
|
||||||
if id != 0xa7975 {
|
if id != 0xa7975 {
|
||||||
@ -101,6 +101,12 @@ mod hmc830 {
|
|||||||
} else {
|
} else {
|
||||||
info!("HMC830 found");
|
info!("HMC830 found");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn init() -> Result<(), &'static str> {
|
||||||
|
spi_setup();
|
||||||
info!("HMC830 configuration...");
|
info!("HMC830 configuration...");
|
||||||
for &(addr, data) in HMC830_WRITES.iter() {
|
for &(addr, data) in HMC830_WRITES.iter() {
|
||||||
write(addr, data);
|
write(addr, data);
|
||||||
@ -196,7 +202,7 @@ pub mod hmc7043 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn init() -> Result<(), &'static str> {
|
pub fn detect() -> Result<(), &'static str> {
|
||||||
spi_setup();
|
spi_setup();
|
||||||
let id = (read(0x78) as u32) << 16 | (read(0x79) as u32) << 8 | read(0x7a) as u32;
|
let id = (read(0x78) as u32) << 16 | (read(0x79) as u32) << 8 | read(0x7a) as u32;
|
||||||
if id != 0xf17904 {
|
if id != 0xf17904 {
|
||||||
@ -205,6 +211,20 @@ pub mod hmc7043 {
|
|||||||
} else {
|
} else {
|
||||||
info!("HMC7043 found");
|
info!("HMC7043 found");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn shutdown() -> Result<(), &'static str> {
|
||||||
|
spi_setup();
|
||||||
|
info!("HMC7043 shutdown...");
|
||||||
|
write(0x1, 0x1); // Sleep mode
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn init() -> Result<(), &'static str> {
|
||||||
|
spi_setup();
|
||||||
info!("HMC7043 configuration...");
|
info!("HMC7043 configuration...");
|
||||||
|
|
||||||
write(0x0, 0x1); // Software reset
|
write(0x0, 0x1); // Software reset
|
||||||
@ -272,6 +292,9 @@ pub mod hmc7043 {
|
|||||||
pub fn init() -> Result<(), &'static str> {
|
pub fn init() -> Result<(), &'static str> {
|
||||||
clock_mux::init();
|
clock_mux::init();
|
||||||
/* must be the first SPI init because of HMC830 SPI mode selection */
|
/* must be the first SPI init because of HMC830 SPI mode selection */
|
||||||
|
hmc830::detect()?;
|
||||||
|
hmc7043::detect()?;
|
||||||
|
hmc7043::shutdown()?;
|
||||||
hmc830::init()?;
|
hmc830::init()?;
|
||||||
hmc7043::init()
|
hmc7043::init()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user