URGENT: Problems with Flash Magic and 89c668

Started by Enrique Moreno, August 08, 2003, 02:19:15 AM

Previous topic - Next topic

Enrique Moreno

Hi,
I have experienced some problems when programming P89C668 with Flash Magic.
Everything has been going on quite well until my code is bigger than 6Kbytes. In this case, block 0 is left unprogrammed or it is programmed to 0s. If I split de hex file into two and I try programme the uC in two times, then the first one is correctly programmed but when I programme the second HEX file then the data programnmed the fist time is erased. This is an awkward thing. Is it that Flash Magic is limited to a maximum of 6K bytes of code? If so, it is not pointed out anywhere in www.esacademy.com download page.
I am in a hurry and I need to programme my chip and test it right now. Please, help me.
Is it necessary to pay for a full working version? (I would do)
What about WinISP from Philips?

Andy Ayre

Hi Enrique,

When you programmed the second hex file did Flash Magic warn you that you were programming without erasing? If not then you still have Flash Magic set to erase something, and that is probably why your first hex file is dissappearing from the device.

When you program your hex file that is larger than 6k, which part of flash block 0 is unprogrammed? What address range? Does Flash Magic report any errors?

Please go to the Flash Magic web page, open application note 4 (what to do if ISP does not work) and perform the steps in section 5 (titled last resort). When performing those steps, only erase and program the hex file that is over 6k. When Emailing me the results also include the hex file itself and the answers to the questions above.

Flash Magic is limited to 96k of code in order to support the 89C669.

Andy

Embedded Systems Academy, Inc.
support at esacademy dot com

Enrique Moreno

Hi, Andrew:

Well, I think I have found the reason I got the 89C668 badly programmed.
This week-end I have been keeping on writing my code, so that it has grown far beyond 12 Kbytes. As I could not programme the previous version and make a real test, I decided to just simulate. But then I wanted to have a new try, and -to my surprise-  this time I got the uC programmed OK. Flash Magic did a good job and there is no limitation in code size. Really puzzling, so I went back to the old file and once again I had the same problem. Then I made a programm with a macro that just generated data in the desired amount. I got several HEX files of different sizes and all  of them got properly programmed. Then I realized that my original code provided IAP support. As part of it, I detected if some conditions were met at reset; if so, block 0, status byte and boot vector were erased and the program waited for some commands to programme new code.
I modified my program and removed that part of my IAP code, and then my chip got programmed properly. It seems that Flash Magic always did a good job and that the problem was in my code. But the point is why my program got executed after programming if that option was not selected in Flash Magic, but even so it should not meet the condition to erase block 0 (a P2.4-5-6-7 at 0101, but are left floating as inputs when programming). Furthermore, in the present versions of my program  I have kept the IAP support exactly as it was before and I have got no problems when programming the 89C668 (as I did not have any with the previous versions to that puzzling one).
Really ackward.

Andy Ayre

Are you sure P2.6 and P2.7 are floating while programming? Why not temporarily pull them high during programming and check the voltages on the actual pins. If either of those pins was regarded as a logic 0 then strange behavior can occur.

Otherwise, I don't know why you were seeing the problems you were seeing. Unless you were using DTR and RTS to control /PSEN and RST, or you had the option in section 4 checked to execute the code, or you had the watchdog enabled, then your code should not have executed automatically after programming. Maybe you have some glitches on the RST pin or VCC?

Embedded Systems Academy, Inc.
support at esacademy dot com