Editing Boot Loader Arduino 328P 16Mhz 5V - Page 1
Forum section: electronics / general

author: Kalari
author_rank: Newbie
timestamp: March 22, 2014, 05:44:26 am
content: My project contains a module which reads memory (SRAM) values of a device during start up (When Power is ON or reset button is pressed). So what I did was , I tried to edit the boot-loader of Arduino Atmega 328P 16 Mhz 5vThe boot-loader called Optiboot downloaded fromhttp://code.google.com/p/optiboot/. What I did was, I edited the Optiboot.c file available in the downloaded files with necessary header files, compile it using AVR studio4 and get the hex code. This hex code is burned into arduino device. I have attached the screen short of AVR studio developer window along with this mail (Screen shot titled AVR Studio.PNG).My problem is, when I burn the edited boot-loader file into device it is not working.My bootloader size is about 778 bytes(shot titled Boot loader size). Is this the problem.Another problem is the BAUD_ERROR is always showing greater than 5% error( Screen shot titled ERROR.PNG).. Also could you please give me what is my fuse settings. Is I am going in the right direction.Hope you will definitely help me to sort out this issues.

author: westfw
author_rank: Super Contributor
timestamp: March 23, 2014, 12:02:40 am
content: Can we keep this conversation on one forum? I thought we were making reasonable progress over at AVRFreaks (http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=141279), but I don't want to chase you all over the internet to collect the pieces of what you've done.

author: zapta
author_rank: Super Contributor
timestamp: March 23, 2014, 10:01:06 pm
content: Quote from: westfw on March 23, 2014, 12:02:40 amDo you say that we should register to AVRFreaks to answer his question?

author: zapta
author_rank: Super Contributor
timestamp: March 23, 2014, 10:13:30 pm
content: Quote from: Kalari on March 22, 2014, 05:44:26 am1. What exactly you want to achieve? Reading in your program the initial value of some ram bytes?2. Are you using an arduino board? What kind? What bootloader did it come with?3. You can use the arduino tools to build the boot loader, here are some instructions,http://angryelectron.com/how-to-update-the-bootloader-on-arduino-pro-mini-328/you can find more help on the arduino forums. If your board is not an Arduino you can still make it looks like one. My boards for example look like Arduino Pro Min 16Mhz 5V (a very basic 382P based board) such that all the arduino tools work with it.Using the original tool chain to rebuild the bootloader is your best chance.

author: westfw
author_rank: Super Contributor
timestamp: March 24, 2014, 12:49:25 am
content: QuoteYou can do whatever you want. I'm somewhat pissed that after several people started helping him over there (~12 messages exchanged on or before 21-mar), he seems to have reverted to the original question here (on 22-mar.)

author: Kalari
author_rank: Newbie
timestamp: March 25, 2014, 06:28:17 am
content: i dont know where i am stuck..but i will concentrate here..its very good site...sry westfw...as my project deadline is end of next week..that's why i just used every resources i got..Quoteya reading around SRAM power up values.Arduin UNO R3 with atmega 328P MC 16Mhz 5v. i used optiboot from google.

author: zapta
author_rank: Super Contributor
timestamp: March 25, 2014, 12:43:44 pm
content: 1. Is optiboot is the loader that comes stock with your board? Your safest bet would be to modify a bootloader that is known to work.2. Assuming the bootloader you want is optiboot, have you tried to build the optiboot that comes with the Arduino IDE? It come with command line scripts to build. Check Resources/Java/hardware/arduino/bootloaders/optiboot/README.TXT in the Arduino installation directory.

author: Kalari
author_rank: Newbie
timestamp: March 26, 2014, 08:21:05 am
content: yes my friend..i used the one that come along with arduino...how to burn the hex file to arduino board along usb. Did avrdude will do the job for me. how to set the fuses and all.

author: zapta
author_rank: Super Contributor
timestamp: March 26, 2014, 10:02:16 pm
content: Quote from: Kalari on March 26, 2014, 08:21:05 amI do it via the ICSP pins. The command looks like this one (this is for a 328p 16Mhz 5V Arduino Pro Mini look alike).https://github.com/zapta/linbus/blob/master/analyzer/firmware/icsp_program_all.sh(sometimes I need to run it twice to work, possibly I need to separate the fuse programing from the flash programming, not sure).

author: Kalari
author_rank: Newbie
timestamp: March 28, 2014, 09:26:16 am
content: Fine it worked...the problem was with 512 bytes limitation i made it 1 kbytes as westfw said. Now i am writing memory values to uart. but the memory values are not random is the following code correct.#define RAMSTART (0x100)//for atmega328Quotei am getting 3e 05 as output all the locations. i wrote the function write after main function in otiboot.c file.

author: westfw
author_rank: Super Contributor
timestamp: March 28, 2014, 04:25:00 pm
content: Well, if you WRITE the ram and then reset, do you get the values you've written dumped?