hmc830: improve lock failure error report

This commit is contained in:
Sebastien Bourdeauducq 2018-01-20 15:42:53 +08:00
parent 115aa0d0d6
commit c3323f0d57
1 changed files with 2 additions and 3 deletions

View File

@ -107,12 +107,11 @@ mod hmc830 {
info!("waiting for lock..."); info!("waiting for lock...");
while read(0x12) & 0x02 == 0 { while read(0x12) & 0x02 == 0 {
if clock::get_ms() > t + 2000 { if clock::get_ms() > t + 2000 {
error!("lock timeout"); error!("HMC830 lock timeout. Register dump:");
info!("register dump:");
for addr in 0x00..0x14 { for addr in 0x00..0x14 {
// These registers don't exist (in the data sheet at least) // These registers don't exist (in the data sheet at least)
if addr == 0x0d || addr == 0x0e { continue; } if addr == 0x0d || addr == 0x0e { continue; }
info!("[0x{:02x}] = 0x{:04x}", addr, read(addr)); error!("[0x{:02x}] = 0x{:04x}", addr, read(addr));
} }
return Err("HMC830 lock timeout"); return Err("HMC830 lock timeout");
} }