This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Arduino Uno motor.ino bad_fuses
#1
I am using an arduino nano with pypilot and it works fine.
I am using a motor controller that fits directly onto an original arduino Uno, so I flashed it with motor.ino
Another pro of the UNO is that they have mounting holes, and the NANO does not.

I am getting the BAD_FUSES flag, the same on you sometimes get when you have a non original clone of the nano.
I order some more UNO's just to be sure it was indeed original, so I have the feeling it is indeed original but that I now have to deal with the efuses.

In the past I have already tried resetting fuses on a nano, which I am scared to do again now  Sad (broke too many...)
Can somebody help me answer these questions? Thanks in advance!

- How do I read the fuses of the UNO?
- Can I put those values somewhere in the code of motor.ino?
- Is setting the efuses the only way to correct the issue? 
- What are the exact steps of setting the efuses in a UNO so that the BAD_FUSES flag is removed?
- Is the BAD_FUSES flag blocking?
- Is there an alternative sollution to "bypass" the bad fuses flag?

Hope someone can help! Thanks!

Jamos
Reply
#2
The fuses are read in motor.ino
Yes, look where it sets the BAD_FUSES flag, and probably you want to use ifdefs for your processor. You might want to compare what the fuse differences actually are.
You can set fuses with avrdude, it's documented in the README
The BAD_FUSES is a warning. Mostly if the BOD isn't enabled the memory eventually will get corrupted.
You could ignore it/comment it out fix the fuses etc..
Reply
#3
Thanks Sean.

Tried reading the fuses with AVRDUDE on the terminal using:

avrdude -c avrisp -b 19200 -P /dev/ttyUSB0 -u -p m328p -U hfuse:r:-:h -U lfuse:r:-:h -U efuse:r:-:h -U lock:r:-:h

My arduino is on /dev/ttyUSB0 (checked in openplotter) but it gives me the error:

avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00

Thought I'd unassign the Arduino from "Pypilot" to "None" in the serial tab and do a sudo reboot, but this has no effect.
After knowing for sure I use the correct serial port, I thought maybe it is the baudrate. Changed this from 19200 to 57600 but also not effect.

Any idea's?
Reply
#4
Sorry, my bad. Needed two ATMEGA processors to read the fuses. Worked now.

Ok, my fuse settings are:


Code:
Reading | ################################################## | 100% 0.07s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading hfuse memory:

Reading | ################################################## | 100% 0.01s

avrdude: writing output file "<stdout>"
0xde
avrdude: reading lfuse memory:

Reading | ################################################## | 100% 0.02s

avrdude: writing output file "<stdout>"
0xff
avrdude: reading efuse memory:

Reading | ################################################## | 100% 0.02s

avrdude: writing output file "<stdout>"
0xfd
avrdude: reading lock memory:

Reading | ################################################## | 100% 0.02s

avrdude: writing output file "<stdout>"
0xf



And in the motor.ino I found:

   
Code:
// read fuses, and report this as flag if they are wrong
    uint8_t lowBits      = boot_lock_fuse_bits_get(GET_LOW_FUSE_BITS);
    uint8_t highBits     = boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS);
    uint8_t extendedBits = boot_lock_fuse_bits_get(GET_EXTENDED_FUSE_BITS);
    // uint8_t lockBits     = boot_lock_fuse_bits_get(GET_LOCK_BITS); // too many clones don't set lock bits and there is no spm
    if(lowBits != 0xFF || highBits != 0xda ||
       (extendedBits != 0xFD && extendedBits != 0xFC)
       // || lockBits != 0xCF // too many clones don't set lock bits and there is no spm
        )
        flags |= BAD_FUSES;

So, before I make any mistakes, what should the code look like?
Or should I rather change the fuses on the Arduino itself?

If I should change the fuses on the arduino, would this mean flashing to these values?

0xda
0xff
0x5
0xf
Reply
#5
it is confusing because avrdude reports different values from what is read in the program. The difference is the bits you can't set.

From what I can tell your hfuse is de and should be da, but maybe you have a larger bootloader?? In this case you can just ignore the BAD_FUSES flag or change it the code so it looks for de
Reply
#6
Thanks!

Changed da to de in motor.ino, bad fuses flag is gone and pypilot running SYNC.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)