cancel
Showing results for 
Search instead for 
Did you mean: 

STVD not handling EEPROM data correctly

BCowa
Associate II

I have an issue when I am using STVD with Cosmic to write a value to EEPROM and read it back.

Example code :

/* MAIN.C file

 *

 * Copyright (c) 2002-2005 STMicroelectronics

 */

#include "stm8s.h"

#include "stm8s_flash.h"

@eeprom unsigned char eeValue;

unsigned char ucTemp;

main()

{

FLASH_Unlock(FLASH_MEMTYPE_DATA);

FLASH_ProgramByte(eeValue, 0xAB);

FLASH_Lock(FLASH_MEMTYPE_DATA);

ucTemp = FLASH_ReadByte(eeValue);

}

STVD assembler shows value being written to 0x0000 rather than start of EEPROM at 0x4000.

Cosmic have examined files and have determined that compilation was correct and the elf and map files are OK and they believe that STVD is not handling correctly.

STVD version is 4.3.12

Has anyone got a fix?

2 REPLIES 2
Willunen
Associate III

What is eeValue set to?

this works fine with me:

//@eeprom unsigned char eeValue;
unsigned char ucTemp;
 
FLASH_Unlock(FLASH_MEMTYPE_DATA);
FLASH_ProgramByte(0x4000, 0xAB);
FLASH_Lock(FLASH_MEMTYPE_DATA);
 
ucTemp = FLASH_ReadByte(0x4000);

To be sure, I checked data memory with STVP.

Wilko

BCowa
Associate II

Thanks Wilko. I was not passing address of variable to the SPL as a 32 bit address pointer so it was storing the result at mem addr 0x0000 instead of start of eeprom.

Thanks for getting back though. Cheers, Bruce