Author Topic: ISP? ICP? IAP?  (Read 24018 times)

itibira

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
ISP? ICP? IAP?
« on: December 06, 2006, 12:57:42 pm »
Hi,

i am planning on using an 89LPC935 as a "subprocessor" in my project, ie: there's another main processor on the board that talks to USB and  then it talks to the LPC935 via I2C. What i'd like to be able to do is to somehow use the main processor to program the LPC935 with new code so that the end user doesn't need cables or special programming hardware to update any LPC935 firmware. Ideally it should be done through the USB connection and main processor with the programming routines residing in the PC or the main processor. i've been trying to understand all the nuances of the different programming schemes for the LPC935 (LPC9xx), ISP, IAP and ICP but it is all very confusing and seems very prone to error, different chip revisions, etc. and, worst of all, with the prospect of an incorrect programming attempt requiring the replacement of the LPC935 chip on the PCB which would be unacceptable.

Before i commit to using the LPC935, i'd like to get a solid enough understanding of and feeling for a robust method of LPC935 programming / updating of firmware with minimal added hardware resources and a method that best suits the scenario i described above. Can anyone please explain how this might be achieved or even if it's possible?

For example, in the ICP method, if i understand it correctly, the programmer must control the Vdd to the 935 for programming, which complicates the hardware and adds expense. Do ALL the various programming methods need to control Vdd or do ISP and IAP not need this?

Thanks in advance.



Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2176
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: ISP? ICP? IAP?
« Reply #1 on: December 06, 2006, 01:26:19 pm »
ICP is probably the most robust because it is implemented in hardware. It shouldn't be too hard to implement.

ISP requires that you also control the power so you can send the three reset pulses to the device within a specific time after power up.

IAP is used only if you want to develop your own custom bootloader. For example your device may wait for a command on I2C which will then place it in "programming mode". When programming instructions are received (maybe via I2C?) then you can use IAP to program the flash.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

itibira

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: ISP? ICP? IAP?
« Reply #2 on: December 06, 2006, 06:08:10 pm »
Thanks, Andy, for the information. i have more questions though...sorry for the trouble:

* Does ICP also require that the Vdd on the 935 be controlled?

* Is there a schematic that is known good to use for ICP hardware for the 935 and where can i look at it, please? (i already have a few app notes and schematics but i'm not sure which one is the latest / most accurate)

* In my proposed system architecture (using a second USB microcontroller and I2C), are you saying that by using IAP and my own bootloader that it would be a better solution than ICP (or can i also use ICP via I2c?)?

* Are there any examples of IAP-based and ICP-based bootloader source code to look at or download?

* i would prefer to do the firmware programming / updates via my own Windows-based code. Is there any place i can download a code example or demo project for Windows to do this?

* Finally, what are the worst-case potential problems with using either IAP or ICP? eg: the LPC935 getting into a state that would require unsoldering the device and using a parallel programmer to recover it. Or does using IAP or ICP prevent this?

Again, sorry for all these questions. i'm very new at using the Philips parts and in the way they do the in-system programming. i've been downloading all the data sheets and application notes i can find, plus looking at a few forums but i'm getting more confused the deeper i look. It would be nice to get enough reliable information that says "you are >HERE<".

Any help or insight is most deeply appreciated. Thank you.






rbtamd

  • Jr. Member
  • **
  • Posts: 25
    • View Profile
Re: ISP? ICP? IAP?
« Reply #3 on: December 07, 2006, 05:48:26 am »
search for "no touch" I think this is a solution for you

Roberto


erikm

  • Full Member
  • ***
  • Posts: 113
    • View Profile
Re: ISP? ICP? IAP?
« Reply #4 on: December 07, 2006, 05:51:42 am »
search for "no touch" I think this is a solution for you

A note from the author:
Read all the NoTouch documents, the NoTouch for LPC does not have "the words"

Erik


erik

itibira

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: ISP? ICP? IAP?
« Reply #5 on: December 07, 2006, 11:31:27 am »
Hi,

What do you mean when you say that NoTouch does not have "the words"? Which words are you referring to, please?

Thanks.




Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2176
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: ISP? ICP? IAP?
« Reply #6 on: December 07, 2006, 12:42:28 pm »
I think he means no description.

The best documentation for the ICP connections is the NXP application note, that you can get from the third party section of the Flash Magic web page.

I'm not saying that one option is better than the other, only that they each have pros and cons. You have to decide what is best for your application.

You can get the LPC9xx bootloader source code from the third party section of the Flash Magic web page. This will show you how to use IAP, however it is all in assembler. You could even take the source code and change the source of the ISP commands from the UART to I2C, I suppose.

With ICP I don't think it is possible to get the device in a state where it can't be reprogrammed. I think this is the biggest advantage of that approach. With IAP you are relying on correct programming of your firmware last time. If you program it incorrectly and accidentally reset then you are stuck.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

Je Gold

  • Full Member
  • ***
  • Posts: 135
    • View Profile
Re: ISP? ICP? IAP?
« Reply #7 on: December 09, 2006, 10:33:38 am »
With programming any flash micro-controller it is essential that Vdd is stable and within specification (any programming mode, ICP, ISP and IAP included).

ISP requires an oscillator to drive the serial UART (weather internal Osc or external Osc or Xtal Osc).  Hence it is Asynchronous and dependent on timing.

ICP is Synchronously clocked serial data(a bit like SPI or microwire) And there is less dependence on an Osc source.

I believe that ICP has more control over the micro.

Because ICP is Synchronously clocked serial data it is difficult to directly program by the serial port of a PC  (which is Asynchronous)….. Hence a micro in between the PC serial port and the “target  micro” is used do the conversion from Asych to  Synch.

The in-between micro is part of the “Bridge circuit”

Getting in to programme mode
----------------------------------------------
After POR (Power On Reset)…….

3 quick pluses on the Reset pin  -  puts the LPC935 in to ISP mode.

7 quick pulse on the Reset pin - puts the LPC935 in to ICP mode.


All current promote LPC900 devices can use ICP   and only 20pin parts can do both ISP and ICP.

FINALLY
-------------
If you want less problems  - I highly recommend purchasing the  Keil  MCB900  which can ISP program quite easily…. And be used as part of the Bridge Circuit to do ICP.

Quite a few people take a bit of time to get their “home brew” ISP or ICP circuit going, hence the MCB900 is a good starter.

I think the MCB900 is $59 USD + Freight.. (which includes limited complier).

Just my 2 cents worth

Joe

 ;)

Je Gold

  • Full Member
  • ***
  • Posts: 135
    • View Profile
Re: ISP? ICP? IAP?
« Reply #8 on: December 09, 2006, 10:35:54 am »
Sorry that is only 20pin and "greater" can be programmed by ISP OR ICP.

itibira

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: ISP? ICP? IAP?
« Reply #9 on: December 10, 2006, 03:09:21 am »
Hi Andy and Je,

Thanks to both of you for your input and also appreciated is your time spent for the reply.  :)

Your descriptions of the ICP and ISP are appreciated. Since i will already have a main microcontroller (with USB I/F) on the board which can be used as the ICP bridge micro, it seems at this point that ICP might be the best way to go.

Regarding the Vdd: i understand that the Vdd will need to be at the required voltage and stable for any operation, including programming, to occur properly but i have seen in a few app notes that the Vdd to the LPC935 (or LPC9xx) seems to need some kind of switching of Vdd for programming to proceed in ICP mode. Is this an absolute requirement? Must the Vdd be toggled On / Off in order to successfully program the 935 or is there a "trick" that can be used that allows the Vdd to be on and stable throughout the ICP programming?

Also, regarding using the MCB900: since i am architecting this board as well as designing the hardware and writing the firmware, my concern is to have the 935 programmed via the main USB micro through the USB port. i do not want the end-user to have to buy or have any special programming hardware in order to program the LPC935, so i don't want to use the MCB900, except maybe in initial debug of the first prototype, where it may be helpful.

Finally, thanks for the info on where to find the IAP bootloader source code. Is there similarly any bootloader source code for ICP?

Thank you.  :)



 


Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2176
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: ISP? ICP? IAP?
« Reply #10 on: December 11, 2006, 06:39:28 am »
I believe controlling VDD is necessary.

You can get the LPC9xx bootloader sources from: http://www.flashmagictool.com/resources.html

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

Je Gold

  • Full Member
  • ***
  • Posts: 135
    • View Profile
Re: ISP? ICP? IAP?
« Reply #11 on: December 19, 2006, 04:13:47 am »
Yes controlling  Vdd of the "target"  LPC935 (or any of the LPC900 series in general) for ISP or ICP is nessecary  BECAUSE the "quick" programming pluses must applied immediately after POR (power on reset)....   you can only get POR by powering on/off/on the target LPC900 micro.......  hence Vdd must be controlled.

There is much more electronic hardware work with ICP and ISP  but it is the hardware control of the LPC935 (LPC900 series) that put it in to programming mode.

Notouch IAP (In Application Programming)  requires "back door / front door" code that detects a micro controller event and calls ISP bootloader (to put it in to ISP programme mode) BUT this tiny bit of NoTouch code... must be loaded the 1st time and all subsequent times  NoTouch is to be used.

Where as....  Hardware ISP / ICP.... hardware forces the LPC935 in to programming mode, but hitting the RESET line on the head 3 or 7 times.

Joe

erikm

  • Full Member
  • ***
  • Posts: 113
    • View Profile
Re: ISP? ICP? IAP?
« Reply #12 on: December 20, 2006, 06:54:04 am »
Yes controlling  Vdd of the "target"  LPC935 (or any of the LPC900 series in general) for ISP or ICP is nessecary  Unless you use NoTouch!

if you use NoTouch and install it the very first (and, since it will be part of your code every time thereafter) you need no, none, zero, nada "control signals", just the serial

NoTouch works with ISP, NOT ICP

Erik
erik

itibira

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: ISP? ICP? IAP?
« Reply #13 on: December 21, 2006, 12:32:54 am »
OK, so what i am getting is that NoTouch is only for ISP but then there is no need for power cycling the Vdd and playing with the reset, etc., BUT there could be issues if the NoTouch is not programmed correctly the first time and something goes wrong, in which case it's time to solder a new chip in.

On the other hand, the advantages / disadvantages of ICP are that because it is hardware driven, there is no issue with the LPC9xx getting into a curare-like paralysis state BUT there is all that extra hardware to deal with.

i won't even attempt to figure out IAP...

Is this about right?

Moreover, ISP uses the TxD / RxD pins whereas ICP uses P0.4 and P0.5 (plus the power and Reset). There has been mention made of bootloaders for both ICP and ISP. Is this correct or ? Just to be clear, does the bootloader code go into the target LPC9xx as a set of routines alongside the firmware used for the embedded application (ie: the code i write)?

Finally, i still don't understand the issues with using the bootloader: is it used to provide a ISP front-end to be able to program the micro via Flash Magic? Is it also used for ICP? If i am using my own "bridge" microcontroller via USB, then can Flash Magic still be used or do i need to write my own PC-based code?

Sorry for so many questions. i think that Philips might have done a much better job if they had settled on one programming method for their microcontrollers and developed it properly, with REAL information and detailed examples on how to program the FLASH instead of having the information scattered to the four winds. As it is, there is too much confusion (especially for me) and it is taking much too much time and energy to figure all this out. It shouldn't have to be this difficult.

Perhaps a different microcontroller would be better suited and easier to program? (not necessarily Philips...)

Thanks again.

Je Gold

  • Full Member
  • ***
  • Posts: 135
    • View Profile
Re: ISP? ICP? IAP?
« Reply #14 on: December 21, 2006, 04:29:49 am »
It is not difficullt if you follow the Keil MCB900 board/design... It work's almost out of the box and allows you to get to 1st base very fast....  (ISP Hardware Mode)...  here is the schematic / circuit diagram.
http://www.keil.com/mcb900/mcb900-schematics.pdf  and the main page is www.keil.com/mcb900/

ISP works for 20 to 44pin parts mainly because they have a UART on-board:

Please consider using MCB900 development - which should get you 1st base quickly.

If you are having trouble obtianing the MCB900 then you might try www.lpctoos.com

Other comments
The ISP bootloader is preloaded at the factory for the 20pin and larger parts.

Notouch is software control  that allows you to jump to the ISP from some programmed event.


It's alway better using development tools for the 1st time.

Joe