Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
wbmarvin
PostPosted: Feb 08, 2011 - 09:36 PM
Newbie


Joined: Feb 08, 2011
Posts: 9


Ok so how does one obtain a copy of this miraculous document?
 
 View user's profile Send private message  
Reply with quote Back to top
wbmarvin
PostPosted: Feb 08, 2011 - 09:37 PM
Newbie


Joined: Feb 08, 2011
Posts: 9


the message says it all
 
 View user's profile Send private message  
Reply with quote Back to top
JohanEkdahl
PostPosted: Feb 08, 2011 - 09:38 PM
10k+ Postman


Joined: Mar 27, 2002
Posts: 18581
Location: Lund, Sweden

Quote:

Ok so how does one obtain a copy of this miraculous document?

By going to the first page of this thread, locating the very first post, and downloading the document at the link labelled "Download".
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
wbmarvin
PostPosted: Feb 08, 2011 - 11:23 PM
Newbie


Joined: Feb 08, 2011
Posts: 9


OK, that was very helpful. turns out the link is hidden way to the right, so unless you scroll to the right its invisible.

I have two more questions for you kind folks:

1) I'm trying to write flash with the SPM instruction on a ATMega128. Let's say I'm trying to write the 64 words (128 bytes) located at E000 in my address map. How do I set Registers 31, 30 and port RAMPZ to do that. The ATMEL docs on the subject just spin my head around and around and around...

2) Ok so I want to erase the page that holds my interrupt vectors in flash on the ATMega128.
I set bit 0 in RAMPZ to zero. I set SPMSCR with an STS instruction to 3. I load Registers 31 and 30 with zero then issue the spm instruction. Interrupts are disabled. I wait a second or two. The value of SPMSCR is still 0x3. What did I do wrong?
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Feb 09, 2011 - 11:52 AM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62354
Location: (using avr-gcc in) Finchingfield, Essex, England

1) from the mega128 datasheet:
Quote:
The Z-pointer together with RAMPZ are used to address the SPM commands. For details on how to use the RAMPZ, see “RAM Page Z Select Register – RAMPZ” on page 14. Since the Flash is organized in pages (see Table 123 on page 291), the program counter can be
treated as having two different sections. One section, consisting of the least significant bits, is addressing the words within a page, while the most significant bits are addressing the pages.
This is shown in Figure 134. Note that the page erase and page write operations are addressed
independently. Therefore it is of major importance that the Boot Loader software addresses the
same page in both the page erase and page write operation. Once a programming operation is
initiated, the address is latched and the Z-pointer/RAMPZ can be used for other operations.
The only SPM operation that does not use the Z-pointer/RAMPZ is setting the Boot Loader Lock
bits. The content of the Z-pointer/RAMPZ is ignored and will have no effect on the operation.
The (E)LPM instruction does also use the Z-pointer/RAMPZ to store the address. Since this
instruction addresses the Flash byte by byte, also the LSB (bit Z0) of the Z-pointer is used.

The key things in this are the fact that addressing is BYTE not WORD addressing and therefore Z can only access the first 64K but this can then be extended to the second page with RAMPZ. I take it by E000 you mean the word address so in byte addressing that is
1C000. So you'd set RAMPZ to 1 and Z to C000.

2) suggest you show the code but as this thread is not for diagnosing general SPM problems (only for discussing the FAQ) I suggest you do this in a new thread in AVR Forum.

BTW as for not being able to download the PDF. Do you not see the first page as:



No scrolling to the right needed for that?

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
wbmarvin
PostPosted: Feb 09, 2011 - 03:17 PM
Newbie


Joined: Feb 08, 2011
Posts: 9


thanks for clarifying the Z pointer addressing. The document you quote sends you into three different document sections and addresses several unrelated issues. The result is that it does in fact leave the reader unclear about the z pointer addressing. I would recommend a bit oriented diagram instead of the combined diagram/word descriptions used.

I checked again and in fact if you don't know the forum, you have to be clairvoint or happen to scroll. I acatually had to use a google lookup to find it the first time.

I appoligize for posting to the wrong forum. That's why they call us newbies Smile
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Feb 09, 2011 - 03:19 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62354
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:

I checked again and in fact if you don't know the forum, you have to be clairvoint or happen to scroll.

I don't understand your "scroll" comment. As my picture shows the PDF link is right there within the 4" width of the page view?!?

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
JohanEkdahl
PostPosted: Feb 09, 2011 - 06:46 PM
10k+ Postman


Joined: Mar 27, 2002
Posts: 18581
Location: Lund, Sweden

I can not make the download link "invisible" (scrolled out) unless I also make half the text or so also scrolled out to the right. DUT: Firefox 3.6.13.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
vinayak_kit
PostPosted: Jul 22, 2011 - 01:25 PM
Newbie


Joined: Jul 14, 2010
Posts: 4


i want basic sample program for boot loader in c
can you give link or any think which helps to start
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Jul 22, 2011 - 01:34 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62354
Location: (using avr-gcc in) Finchingfield, Essex, England

Which C compiler? If GCC then study this:

http://www.nongnu.org/avr-libc/user-man ... _boot.html

The "API Usage Example" there is almost everything you need to get started.

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
Difool
PostPosted: Aug 09, 2011 - 08:41 PM
Newbie


Joined: Nov 24, 2009
Posts: 18


Hi !

When we want to self-program the flash, we've two alternatives :
1) fill the buffer before a Page Erase
2) fill the buffer after a Page Erase

If i choose the first alternative, can i use the boot_page_fill() function anytime in the program (but before boot_page_write(), of course) ?

e.g : while the number of words received ! = SPM_PAGESIZE, boot_page_fill(word_address, word) ans when number of words received == SPM_PAGESIZE, erase and write page.

Can I do that?
 
 View user's profile Send private message  
Reply with quote Back to top
tritonium
PostPosted: Dec 11, 2011 - 02:08 AM
Newbie


Joined: Dec 09, 2011
Posts: 3
Location: Bristol, England

Hi
I'm afraid I too am having problems accessing this pdf.
First I could not see the box at the bottom of the first item but after logging in sure enough after scrolling miles to the right there it was. (its as if the box is two normal page widths wide). Anyway clicking on down load I get a loading bargraph at the bottom of the page and then a complete blank except for an odd icon in the top left hand corner of the screen. I am using Nitro pdf reader. Its been ok so far on all other pdf's Ive downloaded - and there are many.....
Any ideas?
Dave H
 
 View user's profile Send private message  
Reply with quote Back to top
JohanEkdahl
PostPosted: Dec 11, 2011 - 07:58 AM
10k+ Postman


Joined: Mar 27, 2002
Posts: 18581
Location: Lund, Sweden

Quote:

after scrolling miles to the right there it was. (its as if the box is two normal page widths wide)

The box is always as wide as the page is, i.e. as wide as the widest post in the current page. If the page is "wider than reasonable" then it might be due to

- Someone having produced a post that makes the page very wide (long line that can not be broken i.e. no spaces etc, or large/wide picture attached), or

- The browser used has some quirk rendering pages. Right now I'm typing this with FireFox, and the page fits on a 1280 wide screen. Mind you, I have clicked the Maximize link (no not any button on the browser window title bar os similar - there is a link at the top of every AVRfreaks page). This simple manouvre lets you utilize the whole browser window width for something useful, rather than wasting perhaps half of it on some green goo that someone at Atmel decided he could use my presious and expensive screen pixels to display.

Quote:
Any ideas?

Try another browser?
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
tritonium
PostPosted: Dec 17, 2011 - 02:19 AM
Newbie


Joined: Dec 09, 2011
Posts: 3
Location: Bristol, England

Well I think I've cracked it, (not being able to download the TUT)
I used my wifes laptop running XP and with Adobe Acrobat reader, (on my computer I use Nitro pdf reader which has worked perfectly up to now), and although the page for this post is VERY WIDE (? only when logged in) by scolling to the right I get to the download link and pressing this loads up the pdf. (with my PC all I got was a blank page)

Well I have to say it was well worth the effort!
I take my hat off to those who put in the time and effort to compile these pearls of information in such a reasoned and logical and concise way - even I understood half of it - fortunately the relevent half.

Thanks again
Dave H
 
 View user's profile Send private message  
Reply with quote Back to top
bandtank
PostPosted: Dec 29, 2011 - 12:47 AM
Hangaround


Joined: Sep 29, 2006
Posts: 195


I'd like to suggest a modification to the tutorial. For people who are trying to learn about bootloaders, this tutorial doesn't have much of an explanation of the higher level concepts. It's definitely a good reference after you've learned the basics, but we don't have a guide to help people get to that point. I just went through this process so I thought I'd point this out while it's fresh in my mind.

The biggest stumbling block I've seen in countless threads as well as experienced is the leap from putting the bootloader on the mcu and then actually using it. Every document I've seen for AVR Dude, avrfreaks tutorials, posts, etc. has people asking the same questions. Simply put, a section titled "This is how you actually use the bootloader (with examples)" would have saved me many hours of trying to understand what comes next. This tutorial has a one-liner with no specific information, which didn't really help me at all.

Quote:
Two step approach: Program your bootloader with an external programmer as described in question #6. You will probably also want to set fuses, including BOOTSZ and BOOTRST, at the same time. Then simply use the bootloader's normal communication mechanism to transfer and program the application.


That's great and all, but if you don't know how to use it in the first place, this statement only frustrates you more.

I'd be happy to work on this if you acknowledge that it would be put in the FAQ if I provided it.
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Dec 29, 2011 - 12:51 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62354
Location: (using avr-gcc in) Finchingfield, Essex, England

We didn't write this for beginners. It's for those actually interested in WRITING a bootloader. They are bound to know how you use one!

Feel free to start a new tutorial thread with a beginners guide to using bootloaders - all contributions welcome here.

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
bandtank
PostPosted: Dec 29, 2011 - 04:11 PM
Hangaround


Joined: Sep 29, 2006
Posts: 195


clawson wrote:
We didn't write this for beginners. It's for those actually interested in WRITING a bootloader. They are bound to know how you use one!

Feel free to start a new tutorial thread with a beginners guide to using bootloaders - all contributions welcome here.


Don't you think it would be good if it could be combined into one resource for everyone to reference? I don't think it's a complicated enough topic for two. The beginner stuff could simply be an introductory section that advanced users could skip.

If I started a thread for beginners, the name would likely be confusing since this one doesn't really mention that it is for writing bootloaders. Bootloader FAQ implies a broader scope than creating one. When I was trying to learn about bootloaders, this seemed like a good place to start, so I read most of the document hoping it would have something beginner friendly.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits