Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Problem to send code from PC to pic18F452 with ICD3

Status
Not open for further replies.

Stavros

New Member
Hello
I try to program pic18F452 with MPLAB ICD3. In the pic18f452 LCD.zip i have upload the code that i modified from Wond3rboy's code and simulation with Proteus pro 7. I work with MPLAB IDE v.8.60 and MCC18 compiler.

In Simulation it works with some problems (Didn't display all the string ).

When i try to program pic18F452 in target with ICD3, i use ICD3 as a programmer with Built Configuration in "Release" mode and i have this message:
Programming...
Programming/Verify complete

I also change ICD3 as a debugger with Built Configuration in "Release" mode and program again and then i turn with Built Configuration in "Debug" mode and i press run and i have this error:

MPLAB ICD 3 detected
Connecting to MPLAB ICD 3...
Running self test...
Self test completed
Firmware Suite Version...... 01.26.33
Firmware type......................PIC18F
MPLAB ICD 3 Connected.
Target Detected
Device ID Revision = 00000007

Programming...
Programming/Verify complete

Running...
ICD3Err0040: The target device is not ready for debugging.
Please check your configuration bit settings and program
the device before proceeding.

I check my configuration bits. I read in the section Debug Failure Actions (Troubleshooting>Error Messages> Debug Failure Actions) in the MPLAB ICD3 help. But i don't know what i am doing wrong.

I also try to use MPLAB ICD2 but i have i similar error:

Connecting to MPLAB ICD 2
...Connected
Setting Vdd source to target
Target Device PIC18F452 found, revision = c0
...Reading ICD Product ID
Running ICD Self Test
...Passed
MPLAB ICD 2 ready for next operation
Resetting Target
MPLAB ICD 2 ready for next operation
Programming Target...
...Validating configuration fields
...Erasing Part
...Programming Program Memory (0x0 - 0xE3F)
...Loading DebugExecutive
...Programming DebugExecutive
...Programming Debug Vector
...Programming RSBUG
Verifying...
...Program Memory
...Debug Executive
...Debug Vector
...Verify Succeeded
Programming Configuration Bits
.. Config Memory
Verifying configuration memory...
...Verify Succeeded
Connecting to debug executive
ICD0083: Debug: Unable to enter debug mode. Please double click this message for more information.
MPLAB ICD 2 ready for next operation

Also i have try with pic18f4520 but i have the same error.

When i power on the target the LCD must turn on?

Does someone know why i can't program the pic?
 

Attachments

  • pic18f452 LCD.zip
    84 KB · Views: 359
Hi
Finally i program the pic. The problem was that i put Vee of LCD (pin3) to Vdd=5V so the LCD didn't display anything. When i put it to Ground the LCD works fine.

I still have problem with debug. In my computer show me the error ''ICD3Err0040: The target device is not ready for debugging.'' I test it in other computer and it start debugging but never end until i stop it.

The other problem that i still have is that i can't display all the string (cut some characters at the end) and if i write a very big string i have this error:

MPLINK 4.37, Linker
Copyright (c) 1998-2010 Microchip Technology Inc.
Error - section '.idata_lcdfunc.o' can not fit the section. Section '.idata_lcdfunc.o' length=0x0000015a
Errors : 1

The static const char and overlay char help me to display a large string but not a very big string.

Can anyone help me with this?

I upload the schematic to help others that have similar problem with me.
 

Attachments

  • pic18f452 lcd led schematic.JPG
    pic18f452 lcd led schematic.JPG
    533.7 KB · Views: 1,339
Stavros, you were lucky enough to get an answer from Blueroomelectronics, who had taken the time to look at your circuit diagram. With over 11,000 posts it is likely that he knows what he is talking about, and his answer, while brief and lacking chat, was a direct answer to your problem.

I will concur that C4 is wrong and should not be there at all. (OK, I have used 10,000 pF on the reset line in some cases, but that is 100 times smaller)

The ICD3 has to turn the reset line on and off. A capacitor like that will slow down how fast the reset line can be turned on and off, and the ICD3 has simply not been programmed to wait that long.
 
Hi Diver300 thank you for your advise and those that you explain me about ICD3. I will get rid of C4 as blueroomelectronics told me. I will try and i will tell you if the problem will solved.

I tried yesterday with only R7 (so i get rid of C4, D5 and R8) and the pic programmed OK but when i use ICD3 as a debugger, i press run button, it start debugging but never stop. I press pause button after 15 minutes to stop.

I was wondering if i do something wrong with the process with ICD3 so that maybe make me problem.
I want to ask you if debug start(press run button when i use ICD3 as a debugger) how long it will take to finish?

Also another strange think is that in my computer debugging never start and show me the error ''ICD3Err0040'' but in other computer where i test it, debugging start and finish until i press pause.
 
Last edited:
Try setting breakpoints in your code. The debugger should stop very quicky, also make sure you're not running at 32kHz or things will go really slowly.
 
Your 20MHz crystal should make things fairly snappy. The 452 has no internal osc. I've never used a cap on reset, a 20k resistor is usually all that's required. Make sure you've got the oscillator set to HS in the config settings.
 
OK blueroomelectronics
i will go now to check that you tell me. Will get rid of C4, put breakpoints and i will try to use 20K resistor. And about oscillator i set it in HS to the confiquration bits.
 
Thank you blueroomelectronics very much. I make the test only with R7=10K. I put breakpoints and that help me to see what it was doing. I find out that it stay at the end of the code where i have:
Code:
 while(1);// Wait here
and it stay there. So i think that was the reason that i have to pause the debugging.
Now i will test with 20K resistor and then with only take out C4.


I have just test with 20K resistor and i think now it's better. I can see at the same time in code where is it and the LCD display step by step the possision of the code.

I think it's better with 20K resistor. I will relpace R7 with 20k (i will take out D5, R8 and C4). Thank you very much for your help. I understand more thinks now how it works.

I only have now to find a solution with my code to display strings correct (all the string and not cut character)

I have upload the new schematic for my circuit
 

Attachments

  • pic18f452 lcd led schematic.JPG
    pic18f452 lcd led schematic.JPG
    520.9 KB · Views: 516
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top