Author Topic: P89LPC938 Programming  (Read 18982 times)

erikm

  • Guest
Re: P89LPC938 Programming
« Reply #15 on: June 16, 2005, 06:19:17 am »
"Finally, by using your method, does this put the uC in the state that it is in when it is shipped from the factory meaning that it will go into ISP mode automatically upon the next reset after your code has run?"
yes


"Place the routine where it suits to you. Placing it in an ISR activated by pushbutton is a good idea if you have a spare input"
OK, but that would require a separate PB and that one WILL be "accidentially" pushed

"Erik's remark (activate it by holding down the Rx pin = break) aims to spare this pin"
No, not the Rx - you may burn your transciever, configure Tx as Quasi and use that one as held down at power up/reset to activate.

"(alternatively you can enable the bootloader activation by break as Andrew said earlier). "
That requires all the funky hardware

"If you have some communication protocol established, maybe it's also a good idea to implement a command which results in call to this routine, so you can get into bootloader without opening the box (again (C) Erik).
If you insert it on 0000h, upon first running your application it gets activated and the subsequent reset will invoke"

Jan is mixing the two places.

a) The "closed box" is the "normal use which allow an update of the code in an installed system.

b) The "backdoor" (Tx held at start) is there to allow reprogramming of chips where a code malfunction does not allow reaching a)

 
Erik

Jim Allen

  • Guest
Re: P89LPC938 Programming
« Reply #16 on: June 16, 2005, 06:55:07 am »
Gentlemen,

I apologize for what appeared to be "beating a dead horse" but thanks for your answers.

Jim


Jan Waclawek

  • Full Member
  • ***
  • Posts: 220
    • View Profile
    • EFTON homepage
Re: P89LPC938 Programming
« Reply #17 on: June 16, 2005, 06:56:28 am »
> OK, but that would require a separate PB
> and that one WILL be "accidentially" pushed

That's why 3 buttons have to be installed on 3 sides of the box, at least 30cm (12") apart from each other, labelled "Ctrl", "Alt" and "Del", wired in series...

> No, not the Rx - you may burn your transciever, configure Tx
> as Quasi and use that one as held down at power up/reset to activate.

True, sorry.

>> "(alternatively you can enable the bootloader activation by break as
>> Andrew said earlier). "
> That requires all the funky hardware
Not at all, LPC932A1 user manual says:
The break detect can be used to reset the device and force the device into ISP mode by setting the EBRR bit (AUXR1.6)
Well, it is NOT mentioned in the ISP section, only in the UART section... (but probably all of us wrote various pieces of documentation...)

Jan Waclawek

erikm

  • Guest
Re: P89LPC938 Programming
« Reply #18 on: June 16, 2005, 11:36:20 am »
That's why 3 buttons have to be installed on 3 sides of the box, at least 30cm (12") apart from each other, labelled "Ctrl", "Alt" and "Del", wired in series...

Jan, you forgot the :)

"The break detect  ..."
OK, you are right; however it is a bitch to make a PC generate a break.  

Andy: does FM do that now?

Erik

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2176
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: P89LPC938 Programming
« Reply #19 on: June 16, 2005, 11:40:05 am »
To generate a break condition in FM:

Go to ISP -> Start Bootloader...
Select "Send Break Condition"
Click on "Start Bootloader"

Embedded Systems Academy, Inc.
support at esacademy dot com

Jim Allen

  • Guest
Re: P89LPC938 Programming
« Reply #20 on: June 16, 2005, 12:12:11 pm »
Andrew,

Based on the very interesting discussion that has transpired on this subject, maybe you could summarize the procedures mentioned and post a new Application Note on the Flash Magic website covering what we've been discussing.  

I cannot help but think that other individuals are struggling with this besides me and this would do nothing but help others use Flash Magic programming LPC9xx devices.  You know, a type of App Note that says, Step 1: Add the following code in your program here, Step 2: Start Flash Magic and generate a break by...  You get the idea.

What do you think?

Jim


Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2176
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: P89LPC938 Programming
« Reply #21 on: June 16, 2005, 12:17:56 pm »
Jim, thanks for the suggestion of an application note. I'll add that to the to do list. Note however that if you only want to use the break detect method of ISP entry you don't need to add any code, simply set the relevent bit in the appropriate SFR.

Embedded Systems Academy, Inc.
support at esacademy dot com

erikm

  • Guest
Re: P89LPC938 Programming
« Reply #22 on: June 17, 2005, 05:41:02 am »
"simply set the relevent bit in the appropriate SFR"

All very well, but what if the code (under development) does not reach the place where it "set the relevant bit"

This is not FM but LPC, but since it relates: can you "set the relevent bit in the appropriate SFR" as the first instruction (oer 0 - ljmp phread - org xxx - Phread: SBIT - crash) without any ill effects and will FM started with a reak then work if the program crashes

Erik

Jim Allen

  • Guest
Re: P89LPC938 Programming
« Reply #23 on: June 17, 2005, 07:48:09 am »
Andrew,

I am interested in your comments to Erik's last post.  

I'm not sure I follow him.

Jim


Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2176
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: P89LPC938 Programming
« Reply #24 on: June 17, 2005, 08:46:06 am »
Anything that relies on the application to set up is going to be at risk of it not working because due to some unforseen problem the code doesn't get far enough. I would guess (although I haven't tried it) that you could modify the Keil startup code to set the SFR bit to enable break detection, along with configuring the UART's baud rate, etc as one of the very first things that happens. I am not sure if the method would continue to work if later on the code crashed.

Embedded Systems Academy, Inc.
support at esacademy dot com

erikm

  • Guest
Re: P89LPC938 Programming
« Reply #25 on: June 17, 2005, 02:02:21 pm »
I do not know about the LPC, but making the first thing in statup.a51 as follows:
?C_STARTUP: LJMP STARTUP1

           RSEG  ?C_C51STARTUP

STARTUP1:

;; here inserted
 jb P3.0, noboot
;;;;;;;;;; the code to activare the boot
jmp $
noboot:
;; continue with the Keil standard code (or whatever)

does work in the Rx2 as a guaranteed means of activating the ISP

Erik

Jan Waclawek

  • Full Member
  • ***
  • Posts: 220
    • View Profile
    • EFTON homepage
Re: P89LPC938 Programming
« Reply #26 on: June 18, 2005, 02:28:52 am »
It can be done also the other way round - while using NoTouch with Backdoor (C)Erik the mcu starts in the application and "goes" to the bootloader upon "request"; it could also start in the bootloader which would jump to application when needed.

E.g. the standard bootloader can be modified to the style of P89V51RD2, i.e. if no successful autobaud occus within a certain time period, it would start the application.

Caveat: upgrading the bootloader  using ISP is nontrivial.

Jan Waclawek



Post Edited (06-18-05 02:32)