Author |
Topic |
|
hartog
USA
4 Posts |
Posted - 12/19/2005 : 15:17:22
|
This topic has been discussed under the topic "bad eeprom program with topwin and 16f877" and at least one other topic name. I am posting it as a new thread, because I think I have gained some insight into the problem and I'm hoping to draw the attention of someone that can fix it in the TopWinEn software. Jump to the bottom to skip the background and go stright to the problem description.
PROGRAMMING THE DEVICE: ----------------------- According to the Microchip spec, DS30262e (http://ww1.microchip.com/downloads/en/DeviceDoc/30262e.pdf) the PIC16F8x devices program in serial mode thru RB7 and RB6. The programmer clocks in one of several programming commands listed below. Some of these commands are followed by data words. * Load Configuration <-- for config data * Load Data for Program Memory <-- for program data * Read Data from Program Memory * Increment Address * Begin Erase Programming Cycle * Begin Programming Only Cycle (PIC16F84A only) * Load Data for Data Memory <-- for EEPROM data * Read Data from Data Memory * Bulk Erase Program Memory * Bulk Erase Data Memory Note specifically that there is a separate command for "Load Configuration" and for "Load Data for Data Memory".
THE HEX FILE REPRESENTATION --------------------------- MPLAB and the Microchip specifications use the following convention for address ranges in the HEX file. (Note that these are word addresses that correlate to the PIC documentation. The HEX file uses byte addresses, so the values appearing the HEX file will be twice the values appearing below.) 0x0000 thru 0x1fff -- program memory range 0x2000 thru 0x200f -- configuration memory (ID and config words) 0x2100 thru 0x21ff -- data EEPROM memory
THE PROBLEM ----------- Based on my observations, it appears to me that the TopWinEn software uses the "Load Configuration" command for the 0x2100 range instead of the "Load Data for Data Memory" command. This would explain why the EEPROM data from the hex file seems to get loaded into the 0x2000 address range instead of the 0x2100 address range.
(Note that the EEPROM is not actually implemented at the 0x2100 address range within the device. This address range is simply used by MPLAB and the programmer to identify the data as EEPROM data so that the programmer can apply the correct programming command to the device.)
Does anyone know how to get in touch with the programmers of TopWinEn to ask them to look into this issue? I can't even access their website "http://www.ty51.com". When I try, I get a "You are not authorized to view this page" message.
Any help would be appreciated.
--Scott |
|
Reply #1
ZLM
2945 Posts |
Posted - 12/19/2005 : 17:38:51
|
The site seems down today. The linke works before. The link is the programmer's manufacturer site.
|
|
|
Reply #2
ZLM
2945 Posts |
Posted - 12/20/2005 : 12:40:32
|
I got one PIC16F84A and tested the programming between PICStart Plus and the TOP2004. The differences between PIC16F84 and PIC16F84A is the speed only.
First step I filled the code, data, configuration and the user ID memory in the MPLAB 7.21IDE buffer. Then I programmed those info into the PIC16F84A by PICStart Pluse programmer from the MPLAB IDE.
Second step I read the chip from the TOP2004, and it seems all read are correct: code, data, config bits, and the ID. That's to say the TOP2004 will read the PIC16F84A correctly. the data address started from the TopWin buffer from 4000H. There is no config buffer displayed in the TopWin for this device, the config bits are displayed in the windows by check boxes. That is fine,I can ignor the way how TopWin represents and data on PC for now, as lonag as it can read the chip correctly.
Third step, I erased entier info in the chip from TOP2004. Then I filled new code, data, config bits and user ID to the TopWin's buffer and the W/R windows. And then I programmed those info to the chip from TOP2004. I use the MPLAB IDE read the chip on the PICStart Pluse programmer, and I found the code, data, config bits are correctly read. But the ID seems not been read from MPLAB IDE, I do not know how to read the ID from the MPLAP IDE.
Up to this point, I'll say the TOP2004 is able to program the PIC16F84A chip. I think this will apply to PIC16F84 chip too.
However, after I saved the info to an hex file from the TopWin and re-open it by the MPLAB IDE, then I found the configuran bits are not restored from the hex file, but the both code and the EERPOM data are correctly displayed in the MPLAB IDE buffer.
|
Edited by - ZLM on 12/20/2005 14:43:04 |
|
|
Reply #3
hartog
USA
4 Posts |
Posted - 12/20/2005 : 17:01:45
|
Hi ZLM,
Thanks for looking into this.
MPLAB uses 4000H for the configuration data (ID and CONFIG words). TOP2004 programs the config word correctly. It can't also use the 4000H for the EEPROM data.
Are you saying that the TOP2004 programmer programs the 4000H record (for MPLAB, this is the ID and CONFIG data) into the data EEPROM and ignores the 4200H record? Then the TOP2004 programs the ID and config words from the GUI values -- completely independent of any record from the HEX file? Now I starting to understand your explanation in the other thread.
This would fit my observations. If so, I could work around the problem by manually deleting the 4000H record (ID and config words) from my MPLAB HEX file and moving the 4200H records (data EEPROM) down to 4000H. Does this seem correct?
It seems fairly standard to use 4000H for config data and 4200H for data EEPROM data. It is even written that way in the Microchip documentation. In order for EEPROM data to simulate correctly in MPLAB, it must be preceded by "org 0x2100" or 4200H. If you try to put it at "org 0x2000" or 4000H, MPLAB complains and does not simulate correctly. Is there any chance of getting the TopWinEn programmers to change this to match the convention? If so, they could also read the configuration word from the HEX file (at 4000H) instead of having the user enter it into the GUI (or at least initialize the GUI values from the HEX file). I have no idea how to contact them to suggest this.
Thanks for taking the time to enlightening me.
--Scott |
|
|
Reply #4
ZLM
2945 Posts |
Posted - 12/24/2005 : 17:21:51
|
Yes. The TopWin uses GUI's setting to program the Config and ID byte. Also, it does not save those info into hex file. The data section seems fine on both save and write operation.
|
Edited by - ZLM on 12/24/2005 17:23:16 |
|
|
|
Topic |
|
|
|