-
Notifications
You must be signed in to change notification settings - Fork 69
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
Arduino hangs when trying to read FUSE bits #129
Comments
Hi, can you run a quick test whether other registers behave differently? I have a feeling this might be an issue on compiler side... |
Sure can! Everything seems to work fine when playing around with the interrupt registers: dp.TC0.tccr0a.write(|w| w.wgm0().ctc());
dp.TC0.tccr0b.write(|w| w.cs0().prescale_1024());
dp.TC0.ocr0a.write(|w| w.bits(255));
dp.TC0.timsk0.write(|w| w.ocie0a().set_bit());
let _val = dp.TC0.tccr0a.read().bits();
ufmt::uwriteln!(&mut serial, "tccr0a.bits() {}", _val).unwrap();
let _val = dp.TC0.tccr0b.read().bits();
ufmt::uwriteln!(&mut serial, "tccr0b.bits() {}", _val).unwrap();
let _val = dp.TC0.ocr0a.read().bits();
ufmt::uwriteln!(&mut serial, "ocr0a.bits() {}", _val).unwrap();
let _val = dp.TC0.timsk0.read().bits();
ufmt::uwriteln!(&mut serial, "timsk0.bits() {}", _val).unwrap(); This will output the following:
Appreciate the help! |
Depending on your uC, reading fuse bits might require extra trickery - e.g. datasheet for atmega328p says:
|
When trying to read the fuse bits via
dp.FUSE.low.read().bits();
(it seems like.read()
may be causing the issue) the Arduino Uno halts on that line, never continuing or panicking.It seems like this also happens when reading other fuse bits.
Is this to be expected or is this a bug? I know that the fuse bits are special however I assumed that if they are accessible in then they should also be readable, or at the very least cause a panic.
Edit: When running in release mode the program does not hang, however I've noticed that the register values aren't consistent, E.g. printing the ext register in hex will make the low registers value 0, whereas printing it as a u8 will cause the low register to be 250.
The text was updated successfully, but these errors were encountered: