1. 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.
    Dismiss Notice

AT89S52 chips not validating correctly

Discussion in '8051/8951' started by mik3ca, Feb 27, 2018.

  1. mik3ca

    mik3ca Member

    Joined:
    Jun 24, 2017
    Messages:
    428
    Likes:
    1
    I made myself the followint circuit that is meant to program an AT89S52 chip serially using a PC parallel port:

    circuit.png

    Now I know the parallel port works fine because I used it with my other programmer so that isn't the issue. When I try to program the chip, I look at the leds (shown on the right) and the output isn't what it should be.

    For example, if I only did the following code:

    then all lights should go off after programming but they dont.

    Now in my software end of things, I noticed that when I tried to verify the bytes after chip erasure, failure occurs at different locations. On one attempted erase execution, the validation successfully validated 126 out of 384 bytes and stopped at 127. On another, the erase only validated successfully at 11 bytes and stopped at 12.

    In my program I made it where there is a 10 microsecond delay between the time that any pin changes state. This means that if all lines were low and I wanted to set data to be one and raise the clock then It would take 20uS. 10 to set the data, and 10 to raise the clock.

    I also included a slow mode as well for anything that doesn't process consecutive bytes such as erase. For those operations, I put in a 2mS delay.

    So what is the problem? Is my chip officially garbage or do I need a giant erase time or what?
     
  2. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,710
    Likes:
    421
    Location:
    Brisbane Australia
    ONLINE
    You need to get a programmer that works. You're just guessing where the problem is.

    Mike.
     
  3. mik3ca

    mik3ca Member

    Joined:
    Jun 24, 2017
    Messages:
    428
    Likes:
    1
    I'm starting to think I need capacitors on the clock and input lines to eliminate noise going in. What capacitor values are best?
     
  4. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10


     
  5. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,710
    Likes:
    421
    Location:
    Brisbane Australia
    ONLINE
    And, that's one more guess at whats wrong. Get a working programmer and at least eliminate that.

    Mike.
     
  6. mik3ca

    mik3ca Member

    Joined:
    Jun 24, 2017
    Messages:
    428
    Likes:
    1
    Today I soldered on an additional 47nF ceramic on my PCB across the power lines closer to the micro and that does seem to help since one test passed since the change.
     
  7. HarryC

    HarryC New Member

    Joined:
    Mar 3, 2018
    Messages:
    4
    Likes:
    0
    I haven't used the Atmel parts yet, but OTHER manufacturer's 8052s can be put into Test Mode by fooling around with /PSEN. It's best to leave ALE and /PSEN utterly alone if you're running from internal Flash. Test Mode is NOT documented in the distribution datasheet. Lift a leg or remove the LED that you have hanging on /PSEN and see if that cures it. /PSEN should normally be weakly HIGH (internally) when you're running from internal code space.

    "No, no, no, don't tug on that. You never know what it might be attached to." ~ Buckaroo Banzai

    And I'll echo the other three posters: you're spinning your wheels until you get a working device programmer. If it doesn't program and verify EVERY TIME, then it's untrustworthy.
     
  8. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10


     
  9. mik3ca

    mik3ca Member

    Joined:
    Jun 24, 2017
    Messages:
    428
    Likes:
    1
    Ok this is extremely weird. When I added that 47nF capacitor and hooked my circuit directly to my laptop back parallel port, everything is working.

    Now because my laptop hinges broke, I had to take the lid off and use an external monitor to plug it in to the laptop so I can see what I am doing.

    Now when I try to program the thing, I get the same issues as before. I wonder if all the wires might have something to do with it. I'm thinking radiation that the laptop lid blocked?

    I also tried using a parallel port extension cable as well but that gave worse results.
     
  10. mik3ca

    mik3ca Member

    Joined:
    Jun 24, 2017
    Messages:
    428
    Likes:
    1
    I added a snapshot of my physical layout. The blue monitor cable was recently added because as you can see the laptop lid was removed and I needed a way to see what I'm doing. Also my programmer labelled "circuit" is directly attached to the PC (plugged into the parallel port). The cable on the far left connected to the laptop is a USB cable to my phone. Had I removed the blue cable and had my lid working then the programmer would work. Also, the twisted red and black wire appearing on top of the circuit is the 5V power supply. I twisted it as an attempt to eliminate interference.
    circuit.jpg
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice