pic - PIC30F Data EEPROM reads 0xFFFF first time around -
- After bad read, I checked W1 and it is the correct address
- There is no word in data EEPROM with the value of 0xFFFF <
- < Li> I checked the supply: it is 5.13V
- If I break the table right before the instructions to read the table, and walk through it, then it is okay
- I know that NVMADRU and NVMADR are not included in reading, but I have checked them, and their value reads well and Bad reads do not change between
- This is a DSPICF 30F 05011
- I checked the Errata and did not find any reference to such problem
- I am working through Peakkit II
- MPB 8 debug function, I am working with a PICkit II through the debugging function of MPLAB 8: I reset, then run , And it fails
- If I place the code in tight loop, as long as the value Is not correct and counts the number of iterations, I think that until the loop reads it correctly
EEPROM read code: < / p>
_ReadEEWORD:; -------------------------------------------------- ------------------------------ Read a word from the data EEPROM; Data entry relative to the beginning of the EEPRM entry W0; Exit the W0 word at that place; W1 uses the table pointer; -------------------------------------------- ------ ------------------------------ Start the address of data EEPROM #define DATAEE_START 0x7FFC00; Setup Pointer for EEPROM Memory # 0x7F, W1; Set Table Pointer Move W1, TBLPAG; Add W0, W0, W0 to page with EEPROM; The word address is a byte address mov # 0xFC00, W1; Change in Add W1, W0, W1 to the beginning of EEPROM; To know, nop nop nop; EEPRM data is TubblyL [W1], W0;
solution
The documentation does not say so, however, EEPROM data Before reading you will have to wait for any pre-EEPROM operation.
You can do this in one of the following ways:
1) in C:
#include & lt; Libpic30.h & gt; // EEPROM utilities include _wait_eedata (); // Wait for erase
2) In C, no Lib Import
while (NVMCONbits.WR); 3) In the assembly:
BTSC NVMCON, # 15; If busy (WR bit set) bra $ 2; Go back and wait
Comments
Post a Comment