EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

IAP

Started by subb...@gmail.com February 3, 2009
Hi I am using LPC2138 for my design. I want to use the IAP mode . In ISP pin p0.14 should be low after reset. Does it true for IAP mode also. Should I reset the MC and drive the p0-14 pin low to enter into IAP mode? Would it be possible for me invoke ISP mode while the system is running.
Thanks in advance.
Regards,
Subbiah

An Engineer's Guide to the LPC2100 Series

no. no need for IAP. to enter ISP mode, you have to reset and drive P0.14

Timucin KANATLI

s...@gmail.com wrote:
>
> Hi I am using LPC2138 for my design. I want to use the IAP mode . In
> ISP pin p0.14 should be low after reset. Does it true for IAP mode
> also. Should I reset the MC and drive the p0-14 pin low to enter into
> IAP mode? Would it be possible for me invoke ISP mode while the system
> is running.
>
> Thanks in advance.
> Regards,
> Subbiah
>
> No virus found in this incoming message.
> Checked by AVG i www.avg.com
> Version: 8.0.233 / Virus Database: 270.10.17/1931 i Release Date: 01/30/09 07:37:00
>
>
On Tue, 03 Feb 2009 05:51:07 -0500, you wrote:

>Hi I am using LPC2138 for my design. I want to use the IAP mode . In ISP pin p0.14 should be low after reset. Does it true for IAP mode also. Should I reset the MC and drive the p0-14 pin low to enter into IAP mode?

No p0.14 only determines where the bootloader goes at reset -your code or ISP

>Would it be possible for me invoke ISP mode while the system is running.

Yes - there is a command to reinvoke ISP via the IAP interface. Note that it needs some setup that
is not documented - search for my previous posts here on the subject ('reinvoke ISP' should find
it.)
I have spent considerable time on this without success on an LPC2468.
The IAP_reinvoke_ISP command clearly drops into the ISP and it echoes '?' characters typed, but when it should be sending "Synchronized", I get ASCII garbage (looks like a baud rate or other serial parm mismatch).

Is there a working code example for launching the ISP from code for an LPC2468? Philips Apps, are there any errata on this?

I've tried setting as much as possible to default conditions, if anyone sees something obviously wrong, please let me know. Thanks!

ldr r1, =0xE01FC000 @ system control base address
mov r0, #0x00
mov r2, #0xaa
mov r3, #0x55

/* Undo the configuration changes made at startup */
/* to restore the CPU to its default configuration */
str r0, [r1, #0x000] @ MAM = 0x00 (disabled)
str r0, [r1, #0x1A8] @ PCKLSEL0 = 0x00
str r0, [r1, #0x1AC] @ PCLKSEL1 = 0x00
str r0, [r1, #0x080] @ PLLCON = 0x00 (disconnect PLL)
str r0, [r1, #0x084] @ PLLCFG = 0x00
str r2, [r1, #0x08C] @ PLLFEED = 0xAA
str r3, [r1, #0x08C] @ PLLFEED = 0x55
str r0, [r1, #0x10C] @ CLKSRCSEL = 0x00 (PLL src is RC osc)
str r0, [r1, #0x104] @ CCLKCFG = 0x00 (CPU clk is RC/1)

/* Configure GPIO pins */
ldr r1, =0xE002C000 @ PINSEL0
str r0, [r1, #0x000] @ PINSEL0 = 0x00 (all GPIO)
ldr r0, [r1, #0x1A0] @ SCS
and r0, #0x2E @ clear bits 0 (GPIOM), 4 (OSCRANGE)
str r0, [r1, #0x1A0] @ use legacy GPIO mode

/* Clear GPIO 2.10 (/BSL) */
ldr r1, =0x3FFFC000 @ FIO base address
mov r0, #0x00
str r0, [r1, #0x050] @ FIO2MASK (enable)
mov r0, #0x01
eor r0, r0, LSL #0x0a @ set bit 10
str r0, [r1, #0x05C] @ FIO2CLR set port 2.10 low
str r0, [r1, #0x040] @ FIO2DIR set port 2.10 output

/* Configure UART0 to defaults */
ldr r1, =0xE000C000 @ UART0 base address
mov r0, #0x83 @ Configure UART0 to default settings
str r0, [r1, #0x00C] @ U0LCR = 0x80 (DLAB enabled)
mov r0, #0x01 @
str r0, [r1, #0x000] @ U0DLL = 0x01 (default divisor=1)
mov r0, #0x00
str r0, [r1, #0x004] @ U0DLM = 0x00
mov r0, #0x03
str r0, [r1, #0x00C] @ U0LCR = 0x00 (DLAB disabled)
mov r0, #0x00
str r0, [r1, #0x008] @ U0FCR = 0x00 (FIFOs disabled)
mov r0, #0x00
str r0, [r1, #0x028] @ U0FDR = 0x00

/* Configure power control */
mov r0, #0x00
str r0, [r1, #0x0C0] @ PCON (default setting)
ldr r0, =0x04280FFE
str r0, [r1, #0x0C4] @ PCONP (default setting)

ldr r13, =0x4000FFDF @ Set stack to RAM_TOP - 32
ldr r0, =0x40000000 @ Use start of RAM for parm storage
mov r1, r0 @ although no return, R1 must be init'd
mov r2, #0x39 @ 0x39 = decimal 57
str r2, [r0] @ param[0] = 57
ldr r2, =0x7ffffff1 @ IAP entry point
bx r2

(and yes, I've tried removing various blocks of the above code with no success)

Thanks for any help/suggestions!
--- In l..., Mike Harrison wrote:
>
> On Tue, 03 Feb 2009 05:51:07 -0500, you wrote:
>
> >Hi I am using LPC2138 for my design. I want to use the IAP mode . In ISP pin p0.14 should be low after reset. Does it true for IAP mode also. Should I reset the MC and drive the p0-14 pin low to enter into IAP mode?
>
> No p0.14 only determines where the bootloader goes at reset -your code or ISP
>
> >Would it be possible for me invoke ISP mode while the system is running.
>
> Yes - there is a command to reinvoke ISP via the IAP interface. Note that it needs some setup that
> is not documented - search for my previous posts here on the subject ('reinvoke ISP' should find
> it.)
>

Hello dave_albert,

Thursday, December 9, 2010, 11:44:15 PM, you wrote:

d> I have spent considerable time on this without success on an LPC2468.
d> The IAP_reinvoke_ISP command clearly drops into the ISP and it
d> echoes '?' characters typed, but when it should be sending
d> "Synchronized", I get ASCII garbage (looks like a baud rate or other serial parm mismatch).

d> Is there a working code example for launching the ISP from code
d> for an LPC2468? Philips Apps, are there any errata on this?

d> I've tried setting as much as possible to default conditions, if
d> anyone sees something obviously wrong, please let me know. Thanks!

[snip]

Try disabling the interrupts (I'm not seeing it in your code).

d> (and yes, I've tried removing various blocks of the above code with no success)

d> Thanks for any help/suggestions!

--
WBR,
Igor mailto:s...@mail.ru

Thank you Igor, unfortunately I am testing this from a very small application that never enables interrupts in the first place.

BR,
Dave

--- In l..., Igor Skochinsky wrote:
>
> Hello dave_albert,
>
> Thursday, December 9, 2010, 11:44:15 PM, you wrote:
>
> d> I have spent considerable time on this without success on an LPC2468.
> d> The IAP_reinvoke_ISP command clearly drops into the ISP and it
> d> echoes '?' characters typed, but when it should be sending
> d> "Synchronized", I get ASCII garbage (looks like a baud rate or other serial parm mismatch).
>
> d> Is there a working code example for launching the ISP from code
> d> for an LPC2468? Philips Apps, are there any errata on this?
>
> d> I've tried setting as much as possible to default conditions, if
> d> anyone sees something obviously wrong, please let me know. Thanks!
>
> [snip]
>
> Try disabling the interrupts (I'm not seeing it in your code).
>
> d> (and yes, I've tried removing various blocks of the above code with no success)
>
> d> Thanks for any help/suggestions!
>
> --
> WBR,
> Igor mailto:skochinsky@...
>

Hi Dave,

Before calling the IAP 'reinvoke ISP', you need to return the settings of the
MCU as in reset mode (especially the clock / PLL settings).

Regards,
-daniel
----- Original Message ----
From: dave_albert
To: l...
Sent: Fri, December 10, 2010 8:20:32 AM
Subject: [lpc2000] Re: reinvoke ISP on LPC2468 ?

Thank you Igor, unfortunately I am testing this from a very small application
that never enables interrupts in the first place.

BR,
Dave

--- In l..., Igor Skochinsky wrote:
>
> Hello dave_albert,
>
> Thursday, December 9, 2010, 11:44:15 PM, you wrote:
>
> d> I have spent considerable time on this without success on an LPC2468.
> d> The IAP_reinvoke_ISP command clearly drops into the ISP and it
> d> echoes '?' characters typed, but when it should be sending
> d> "Synchronized", I get ASCII garbage (looks like a baud rate or other serial
>parm mismatch).
>
> d> Is there a working code example for launching the ISP from code
> d> for an LPC2468? Philips Apps, are there any errata on this?
>
> d> I've tried setting as much as possible to default conditions, if
> d> anyone sees something obviously wrong, please let me know. Thanks!
>
> [snip]
>
> Try disabling the interrupts (I'm not seeing it in your code).
>
> d> (and yes, I've tried removing various blocks of the above code with no
>success)
>
> d> Thanks for any help/suggestions!
>
> --
> WBR,
> Igor mailto:skochinsky@...

On 12/10/2010 12:44 AM, dave_albert wrote:
> The IAP_reinvoke_ISP command clearly drops into the ISP and it echoes
> '?' characters typed, but when it should be sending "Synchronized", I
> get ASCII garbage (looks like a baud rate or other serial parm mismatch).

I'm reinvoking ISP by doing little more than setting RC oscillator for
CPU clock, and even that is mainly for FLASH-timings. That works for me
at 115k2 baud.

I have seen symptoms like your's with different PC serial ports and the
cure has been to lower the baudrate. The behaviour had nothing to do
with *reinvoking* the ISP, it happened with ISP invoked at RESET.

--

Timo
Hi Timo,

Thanks for the reply; unfortunately, the ISP works perfectly when invoked from reset at any baud rate (at least up through 230kbps); this hardware is running over USB up to the target and only converts to serial just before it hits the processor so the impact of serial cabling on data rates isn't an issue.

The problem only happens when I re-invoke the ISP. I've tried down to 38.4kbps and no improvement...I think it is likely a timing problem. I've done this successfully with several of the LPC21xx series processors, but I'm having trouble with the LPC24xx parts. I was hoping someone had figured out exactly *which* registers need to be configured to their default states and could share that...otherwise, I'll just have to keep resetting registers until I find the one that's causing the problem.

However I'd like to confirm that it is possible (and not something that's going to show up in an NXP errata as non-functional)...can you confirm that you successfully re-invoke the ISP using the IAP call with an LPC24xx processor?

Thanks and regards,
Dave

--- In l..., Timo wrote:
>
> On 12/10/2010 12:44 AM, dave_albert wrote:
> > The IAP_reinvoke_ISP command clearly drops into the ISP and it echoes
> > '?' characters typed, but when it should be sending "Synchronized", I
> > get ASCII garbage (looks like a baud rate or other serial parm mismatch).
>
> I'm reinvoking ISP by doing little more than setting RC oscillator for
> CPU clock, and even that is mainly for FLASH-timings. That works for me
> at 115k2 baud.
>
> I have seen symptoms like your's with different PC serial ports and the
> cure has been to lower the baudrate. The behaviour had nothing to do
> with *reinvoking* the ISP, it happened with ISP invoked at RESET.
>
> --
>
> Timo
>

Hi Daniel,

In one of my follow-up posts I included the code I used to reset registers prior to invoking the IAP call...I (obviously) haven't found the magic register to reset yet. I am looking for confirmation from someone that it is possible to do this successfully on the LPC2468 (I have done it many times on LPC21xx); have you personally been able to re-invoke the ISP via the IAP call *on an LPC24xx processor* ?

Thanks and regards,
Dave

--- In l..., Daniel Widyanto wrote:
>
> Hi Dave,
>
> Before calling the IAP 'reinvoke ISP', you need to return the settings of the
> MCU as in reset mode (especially the clock / PLL settings).
>
> Regards,
> -daniel
> ----- Original Message ----
> From: dave_albert
> To: l...
> Sent: Fri, December 10, 2010 8:20:32 AM
> Subject: [lpc2000] Re: reinvoke ISP on LPC2468 ?
>
> Thank you Igor, unfortunately I am testing this from a very small application
> that never enables interrupts in the first place.
>
> BR,
> Dave
>
> --- In l..., Igor Skochinsky wrote:
> >
> > Hello dave_albert,
> >
> > Thursday, December 9, 2010, 11:44:15 PM, you wrote:
> >
> > d> I have spent considerable time on this without success on an LPC2468.
> > d> The IAP_reinvoke_ISP command clearly drops into the ISP and it
> > d> echoes '?' characters typed, but when it should be sending
> > d> "Synchronized", I get ASCII garbage (looks like a baud rate or other serial
> >parm mismatch).
> >
> > d> Is there a working code example for launching the ISP from code
> > d> for an LPC2468? Philips Apps, are there any errata on this?
> >
> > d> I've tried setting as much as possible to default conditions, if
> > d> anyone sees something obviously wrong, please let me know. Thanks!
> >
> > [snip]
> >
> > Try disabling the interrupts (I'm not seeing it in your code).
> >
> > d> (and yes, I've tried removing various blocks of the above code with no
> >success)
> >
> > d> Thanks for any help/suggestions!
> >
> >
> >
> > --
> > WBR,
> > Igor mailto:skochinsky@
>


The 2024 Embedded Online Conference