P89LPC9221 FAQ

Started by ivan_law80, August 04, 2006, 09:48:54 PM

Previous topic - Next topic

ivan_law80

FAQ: P89LPC9221 Programmer Issue

Hello everybody. I am using P89LPC9221 SMD microcontroller. I have built the programmer circuit similar to MCB900 by Keil. I have measured the waveform of /RST and VDD and they appear the same as mentioned in Flash Magic 3.21 datasheet. However, flash magic always give me this error message when I try to program my P89LPC9221:

Unable to connect at the specified baudrate. Try reducing the baudrate. Reset the hardware into ISP mode again.

I have tried all the available baudrates and T1 & T2 combinations but still face the same problem.

What would be the possible errors?

Please advise. Thanks!

Regards,
Ivan

Andy Ayre

I already sent you some things to check via Email. Did you check them? What did you find? Do you want help via Email OR via this discussion forum?

Embedded Systems Academy, Inc.
support at esacademy dot com

ivan_law80

Hi Andy,

I think we will discuss via this discussion forum.
I have checked my circuit. There are some differences:
In the circuit provided by Keil MCB900, can I replace the transceiver MAX563 with MAX3243? And the PNP transistor PMBTA92 with 2N4403?

Please advise. Thanks.

Regards,
Ivan

Andy Ayre

The MCB900 circuit is tried and tested - it is known to work. But the important thing is the waveforms. Use a scope and check the waveforms in your circuit match the ones in the application note.

Embedded Systems Academy, Inc.
support at esacademy dot com

ivan_law80

Hi Andrew,

The waveform has some difference. I am able to get 3 reset pulse on /RST while VDD is high. However, at the starting point i am not able to get 2 pulse for both VDD and /RST.

I think I know the problem since MAX563 /EN pin will disable RXD only but for my MAX3243 /FORCEOFF will disable both TXD and RXD. Need to replace MAX3243 with MAX563.

While waiting for the missing tranceiver, i am trying to program 89LPC9221 using parallel programmer All-100 by Hi-Lo System. The programming finished successfully to program 89LPC9221-DIP20. However, my program fails to run correctly. The code of my program is as follows, please advise is there is any mistakes in my code:

START:
   CLR   EA      ;DISABLE INTERRUPT   
   MOV   IEN0,#00000000B   
   MOV   IEN1,#00000000B   
   MOV   PCON,#00000000B   
   MOV   PCONA,#00000000B
   MOV   TCON,#00000000B   ;TURN OFF ALL TIMER       
   MOV       TMOD,#00100001B  
   MOV   TAMOD,#00000000B  
   MOV   DIVM,#00000000B   
                MOV   A,TRIM
   ANL   A,#10111111B
   MOV   TRIM,A      
   MOV   SCON,#01010000B   
   MOV   BRGR0,#00H         
   MOV   BRGR1,#30H      
    MOV   BRGCON,#00000011B      
   MOV   IP0,#00010000B   
   MOV   IP0H,#00010010B        
                MOV   IP1,#00000000B          
   MOV   IP1H,#00000000B
   MOV   PT0AD,#00000000B      
   MOV   P0M1,#11111111B   
   MOV   P0M2,#11111111B
   MOV   P1M1,#11011111B        
   MOV   P1M2,#11011111B
   MOV   P3M1,#00000011B    
   MOV   P3M2,#00000011B
   MOV   I2CON,#01000001B         
   ;MOV   RTCCON,#00000000B
   ;MOV   RTCH,#00000000B
   ;MOV   RTCL,#00000000B
   ;MOV   WDCON,#00000000B
   ;MOV   WDL,#00000000B
   ;MOV   WFEED1,#00000000B
   ;MOV   WFEED2,#00000000B
   ;MOV   KBCON,#00000000B   ;DISABLE KEYPAD INTERRUPT
   ;MOV   KBMASK,#00000000B
   ;MOV   KBPATN,#00000000B         
   MOV       TH0,#0FFH      
   MOV       TL0,#0F9H
   MOV   TH1,#0      
   MOV   TL1,#251                      
   CLR   SI
   CLR   CLK
   CLR   LE
   CLR   GCLK
   MOV   A,#SLVADDR
   MOV   DEVADDR,A
   CLR   EX1
   CLR   EX0
   SETB   TR2                     ;START TIMER 2
   SETB   ES                      ;ENABLE SERIAL ISR
   CLR   RI      ;ENABLE RECEIVER
   SETB   TR0      ;START TIMER 0
   SETB   ET0      ;ENABLE TIMER 0 OVERFLOW    SETB   TR1      ;START TIMER 1
   SETB   ET1      ;ENABLE TIMER 1 OVERFLOW    SETB   EI2C      ;ENABLE I2C ISR
   CLR   EX0                    ;DISABLE EXTERNAL ISR 0
   CLR   EX1                     ;DISABLE EXTERNAL ISR 1
   CLR   EKBI      ;DISABLE KEYBOARD ISR
   CLR   EC      ;DISABLE COMPARATOR ISR
   CLR   EB0                     ;DISABLE BROWNOUT DETECTION
   CLR   EWDRT      ;DISABLE WATCHDOG RESET
   SETB   EA                      ;ENABLE INTERRUPT




STENGINE:cpl   p1.7
   cpl   p1.7
   SJMP   STENGINE
                RET

erikm

Oh the eternal issue:

"I replace things in the programmer, why does it not work?"

one answer only: "DUH"

Erik

erik

Andy Ayre

We try to keep this forum for ISP issues only, so you are probably better off posting code related questions to the forum at 8052.com.

Embedded Systems Academy, Inc.
support at esacademy dot com

erikm

so you are probably better off posting code related questions to the forum at 8052.com.

I do not think so, what you show is not 'code', but 'crap', code is commeted.

Erik

erik

ivan_law80

Hi Andy,

I have modified my circuit exactly the same with MCB900 provided by Keil website. Now I am able to program my 89LPC9221 using the following configuration:

Baud rate : 7200
Use DTR and RTS to enter ISP mode
Virgin 89LPC9221
None(ISP)
Protect ISP code

The problem is, when i try to program the second time, flash magic show this error message again:
Unable to connect at the specified baudrate. Try reducing the baudrate. Reset the hardware into ISP mode again.

Please advise. Thanks

Regards,
Ivan :)

frankzyb

Flash Download to MCB900
You can download the HEX file into on-chip Flash ROM of the P89LPC922 device on the MCB900 Evaluation Board.  You need to setup the MCB900 board as described below:

Configure the Jumper Settings for FlashMagic: RUN - OFF, RESET - ON
Connect the COM Port to the PC COM1 interface using a standard 9-pin connector cable.
Connect the MCB900 Board to a power supply (5V .. 9V=, 100mA)
You have two alternatives for Flash programming: use the
Best Regards

ivan_law80

Hi Frank,

Unfortunately, I don't have a MCB900 programmer and Keil's uVision Development Studio.

I am using PV32 by Franklin Software as my compiler and I have built a circuit same with MCB900.

I tried to program my 89LPC9221 using Flash Magic 3.21 with the following settings:

Baud rate : 7200
Use DTR and RTS to enter ISP mode
Virgin 89LPC9221
None(ISP)
Protect ISP code

The problem is, when i try to program the second time, flash magic show this error message :
Unable to connect at the specified baudrate. Try reducing the baudrate. Reset the hardware into ISP mode again.

Anybody has faced this problem before?

Please advise. Thanks

Regards,
Ivan :D


erikm

and I have built a circuit same with MCB900

99.17% of the time the answer is

EXACTLY SAME?? no component substitutions, no "i have this transistor, I'll just use it" etc

Erik

erik

frankzyb

Hi Ivan,

    If you have installed the KEIL uVision3,you can find the schematics of
the latest version  MCB900 in this help file:
X:\Keil\C51\hlp\mcb900.chm  (where :"X" stands for hard disk for the setup).

    You can download a demo version  uVision3 from KEIL.The Keil C51 Evaluation Kit allows you to create programs for all 8051 derivatives.

    The SETUP program is on the following link:
http://www.keil.com/kdl/p3hq3symwqrpthwwzj3v31dctd/files/eval/c51v805.exe

Best Regards