Comments (8)
Hi!
Yes, it's common. I have a USBasp that has a clock frequency of 384kHz. This does not work with clocks lower than ~1.5MHz.
The -B flag is the clock divider. I often use -B32 when programming really slow microcontrollers.
MiniCore don't have a set of "slow" programmers, but you can install MicroCore if you want a permanent option in the programmers list.
from minicore.
Thanks for the answer. I now understand that my workaround solution by adding the -B 5 separately did not solve the whole problem. It only sets the fuses. I suppose that the actual upload of the bootloader is a second step that I never reach since the first step fails in the Arduino IDE. Can you from the command line below figure out a command line that would let me upload the bootloader?
K:\Dur2k_D\Download\Programmering\Arduino\ArduinoIDE\hardware\tools\avr/bin/avrdude -CC:\Users\Admin\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.0.0/avrdude.conf -v -patmega328p -cusbasp -Pusb -e -Ulock:w:0x3f:m -Uefuse:w:0xfe:m -Uhfuse:w:0xd6:m -Ulfuse:w:0x62:m -B 5
As I understand it, the MicroCore is not possible to use with the 328P?
from minicore.
It depends on where you added -B5. When you hit Burn bootloader you're actually issuing two avrdude commands. The first one sets the fuses, and the second one loads the bootloader hex file. You'll need to add -B5 (or -B8, -B16, -B32) to both commands. This can be done by modifying the platform.txt file.
My programmer menu looks like this. I select one of the slow programmers when I'm dealing with clocks < 1 MHz.
from minicore.
Thanks! My problem is that since the first fails the second command is never shown.
I have now tried to modify almost every platform.txt on my computer. I found yours in: C:\Users\Admin\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.0.0\platform.txt
I guess the line to modify starts with tools.avrdude.bootloader.pattern=
But no matter what I change the outcome is the same. I will now try to install MicroCore to see if that gives me the possibility to run USBasp slower. for MiniCore.
from minicore.
Installing MicroCore gave access to more programmers, including slow USBasp, in MiniCore.(sorry for not understanding that from your first instruction). Now I could flash the bootloader. Without bootloader my program started immediately after boot (of course), now the built in LED flashes twice and there is a 1200ms delay before it starts. Me happy again.
from minicore.
Using MicroCore's USBasp(slow) only works for uploading bootloader and setting fuses. It does not work for uploading sketches.
USBasp(slow) fails with "avrdude: ser_open(): can't open device "usb": The system cannot find the file specified."
C:\Users\Admin\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/bin/avrdude -CC:\Users\Admin\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.0.0/avrdude.conf -v -patmega328p -carduino -Pusb -B32 -Uhfuse:w:0xd6:m -Ulfuse:w:0x62:m -Uflash:w:D:\Temp\arduino_build_455783/Blink.ino.hex:i
USBasp fails with "error: program enable: target doesn't answer. 1" (because programmer runs too fast)
C:\Users\Admin\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/bin/avrdude -CC:\Users\Admin\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/etc/avrdude.conf -v -patmega328p -cusbasp -Pusb -Uflash:w:D:\Temp\arduino_build_455783/Blink.ino.hex:i
Could adding '-B32' for any MCU that runs at 1MHz or slower solve this problem? I think these problems and solutions are worth mentioning in the documentation.
from minicore.
If your USBasp looks like this, you can just short out JP3 in order to physically slow down the clock.
It's generally not a good idea force -B32 when selecting 1 MHz. This may end up with two -B flags (-B2 -B32) for instance, and avrdude would not know what to do.
Here's the commands that Arduino IDE runs when I select USBasp (slow) and burns bootloader for ATmega328P for 1 MHz internal oscillator
/Users/Hans/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino12/bin/avrdude -C/Users/Hans/Documents/Arduino/hardware/MiniCore/avr/avrdude.conf -v -patmega328p -cusbasp -Pusb -B32 -e -Ulock:w:0x3f:m -Uefuse:w:0xfd:m -Uhfuse:w:0xd6:m -Ulfuse:w:0x62:m
[Fuses OK, avrdude OK]
/Users/Hans/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino12/bin/avrdude -C/Users/Hans/Documents/Arduino/hardware/MiniCore/avr/avrdude.conf -v -patmega328p -cusbasp -Pusb -B32 -Uflash:w:/Users/Hans/Documents/Arduino/hardware/MiniCore/avr/bootloaders/optiboot_flash/atmega328p/optiboot_flash_atmega328p_UART0_9600_1000000L.hex:i -Ulock:w:0x0f:m
[Hex OK, avrdude OK]
Heres the command when uploading a program using USBasp (slow) for a 328P running at 1 MHz:
/Users/Hans/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino12/bin/avrdude -C/Users/Hans/Documents/Arduino/hardware/MiniCore/avr/avrdude.conf -v -patmega328p -cusbasp -Pusb -B32 -Uhfuse:w:0xd7:m -Ulfuse:w:0x62:m -Uflash:w:/var/folders/2f/bk0yr6zx4290kvkss8ty0gxc0000gn/T/arduino_build_930771/Blink.ino.hex:i
[Hex loaded, avrdude OK]
from minicore.
A jumper in JP3 solved the problem for me. It is very slow but it works reliable.
Flashing bootloader with jumper takes 8 seconds (no matter if I run USBasp or USBasp(slow)
Flashing ArduinoISP (largest example I could find at about 5kB) takes about 72s using USBasp with JP3 attached. Flashing the same code using serial 9600bps took about 17 seconds.
Now I am hopefully finished exploring this (to me) new tool and can start working. :)
Thanks!
from minicore.
Related Issues (20)
- Clock options for ATMega328P are ambiguous HOT 1
- Not able to burn bootloader to Atmega88PB HOT 6
- MCUSR always reports 0 at startup HOT 13
- [feature] New 9.216MHz to Supported clock frequency. HOT 1
- Optiboot backward compatibility HOT 6
- Syntax Error HOT 11
- Trying to enlarge pinout diagrams in README fails with 'Non-Image content-type returned' HOT 2
- MiniCore Burn Bootloader - Not Working on M3 MacBook Pro HOT 5
- Warnings with TimerInterrupt library
- is LGT8F328P supported ? HOT 1
- Fails to compile Strings declared empty on Atmega328PB HOT 3
- Internal Pull up error mega328 HOT 3
- Adding `-B 4` by default to `avrdude` HOT 2
- ATmega328PB and the PWM output PB1, PB2 and PB3 HOT 2
- burn bootloader to mega88 fail HOT 1
- Boot time atmega168pb HOT 2
- Uploading error : given error when upload to Arduino UNO r3 using mobile app Arduino studio on HOT 1
- Not compile error "Compilation error: 'LED' does not name a type" Atmega168 include CPP with class declaration. HOT 2
- ATmega328PB and port PC2 problem HOT 5
- sir,i saw a problem with hfuse for atmega328p with bootloader running on internal(8MHz) and also for external(16MHz) oscillator HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from minicore.