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.

Bad chip?

Status
Not open for further replies.

WizzBall

New Member
Hello everyone,

I recently acquired a PIC development board from Futurlec paired with a Pickit2. Last night, I did some very basic testing of the chip (a PIC18F4550) by turning all the port pins on and checking the output voltage.

All the ports were OK except for one (one pin doesn't seem to be able to output the +5V signal - verified on the actual MCU pin as well). Am I to assume that it's just a problem with that particular pin or it could mean that there are potentially other problems with the chip?

I am thinking about sending this chip back as I believe it to be defective, however I'd like to hear your opinion on the matter as well before I do that.

Thank you!
 
Last edited:
Some pins have dedicated uses that have to be turned off and others (E3) are input only. It's very unlikely that you have a damaged chip. Which pin wasn't high?

Mike.
 
Arrrgh! You're right Mike, good thing I didn't pry the chip from the board and send it back! :rolleyes:

And speaking of LVP... when I try to go into debug mode, it asks me if I would like to disable LVP (which I agree to) only to then serve me with a "PK2Error0028: Unable to enter debug mode" error message. What exactly is going on?

And something puzzling - if I program the board from inside MPLAB IDE the program does not work, if however I load the hex file using the Pickit2 programmer it works just fine :confused:.


Florian
 
Hi,

Couple of things worth checking - are you using reasonably upto date software eg MPLab v8.10 and Pickit2 software - Firmware v2.30 and Application v2.50 ? - if not you can download it for free from Microchip.

You say you can program directly from the PK2, but not from Mplab .
Ensure the standalone PK2 program is closed down, before you select PK2 from MPlabs Programmer drop down menu.

Have just run a 4550 from Mplab in programmer and debug mode OK onto my own dev board, so if the above does not cure your problems suggest you post your first few lines of code, including the config statement.


As a byline - the 18F4550 being primarily a USB device, is not the most friendly one to start programming with due its many differences from a more normal pic - if you had chance to get a 4520 it would be easier imho.

Also you might find it easier in the long term, if possible, to change the 40 pin dil socket for a Zif socket - they are not that cheap, but well worth it.

hth

Richard
 
Also you might find it easier in the long term, if possible, to change the 40 pin dil socket for a Zif socket - they are not that cheap, but well worth it.

hth

Richard

Definitely a great tip, that and a breadboard so that you don't need to 'pry' anything off while making quick circuits/adjustments

Which dev board did you get from Futurlec WizzBall?
 
Also bung your 40pin IC into a 40 pin turned socket. The legs on these are a lot stronger than the PIC legs and if you are constantly bunging it in and out of sockets, can make things last a little bit longer.
 
Thank you all for trying to help!

Richard, I use MPLAB 8.10, Firmware 2.32 and Application 2.55.

Maybe I explained things the wrong way - I can 'program' it in MPLAB except the board/chip doesn't seem to do anything once I flip the switch in the 'Run' position. Now, when I load the hexfile using the Pickit2 Application it works as expected. The PK2 program is closed btw.


The code is below...
Code:
#include <p18cxxx.h>

#pragma config WDT = OFF

void main (void)
{
  /* Make all bits on the Port B (LEDs) output bits.
   * If bit is cleared, then the bit is an output bit.
   */
  TRISB = 0;

  /* Reset the LEDs */
  PORTB = 0;

  /* Light the LEDs */
  PORTB = 0xFF;

  while (1)
    ;
}

I will change to a ZIF socket in the future perhaps, for now I will continue to use the board as it is.

Gramo, the board is the following, although I can not recommend with a clear conscience that you acquire it from Futurlec (or anything else besides simple electronic components for that matter):

PIC18F4550 Development Board


Picbits, I got a couple of extra 18F4550's sitting around waiting to be used, I might try 'bunging' them as soon as I can figure out what is it you're advising me to do :).
 
Hi,

Maybe I explained things the wrong way - I can 'program' it in MPLAB except the board/chip doesn't seem to do anything once I flip the switch in the 'Run' position. Now, when I load the hexfile using the Pickit2 Application it works as expected. The PK2 program is closed btw.

Sorry, misunderstood things there - however worth checking which versions you are using.

I'm not into C so cannot actually replicate your work, I suspect the following is happening, might be wrong - but I'm sure others will help and correct me if thats the case; - I think when you program directly from the PK2 programmer, it reads the chip type in the socket and is then applying default 18F4550 parameters to your hex code which lets the program run correctly.

When you output from Mplab, you have the header 18cxxx, which from assembler would call up the 18Fc452 chip details - think if you change that include to 18F4550 it will work fine.

Would also add in some extra config statements to ensure LVP is turned off ,etc, etc CONFIG LVP=OFF


Richard
 
Gramo, the board is the following, although I can not recommend with a clear conscience that you acquire it from Futurlec (or anything else besides simple electronic components for that matter):

PIC18F4550 Development Board

Cheers

I'd agree with you on the 'can not recommend with a clear conscience', especially considering how much better there is out there

If you have your PK2, then just use a breadboard for your development, its hands down easy.

**broken link removed**
 
Richard, I included the correct file name and I get the same results (meaning no results). I also put the Config LVP = OFF line in my code but without any (positive) results. This has to be the most puzzling problem I have been faced with so far when dealing with PICs.

Gramo, I'll get another connector and make myself one of those cables :D.
 
Hi,

I included the correct file name and I get the same results (meaning no results). I also put the Config LVP = OFF line in my code but without any (positive) results.

I feel sure its just a small C / MpLab problem, but afraid I just don't know what that is.

Hopefully a more experienced member can come in and help to get you runnning properly ...


Richard
 
I am a little confused here. Am I right that you have a Futurlec board with a built in ICD2 clone, and a PICkit2 ?

Which programer are you using on what chip?

When posting code here (or debugging) it is better to use the correct .h file instead of #include <p18cxxx.h>.

...
You need to answer the above questions even if the answer is clear to you.

But given what you already said I am guessing that the config setup in the PICkit software is right but not that in MPLAB. Most possibly for choosing the osc.

3v0
 
Last edited:
I not able to test this but I think it should work,
Code:
#include <p18f4550.h>
#include "delays.h"

#pragma config WDT = OFF, FOSC = INTOSC_HS, LVP=OFF

void main(void){
    OSCCON=0x72;       //8 MHz internal clock
    ADCON1=0x0f;       // all digital
    CMCON=7;           // no comparators
    TRISB=0;           //all output
    while(1){
        LATB=0xff;
        Delay10KTCYx(100);	//delay 1,000,000 cycles = 0.5 seconds
        LATB=0x00;
        Delay10KTCYx(100);	
     }
}

Make sure that under configure->configuration bits the "configuration bits set in code" option is checked.

Mike.
 
Thank you all, the problem is solved! :) I was thinking about what 3v0 said about MPLAB not choosing the oscillator properly and I introduced the oscillator setting that Mike provided (it sets the PIC oscillator to the internal one and for USB clocking it uses the HS oscillator FOSC = INTOSC_HS).

That was it! Now my code looks like this and it behaves properly when programmed into the PIC18F4550 from MPLAB. I can now go try my hand at taming this beast in (relative) peace :D.



Code:
#include <p18f4550.h>

#pragma config WDT = OFF, FOSC = INTOSC_HS, LVP=OFF

void main (void)
{
  /* Make all bits on the Port B (LEDs) output bits.
   * If bit is cleared, then the bit is an output bit.
   */
  TRISB = 0;

  /* Reset the LEDs */
  PORTB = 0;

  /* Light the LEDs */
  PORTB = 0xFF;

  while (1)
    ;
}
 
Good to hear it's working. It's amazing how often the problem turns out to be the config settings.

Mike.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top