When I use BDM debug the MCU,the eeprom can be written,but when I disconnect
the BDM and restart the MCU,the eeprom can not be written.I do not know
why?Please help me,thanks.
The .prm is:
/* This is a linker parameter file for the MC9S12G128 */
NAMES END /* CodeWarrior will pass all the needed files to the linker by command line. But here you may add your own files too. */
SEGMENTS /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */
/* Register space */
/* IO_SEG = PAGED 0x0000 TO 0x03FF; intentionally not defined */
/* RAM */
RAM = READ_WRITE 0x2000 TO 0x3FFF;
/* D-Flash */
DFLASH = READ_WRITE 0x000400 TO 0x0013FF;
The .prm file is as usual.
The most probably there is a problem with a register which is Write Once in Normal mode (no BDM connection).
Here is the S12G Examples Pack and there is one demonstrating EEPROM E/W routines. The project is made for S12GN32 derivative, but the main.c source code can be used on S12G128 as well. Of course, the difference is the EEPROM size and so the end memory address.
Hope it helps.
regards,
iggi