stock Arduino UNO configuration

Hello, I am very new to Arduino boards, IDE, and the AVR chips. I've just recently acquired a UNO board (R3) and I am diving into the details of how it works. I haven't seen the following written anywhere but I have preliminarily deduced the following about the R3 UNO board as it comes new: - it has the optiboot bootloader - the optiboot bootloader does not support all of the avrdude functions - in particular the fuse queries - the BOOTRST option must be set to direct the RESET to 0x7E00 (3F00) location. I deduce this because the 0x0000 RESET vector location in flash gets re-written every time a use the IDE to store a new program.

I don't think I can definitively [u]know[/u] the above without having a separate programmer to read the MCU flash, etc with avrdude (e.g) since the stock bootloader does not support the query of the fuses.

Do I have all this correct? Sorry if this is all answered somewhere else. I'm overwhelmed with search results at the moment.

TheGipp

The bootloader doesn't implement the whole STK500V1 protocol because it doesn't have to. The fuses are set once as part of the Burn Bootloader process and after that the bootloader only needs to write sketches into the application portion of FLASH.

To see how the IDE sets the fuses when you burn a fresh bootloader (using an ISP device) you can look at the 'boards.txt' file. Here is the part of the UNO:

uno.name=Arduino Uno uno.upload.protocol=arduino uno.upload.maximum_size=32256 uno.upload.speed=115200 uno.bootloader.low_fuses=0xff uno.bootloader.high_fuses=0xde uno.bootloader.extended_fuses=0x05 uno.bootloader.path=optiboot uno.bootloader.file=optiboot_atmega328.hex uno.bootloader.unlock_bits=0x3F uno.bootloader.lock_bits=0x0F uno.build.mcu=atmega328p uno.build.f_cpu=16000000L uno.build.core=arduino uno.build.variant=standard

Many Thanks! This confirms another thing : "programmed" in the case of BOOTRST means the bit is 0 (as the datasheet is very clear) and it means the BOOTRST functionality is active when the bit is 0 - as opposed to 1 which is what I had casually thought was the active state.

Now it all makes sense to me how the stock UNO (R3) boots up and gets running.

Do you have any general advice on when to read an address as a WORD address as opposed to a byte address? I find myself doubling addresses sometimes to see if things make sense.

TheGipp

I think that only FLASH/Program memory is addressed in words.

You’d think that would mean that the SPM and LPM instructions would use word addresses but LPM uses the low bit of the Z register to pick a byte to load. The SPM instruction requires that bit to be 0 because it always stores a word (R1:R0).

That leaves the jump and call instructions as being the only ones that use work addressing.