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
efuse on arduino
#1
Hello,

I've just bought new arduino nano.
The efuse on them is not
0xda
0xff
0x5
0xf


But
0xda
0xff
0xfc
0xcf

So i've bad efuse on pypilot.
I've tried both with usbasp or arduino isp, I can change the efuse, for example for 0xFE, but not for 0x5 or 0x4 like in the readme.
So i've bad fuses error.

Regarding this https://forum.arduino.cc/index.php?topic=418607.0 it seem that 0xfd is exactly like 0x5. So i've set it to 0xfd.

For the moment, i've run with
#define DISABLE_TEMP_SENSE    // if no temp sensors avoid errors
#define DISABLE_VOLTAGE_SENSE // if no voltage sense
#define DISABLE_RUDDER_SENSE  // if no rudder sense

But in the pypilot client, i've the SYNC OVERCURRENT BAD_FUSES
Is it because of my fuse ? I've spend almost 2 hours on this problem without solution, i don't know why fuses are so important but do you think you can edit pypilot to accept 0xfd ?

Thanks !
Reply
#2
Did you use the correct version of AVRdude? See post #1 on this thread: https://forum.arduino.cc/index.php?topic=481180.0

As far as I understand you have to program them the same as a genuine Arduino. Fuses are setting things like clockspeed, which is pretty important for working right of course. But don't know anything more about it, so would love to learn as well.
Reply
#3
I had the same problem.

I finaly solved it programming the fuses on the nano with the  Raspberry Pi.

Just don´t remember exactly how but here is the link that helped me:

https://learn.adafruit.com/program-an-av...s?view=all


You have to connect 6 cables from the arduin (5v, gnd, mosi, miso ......) to the GPIO Pins of the PI

Important is that the GPIO-Pins are the ones that are defined by the AVRdude programm on the PI.



I also uploded the motor.ino scetch in HEX with the AVRDUDE.

Good luck and save sailing

Andreas
Reply
#4
Hello, Thanks for your help.

The link seem to confirm that 0xFD is 0x5 on 328p.

I've just look the code on pypilot:

// 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);
if(lowBits != 0xFF || highBits != 0xda ||
(extendedBits != 0xFD && extendedBits != 0xFC) || lockBits != 0xCF)
flags |= BAD_FUSES;


So regarding this code, good fuses are

0xda
0xff
0xfd or 0xfc
0xcf

My lock bits are ff insead of cf so I change them.
Now, my servo.flags are "sync".
I must have look in the code instead of the doc it would have same me some hours Smile


But my helm still don't move. I use a brushed esc: https://hobbyking.com/fr_fr/hobbywing-qu...a-esc.html

In boat and crawler mode, it should have full speed reverse.
In the ESC manual, it's written that 3 shorts bip detect 3s lipo (that what i've from my desk 12v power supply), and 1 long beep self test and throttle range calibration (start with throttle in neutral). I've not the long beep so i think the esc don't get any signal. One time I got the long bip, then the helm start to move randomly, so I think the connection are good Smile

Not sure how i've to wire it. I've wired the 6 pin to 5v, and the 9 digital pin to the esc white wire (pwm). Not connected the 2 other wires of the esc. I've no sensors but disabled them in the code.

Does pypilot start sending "standby" signal to pwm even if disabled ? (for esc calibration ?).

Thanks !
Reply
#5
This time it was my fault Smile
I've just grounded all analogic pins, it look a lot better ! Now i've to try it in my boat Smile

Edit after some tests:

The esc need to be connected to pwm and ground
All analogue pins need to be grounded, as described
Every time I flash, lock pin is back to FF, i need to rewrite it. Is it important that it's CF or FF can be added to the code ?
My esc need to be in crawler mode for full speed front and backward.
I need to uncomment the good #define to disable sensors.
pin 6 need to be connected to +5v, not sure about 3,3v.

Now, i just need to test, and then if all is ok, I will add the windvane, the sensors (temperature, shunt for current, and tension).
I will use this remote for m5stack to control it: https://github.com/PepeMax/Raymaxime-display
Reply
#6
flashing may reset the fuse, but programming with the bootloader should not.

If you look at the bits, they protect the bootloader from being corrupted by the application. Some of the other fuse bits are needed to protect the device from data corruption. I have seen it corrupted then proved the data could be reliably corrupted if the bits are set wrong when I added this test and the flag.

So if you think you wasted some hours I think I have more Smile
Reply
#7
If the pilot work, the "wasted" hours will be certainly very good spent time (because it will save at $1000 on buying a new pilot).
Moreover, i prefer spend some time and having something open that i can improve and repair myself, so thanks for your contributions Smile

When I will have tested all, i think I will try to contribute to the documentation.
Reply
#8
I have the same problem / error, did you get yours working in the end?
I see that some fixes seemed to help, but before I try I just want to verify:

- Using the right AVRDude version. I use Arduino IDE to upload the sketch.
- Changing motor.ino to include the correct this part?

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;

if so, how do I find out what the correct addresses are? I have looked on http://www.engbedded.com/fusecalc but unsure of what to select.
I hope that the examples in https://forum.arduino.cc/index.php?topic=381331.0 and in https://forum.arduino.cc/index.php?topic=380646.0 are not the case.

- Changing scripts on the Raspberry
- Grounding all analog pins

Are all of these necessary, or either one of those?
Reply
#9
The bad fuses is really just a warning to let you know the fuses aren't set right. For example, the brown out detector might not be enabled which means eventually the flash can get corrupted if the power supply is poor quality.

You can set the fuses manually with avrdude, a lot of arduino clones don't have them set correctly.
Reply
#10
Thanks Sean, nice to meet you I have been following your work for a while now. Compliments!
I am using this instruction https://learn.adafruit.com/program-an-av...s?view=all
I have connected succesfully and verified with sudo avrdude -p atmega328p -C ~/avrdude_gpio.conf -c pi_1 -v

Now, I just need to know what to do now. I am unsure what correct fuse settings are and how to change it with AVR dude.
I've tried the instructions from https://forum.arduino.cc/index.php?topic=71580.0 and I was able to change the fuses succesfully.
However, after that I cannot flash it anymore with Arduino IDE sketch.

I have tried various fuse settings sugested in the previous mentioned link, but unsuccesfully.
USB is recognized succesfully still when I connect to the laptop, and a separate raspberry pi communicates through the GPIO is also OK.
It just doesn't flash anymore with the error:

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

I am not sure what to do now, do I:

- Upload a new bootloader?
- Which settings do I need for my Arduino Nano (for the fuses)

Hope you can help again.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)