I Develloped a complete new bootloader for Arduino boards wit a ATTMEGA328(P)(B) Processor
that in compatible with OPTIBOOT, but has much more possibilities:
- Supports Both FLASH an EEPROM Programming
- Uses a Smart Write, Data is only written when different from original Data
- Reads Fuses and ID Bytes from the chip, does not use pre-programmed values
- Auto Sets the Lock bit for protecting the Bootloader from overwriting
- Allows a max program size of 32.256 Bytes, against 30.720 with OptiBoot
- Has a User Entry to use the Bootloaders EEprom and Flash Read and Smart Write functions
allowing the User Application to read and (Smart) Write Pages to Flash and EEprom
- Completely written in Assembler, only 256 Words (512 Bytes)
- Has been tested with Baudrates up to 1 Mbps, for really fast programming
The complete project is posted at Github as jfbron/Assyboot
This projects is complete with a library assytool, with the user interface with 4 function calls:
- (Smart) Write a Page to Flash
- (Smart) Write a page to EEprom
- Read a page from Flash
- Read a Page from EEprom
The Demo AssyDemo is an Arduino Project for a Arduino with a AtMega328(P)(B) chip, so it also works with the Elektor Arduino R4 board. These boards are still popular for builders of DCC Function decoders for modeltrains,
Also on Github the Souce file, and two compiled files, one running on a 115k2 Baudate (using a 16 MHz Xtal) and one running at a Baudrate using a 1000K Baudrate, for fast programming.
After programming (see the notes on Fuse and LOCK Bytes, the later one must be left unprogrammed) the 115K2 version is a direct replacement for the Optiboot.
However with small changes in the boards.txt file, user can also create an extra entry for a version with the 1000 Mbit Baudrate and/or a larger program space (32256 Bytes).
All documentation is included in the source, Assydemo and assytool files.
I think that many users will be happy to use this Bootloader, since it is the only way to Write to Flash from a user program, and the Smart Write feature also protects the chip by reducing the number of Writes, since the total writecycle count for bothe Flash and EEprom is limited, and writing is slow.
So Smart Write will in many cases also speed-up writing, or even skip writing when trying to write the same data twice.
The Demo Program will show the actual timing for writing pages to Flash and EEprom.
Discussion (0 commentaire(s))