[SOLVED]Problem regarding flash reading/writing
PROBLEM SOLVED! BUG ELIMINATED AND NOT RELEVANT TO PIC! DISREGARD THIS THREAD!
Hi to all,
I am new to PIC uC and I am using a PIC18F452 that a friend gave me to experiment on while I have an PIC18F27J53 for later use. I've read the specs for programming the Flash memory, although I might not have done the best read of it (sorry, English is not my native tongue). I am using an evaluation board from a different uC manufacturer which works with 3.3V and firstly I am trying to read from the Flash. The connections are as how they should be, /MCLR-VPP able to go from 0 to 12V (it is supposed to be OK by the specs), VDD @ 3.3V (again, the specs they do permit it), VSS, PGD, PGC and PGM (PGM connected to the ground through two 1.2K resistors for non-low voltage programming as it was suggested). For the moment I have written functions that can write the 4-bit commands and the 16-bit data, a function that loads the TABLE POINTER with a specified address and a command that it is implementing the "Table Read, post increment". The problem is that I can read the Device ID bytes (I get 0x26 and 0x04), but when I change the TABLE POINTER to point to the configuration addresses, I get 00s. Sometimes it doesn't work at all, reading always zeros (I know they are OK since the uC that I am using as a experimental programmer has Pull-up resistors and reading big-Z pins would give 0xFF). The strange thing is happening again if I set the TABLE POINTER to point to the Device IDs for a second reading. I've read in a data sheet that the table pointer and table latch retain their values even after a reset, but why I cannot change the TABLE POINTER programmatically for a second time?
Any ideas of what I might be missing? As for writing the Flash, will it be possible to write per byte with the 4-bit commands (consecutive Table Writes after setting EECON1,EEPGD and TABLE POINTER) instead of writing with blocks and without executing core instructions to do the job?
George PS 1: I have attached parts of the code that I use in the board that I intent to use as the PIC programmer and commented where I get weird results PS 2: Sorry, I didn't know that this forum needed HTML tags for text formatting PS 3: I've uploaded a schematic. ANY help would be appreciated!
post edited by gmrs - 2012/01/04 01:17:08