Bare-Metal MCU #5 - AVRDude and fuses

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 พ.ค. 2024
  • This is the fifth video in a journey from Arduino to STM8. The goal is to begin with Arduino, which is a popular platform to serve as a starting point. I'll then break it down into a fundamental level, and then apply those fundamentals to other microcontrollers, such as the STM8.
    This video focuses on what fuses are, and how they can be set using AVRDUDE. I also cover how to upload code to the microcontroller using AVRDUDE.
    Download AVRDUDE: www.nongnu.org/avrdude/
    Fuse Bit Calculator: eleccelerator.com/fusecalc/fus...
    ATMEGA328P Datasheet: ww1.microchip.com/downloads/en...
    ATMEGA328 Datasheet:
    ww1.microchip.com/downloads/en...

ความคิดเห็น • 62

  • @redwoodenjoyer
    @redwoodenjoyer ปีที่แล้ว +8

    Seriously good series. Nobody has coherently explained anything this well, useful for all microcontrollers because you broke it into actual pieces and skipped the confusing stuff.

  • @WaldoHazeleger
    @WaldoHazeleger ปีที่แล้ว +7

    I like this bare-metal series a lot. Would love to see you make an episode to replace delay() with the AVR timer.

  • @GrimReaperCalls
    @GrimReaperCalls 3 ปีที่แล้ว

    These are getting better and better, thanks a lot for making them!
    I would love to compilers next.

  • @asifjc
    @asifjc 10 หลายเดือนก่อน +3

    I just discovered your videos and I must say that you have done a splendid job. I am starting to explore Attiny10 and would appreciate some videos on programming these small devices.

  • @adaminsanoff
    @adaminsanoff 2 ปีที่แล้ว +2

    One could not explain it better. I am an experienced hobby programmer, yet I enjoyed the series. Thank you for putting these videos together, Mitch!

  • @shvideo1
    @shvideo1 2 ปีที่แล้ว

    What an awesome detailed and very informative video. Great information. Thank you for taking the time.

  • @mnavarrotube
    @mnavarrotube 2 ปีที่แล้ว

    Wow, this video is at a different level. Thank you so much

  • @CrazyMineCuber
    @CrazyMineCuber 2 ปีที่แล้ว

    Wonderful series! Please do more!

  • @martianzero2
    @martianzero2 3 ปีที่แล้ว

    These are great! Just watched all 5 and really clarified a bunch of concepts I’ve been trying to wrap my head around for the last few months. I’d also had a pro micro with a bad boot loader that I couldn’t fix following some other tutorials, but with your vids I was able to fill in some gaps that I was misunderstanding. I’d like to see stuff about samd21/51 if you’re ever inclined. Thanks!

  • @DRI1966
    @DRI1966 2 ปีที่แล้ว

    Thank You for making this video, you explain everything that I needed in a nutshell. Really well done 👍

  • @Thiselectron21
    @Thiselectron21 3 ปีที่แล้ว

    Awesome video! I would definitely be interested in learning more about cross compiling and ARM

  • @diegoamaya6353
    @diegoamaya6353 3 ปีที่แล้ว +2

    I think compilers would be a good follow up on the series before getting into another MCU, although I would love to see some other series using an ARM microcontroller. Also seeing the programming of IO interfaces is quite interesting, Uart and maybe I2C too, thanks for the videos btw

  • @ashoksingh4879
    @ashoksingh4879 2 ปีที่แล้ว

    You have huge knowledge sir. Awesome explanation. Love from India 🎉🎉

  • @draufunddran
    @draufunddran 3 ปีที่แล้ว +12

    ADC and UART without libraries would be awesome... I hope I'm not too late.

    • @MrVouligny
      @MrVouligny 2 ปีที่แล้ว

      on STM tooooo!!

  • @1fertube
    @1fertube หลายเดือนก่อน

    Excellent teaching!

  • @aviv931
    @aviv931 2 ปีที่แล้ว

    love your tutorials !

  • @formosabrowning3539
    @formosabrowning3539 2 ปีที่แล้ว

    The best explanation.

  • @proffirmanable
    @proffirmanable 2 ปีที่แล้ว

    Very inspiring and informative, thanks :)

  • @testme2026
    @testme2026 3 ปีที่แล้ว

    thank you, all works you are a star mate!

  • @user-mr3mf8lo7y
    @user-mr3mf8lo7y ปีที่แล้ว

    Amazing videos. Thanks a bunch.

  • @pbs570
    @pbs570 ปีที่แล้ว

    excellent, excellllllllent JOB!!!! Keep it up!

  • @aashutoshswami
    @aashutoshswami หลายเดือนก่อน

    I love your videos!!!!!! They are helping me understand my engineering course much better. Thank you so much!!!! Can you make a video on ADC and UART without libraries please ?

  • @metamud8686
    @metamud8686 ปีที่แล้ว +4

    5:03 actually you won't be getting an 8 MHz internal CRYSTAL oscillator, you will be getting an 8 MHz internal RC (resistor-capacitor) oscillator. No issue for what you're trying to achieve here, but there is a big difference in accuracy between an RC osc and an external, say, HC49 crystal with two 22pF caps.

  • @faxanidu3070
    @faxanidu3070 3 ปีที่แล้ว

    Yay you fixed it!

  • @underlecht
    @underlecht 2 ปีที่แล้ว

    Awesome.

  • @JBERGALIEN
    @JBERGALIEN 5 หลายเดือนก่อน

    Hello Mitch, I found out from Atmel ATTINY85 datasheet page 148 note 2. After this fuse has been programmed device can be programmed via high-voltage serial mode, only, so the best way to alternate is to use an HV fuse setter.

  • @konaprog
    @konaprog ปีที่แล้ว

    So great! Thank you. I never would have figured out that the "Arduino as ISP" was an emulated stk500v1 and that I needed to set the baud rate. This morning I was first time able to terminal mode talk to a scrap air conditioner control that uses an atmel325v. Question though, the end of the terminal session Safemode said the lfuse, hfuse, and efuse had been changed even though I was only looking at dumps. whats that about?

  • @jonathanstodden6029
    @jonathanstodden6029 3 ปีที่แล้ว +1

    Is there any slick was to fix the delays?
    Will running the microcontroller at 8 MHz instead of 16 MHz affect communication over uart?
    Thank you for all your great work so far. I'm really enjoying the videos.

  • @isaacatia-abugbilla2476
    @isaacatia-abugbilla2476 2 ปีที่แล้ว

    Great video. I am really learning a lot here. Just a quick question, could we say that avrdude is thus acting like an "external bootloader" since its basically doing what the boot loader does which is essentially to to act as an intermediary between my computer and the chip/arduino itself?

  • @adammontgomery7980
    @adammontgomery7980 ปีที่แล้ว

    I did some bare metal programming a while back and used #define F_CPU 8000000UL to get timer/counters working properly without halving everything.

  • @evolearner
    @evolearner 2 ปีที่แล้ว

    ADC and UART without libraries please!
    And Awesome Video Series...

  • @JBERGALIEN
    @JBERGALIEN 5 หลายเดือนก่อน

    Hello Mitch, and thank you for your knowledge and talent, I've just getting my feet wet about ATTiny85, and I wonder if it's better & faster to execute a line of code than having to build an HV fuse resetter , witch one is the best of the west. thank's again

  • @eheadj5712
    @eheadj5712 3 ปีที่แล้ว

    Perfect series. Thanks for sharing.
    A question. Now that you are using the 8mhz internal osc, would this barebone chip be able to correctly communicate with e.g. an nrf24l01 through the RF24 library? Or like delay things would get messed up?
    Thank you!

    • @eheadj5712
      @eheadj5712 3 ปีที่แล้ว

      @@MitchDavis2 Thank you so much for taking the time to do this!!! I will study your answer ASAP!

  • @tunckuyel
    @tunckuyel 3 ปีที่แล้ว

    i want to use modules without libraries. for example spi andi2c devices. but i guess before than i have to learn clock manipulations for using them or using interrupts.

  • @fusca14tube
    @fusca14tube 3 ปีที่แล้ว

    Hi Mitch. Awesome series! One question about security. Is there a way to protect your program against some dump technique? Maybe using this lock fuse? Can you explain it?
    THANKS!

    • @MitchDavis2
      @MitchDavis2  3 ปีที่แล้ว +1

      I haven’t used the lock fuses myself, so I’m not exactly sure what’s possible with them. I’m fairly certain you can make your write-protect, and read-protect it.
      Best place to answer this would be the ATMEGA328 datasheet, and just search for LOCK. It should tel you what all the combinations do.

    • @fusca14tube
      @fusca14tube 3 ปีที่แล้ว

      @@MitchDavis2 Thanks! I will look for it. Can I continuously set/unset/reprogram these fuses bit or it can be done only once? Can I brick the μc permanently setting up an invalid combination of these fuses?

    • @MitchDavis2
      @MitchDavis2  3 ปีที่แล้ว +2

      @@fusca14tube I always thought they were permanent, but according to the datasheet (i.imgur.com/ZVxTxTn.png), it looks like they can be reset ONLY with the chip erase command.
      That means you can “lock” the chip, and the only way to unlock it is to erase the whole chip.

    • @fusca14tube
      @fusca14tube 3 ปีที่แล้ว

      @@MitchDavis2 OK. Thanks for the reply.

  • @farzadbakhtiar
    @farzadbakhtiar 3 ปีที่แล้ว

    Hi Mitch. Quick question. I think the answer is yes but in this video you show using your ICSP programmer while the 328p is seated in the Uno but presumably you can use the programmer with the 328p on the breadboard by wiring your programmer to the board, right?

  • @robinwilliams5348
    @robinwilliams5348 2 ปีที่แล้ว

    This video has been SO useful, thank you so much!
    Is this correct please - My understanding is that I don't need to upload the bootloader to my chip at all. Using avrdude I can set the fuses and the flash the binary without putting a bootloader on there at all. Am I able to do it all in the same command or must they be done separately?
    I'm thinking to write the command in this order: burn the Extended, High, and Low fuses, flash the binary and then finally set the lockbits.
    I want to set lockbits to 0x00 (I think) such that the chip cannot be read or rewritten as much as one is able to. All it can do is execute the binary unless the entire chip is erased.
    Thanks again for your useful videos!!!!

    • @MitchDavis2
      @MitchDavis2  2 ปีที่แล้ว +1

      It’s been a while since I made this, so take this response worth a grain of salt.
      You should be able to chain everything together in one command. You are correct that you don’t need a bootloader at all. Sometimes they’re nice to have, and other times it’s nice to have a little bit extra program space for your code.

    • @robinwilliams5348
      @robinwilliams5348 2 ปีที่แล้ว

      Thank you so much for taking the time to reply. Cheers!!

  • @rompipelotas
    @rompipelotas 2 ปีที่แล้ว

    i think if you use avrdudess..it is much simpler ..thank you for your explanations ............

  • @Arceus3251
    @Arceus3251 ปีที่แล้ว

    Greets! I have to start off saying: Fantastic series thus far c: Easy for me to understand, granted I already have a background in computer science.
    However, I appear to have run in to a snag, unsure if anyone else had this issue. I'm attempting to write my fuses, but AVRDude fails to check the signature of my target. I get the same error in the Arduino IDE. I BELIEVE my connections are solid, sort of frustrating. ^^"
    Edit: Turns out my connections WERE good, it looks like the SCK pin on my target board is fried. Big sad. Gonna continue with the ATTiny85, seeing as there's a tutorial down the road for that

  • @GuruTimCreates
    @GuruTimCreates ปีที่แล้ว

    Ok. Forget my last comment on video 4. Now I see that bare metal

  • @henkoegema6390
    @henkoegema6390 ปีที่แล้ว

    Very well done. 👍
    Q: I have installed avrdude via the command line in Ubuntu22.04. (no Arduino IDE). Where is avrdude.conf? (for the -C parameter)?

    • @henkoegema6390
      @henkoegema6390 ปีที่แล้ว

      Yesterday I could not find it, but today I could. 🙂 It is in /etc.
      I really enjoy your videos.

  • @gyaviratuz2029
    @gyaviratuz2029 2 ปีที่แล้ว

    Can we learn how to use the EEPROM programmers

  • @JohnDavidDunlap
    @JohnDavidDunlap 3 ปีที่แล้ว +1

    ENHANCE

  • @EvilSapphireR
    @EvilSapphireR 6 หลายเดือนก่อน

    At 20:29, if i understand correctly, the arduino as ISP is using the serial programming interface to write the compiled hex of the blink sketch to the flash, and NOT using the STK protocol to write the hex to the flash (which would require the programmed arduino to have a bootloader present), correct? So the stk500 naming avrdude gives to the 'arduino as ISP' is just a naming, and not the actual communication protocol being used by the programmer Arduino. Also, why is there no need of the -P flag when avrdude talking to the usbtiny programmer? Is it because avrdude talks to the usbtiny over usb port? But even when using a second arduino as isp, we connect it to the pc over usb too, so I'm not exactly sure about the difference.

  • @JJSogaard
    @JJSogaard 2 ปีที่แล้ว

    Why didn’t I know about the programmer calculator?!? I normally use a Python shell to convert, but this is much better!

  • @plamenpetkov7132
    @plamenpetkov7132 ปีที่แล้ว

    Тwo new ATMEGA328P (DIP28) from Ali are not seen by USBasp programmer (no response from target in SinaProg).
    Normal consumption (11 mA), no oscillations at 8 MHz crystal resonator, no help with external force fed clock to XTAL1 (tried 8MHz, 16 MHz). Another two in (quad flat pack in Nano) show the same no clock and no response to force fed clock. Do all 4 chips face the bin?

  • @chiraggoyal7637
    @chiraggoyal7637 3 ปีที่แล้ว +1

    Nice video. I've seen all 5 videos of Arduino to STM. It'd be great if instead of teaching many controllers you move towards getting better at a single controller and lead to making projects. Thank you

  • @douglasthomson1989
    @douglasthomson1989 ปีที่แล้ว

    Hi Mitch. really enjoyed this series so far and have learned alot. However, not quite sure what I've done with a couple of Arduinos nano's i seem to have bricked. They both communicated with AVRDUDE just fine when they were Arduinos and reported what they were perfectly. I've sent a little fuse (only) command to them from AVRDUDE to use the internal RC clock, and as soon as I went back to make sure they were all still good, I get the rc=-1 error, and they now won't communcate at all. It's defo not the wiring. I know I've screwed up somewhere...just not exactly sure where. Any ideas? My fault for messing with the fuses I guess. Looked so simple when you were doing it.

    • @MitchDavis2
      @MitchDavis2  ปีที่แล้ว

      Are you able to reset the fuses to their defaults, or is avrdude not communicating anymore?

    • @leNnard_
      @leNnard_ 27 วันที่ผ่านมา

      I ran into the same problem on my ATTINY, and figured out how to fix it consistently. If you're still looking to un-brick your NANO let me know!

  • @cheapmod
    @cheapmod ปีที่แล้ว

    You start to sound like Morpheus in this series

  • @reshadrei1788
    @reshadrei1788 ปีที่แล้ว

    where is the video of using UART without library

  • @douglasthomson1989
    @douglasthomson1989 ปีที่แล้ว

    Sorry, I mean LOW fuse...not little fuse.