Author Topic: Editing Boot Loader Arduino 328P 16Mhz 5V  (Read 7091 times)

0 Members and 1 Guest are viewing this topic.

Offline KalariTopic starter

  • Newbie
  • Posts: 4
Editing Boot Loader Arduino 328P 16Mhz 5V
« on: March 22, 2014, 05:44:26 am »
                                                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 5v 
                                              The boot-loader called Optiboot downloaded from http://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.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4382
  • Country: us
Re: Editing Boot Loader Arduino 328P 16Mhz 5V
« Reply #1 on: March 23, 2014, 12:02:40 am »
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.
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6316
  • Country: 00
Re: Editing Boot Loader Arduino 328P 16Mhz 5V
« Reply #2 on: March 23, 2014, 10:01:06 pm »
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.

Do you say that we should register to AVRFreaks to answer his question?
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6316
  • Country: 00
Re: Editing Boot Loader Arduino 328P 16Mhz 5V
« Reply #3 on: March 23, 2014, 10:13:30 pm »
                                                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 5v 
                                              The boot-loader called Optiboot downloaded from http://code.google.com/p/optiboot/

1. 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.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4382
  • Country: us
Re: Editing Boot Loader Arduino 328P 16Mhz 5V
« Reply #4 on: March 24, 2014, 12:49:25 am »
Quote
Do you say that we should register to AVRFreaks to answer his question?
You 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.)
 

Offline KalariTopic starter

  • Newbie
  • Posts: 4
Re: Editing Boot Loader Arduino 328P 16Mhz 5V
« Reply #5 on: March 25, 2014, 06:28:17 am »
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..

Quote
1. 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?

ya reading around SRAM power up values.
Arduin UNO R3 with atmega 328P MC 16Mhz 5v. i used optiboot from google.

« Last Edit: March 25, 2014, 06:48:10 am by Kalari »
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6316
  • Country: 00
Re: Editing Boot Loader Arduino 328P 16Mhz 5V
« Reply #6 on: March 25, 2014, 12:43:44 pm »
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.
 

Offline KalariTopic starter

  • Newbie
  • Posts: 4
Re: Editing Boot Loader Arduino 328P 16Mhz 5V
« Reply #7 on: March 26, 2014, 08:21:05 am »
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.
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6316
  • Country: 00
Re: Editing Boot Loader Arduino 328P 16Mhz 5V
« Reply #8 on: March 26, 2014, 10:02:16 pm »
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.

I 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).
 

Offline KalariTopic starter

  • Newbie
  • Posts: 4
Re: Editing Boot Loader Arduino 328P 16Mhz 5V
« Reply #9 on: March 28, 2014, 09:26:16 am »
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 atmega328
Quote
uint8_t *i;
for(i=(uint8_t *)(RAMSTART+20);i<(uint8_t *)(RAMSTART+64);i++)
//some 32 memory locations
{
putch(*i);
}

i am getting 3e 05 as output all the locations. i wrote the function write after main function in otiboot.c file.
« Last Edit: March 28, 2014, 09:28:03 am by Kalari »
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4382
  • Country: us
Re: Editing Boot Loader Arduino 328P 16Mhz 5V
« Reply #10 on: March 28, 2014, 04:25:00 pm »
Well, if you WRITE the ram and then reset, do you get the values you've written dumped?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf