Saturday 21 June 2014

avr - avrdude -B 3 parameter


I'm new to AVR programming, I got this atmega8A chip and I use avrdude with a USBasp that I made myself, for programming it.


For some reason the chip won't answer if I don't use the -B 3 parameter with avrdude, although I have reset the chip's fuse bits to factory defaults.


Now my question is what is this -B 3 parameter and how can I fix this.



Answer




From the documentation:


-B bitclock
Specify the bit clock period for the JTAG interface or the ISP
clock (JTAG ICE only). The value is a floating-point number in
microseconds. The default value of the JTAG ICE results in about
1 microsecond bit clock period, suitable for target MCUs running
at 4 MHz clock and above. Unlike certain parameters in the
STK500, the JTAG ICE resets all its parameters to default values
when the programming software signs off from the ICE, so for MCUs
running at lower clock speeds, this parameter must be specified on

the command-line. You can use the 'default_bitclock' keyword in
your ${HOME}/.avrduderc file to assign a default value to keep
from having to specify this option on every invocation.

In my opinion this means it is not so much a 'fix', but regular setting to adjust the clock of the programmer to the clock of the receiving controller. If my memory serves me right, a factory default ATmega8 runs at 1MHz, whereas avrdude is set for 4MHz by default and thus your programmer is just too fast for your controller to keep up. This implies that when you change the clock fuses of your controller, a different -B is required for programming it.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...