Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Starting Bootloader from Application

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> AVR
View previous topic :: View next topic  
Author Message
Alex20q90

Bascom Member



Joined: 24 Sep 2007
Posts: 89

germany.gif
PostPosted: Sat Mar 10, 2018 12:02 pm    Post subject: Starting Bootloader from Application Reply with quote

Hello,

i have a new problem! I use a ATMega8u2 mit LUFA Bootloader. In Bascom i can flash my Application with Bascom over the "FLIP"-Programmer directly via USB. It works.
If i would flash again, i need to pull down the /RESET-Pin to low to start the Bootloader.

A Try to call the bootloader-Adress from my App wont work.

Sample code:

Code:
$regfile = "M8u2def.dat"
$crystal = 8000000

Switch Alias Pinc.2                                         ' Tasterabfrage an diesem Port
waitms 200

 If Switch = 1 Then ' Call Bootloader if switch is pressing by power-on
  goto &h1000 ' goto &h800 also wont work **
 End If

do

' Here my Mainprogramm

loop


I cant call the Bootloader! Also i tried to force a uC-Reset with WatchDog.
**In the BASCOM-Prog is the Bootloader at $800 (Fusebit High KL 00:Bootsize 2048 words at $800) but the Bootloader starts at &H1000.


FBH: 1: Reset vector is $0000
FBExt: 0:Hardwareboot enabled.

I Also tried Reset vector is bootloader
Hardwareboot disabled


(BASCOM-AVR version : 2.0.8.1 )
Back to top
View user's profile
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2262

blank.gif
PostPosted: Sat Mar 10, 2018 1:31 pm    Post subject: Re: Starting Bootloader from Application Reply with quote

Alex20q90 wrote:
i have a new problem!
That was to expect.
I thought about helping you through, but considering your previous thread, your low discussion ability and low esteem about other discussion partners as devote helpsters, I do not think I would enjoy it much.
Also I regularly find it arrogant if persons formerly seeking help just leave after their question was answered, while giving a damn about others getting stuck by trying to find out the final result of a thread. You seem to be such a self-centered candidate.
Ok, ranted that, now just a hint:
Quote:
LUFA Bootloader
...
i tried to force a uC-Reset with WatchDog.

That's the suggested process by the LUFA library for AVR.
It surly works, if not for you then because you did it wrong.
Back to top
View user's profile
Evert :-)

Bascom Expert



Joined: 18 Feb 2005
Posts: 2156

netherlands.gif
PostPosted: Sat Mar 10, 2018 3:59 pm    Post subject: Reply with quote

Hi,

Goto &Hxxx should work,
However &H1000 is not a valid Bootloader address, what is valid depends on how big your bootloader loader is, have a look at the datasheet page 239.

_________________
www.evertdekker.com Bascom code vault
Back to top
View user's profile Visit poster's website
Alex20q90

Bascom Member



Joined: 24 Sep 2007
Posts: 89

germany.gif
PostPosted: Sat Mar 10, 2018 6:05 pm    Post subject: Re: Starting Bootloader from Application Reply with quote

Evert Smile wrote:
Hi,

Goto &Hxxx should work,
However &H1000 is not a valid Bootloader address, what is valid depends on how big your bootloader loader is, have a look at the datasheet page 239.


Thanks Evert!
I read it in the past and i tried this to start my bootloader with this adress, after it did not work i look onto the programmers buffer who looks like it starts by $1000. Maybe i give up to early with $800.

EDIT: i tried the adress $800 (&h0800) but i cant call the bootloader.
Also tried with restart by Watchdog!

Now i see in the documentation of LUFA

http://www.fourwalledcubicle.com/files/LUFA/Doc/120219/html/_page__software_bootloader_start.html

that it use a "Magic_Key".
In my case it is in the Bootloadeer with

Code:
#define MAGIC_BOOT_KEY           0xDC42


and in the App i have to start with (example)


Code:
  void Jump_To_Bootloader(void)
  {
      // If USB is used, detach from the bus and reset it
      USB_Disable();

      // Disable all interrupts
      cli();

      // Wait two seconds for the USB detachment to register on the host
      Delay_MS(2000);

      // Set the bootloader key to the magic value and force a reset
      Boot_Key = MAGIC_BOOT_KEY;
      wdt_enable(WDTO_250MS);
      for (;;);
  }


But the Magic_key have to written in the Memory! But i cant find the place of adress where its have to been written!






MWS wrote:
Alex20q90 wrote:
i have a new problem!
That was to expect.


MWS wrote:
It surly works, if not for you then because you did it wrong.


d'oh!
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum