Page 1 of 1

No EEPROM in FlowCode ARM v4

Posted: Wed Nov 09, 2011 4:06 pm
by Odox00
I cant find the EEPROM icon in the menu in FlowCode ARM v4. The bitmap picture is in the Component folder "ARM_EEPROM.bmp" but no c-file or ocx file are found there.

Re: No EEPROM in FlowCode ARM v4

Posted: Wed Nov 09, 2011 5:14 pm
by Benj
Hello,

The supported ARM range of devices do not have EEPROM memory as such. You can however read and write from any spare locations in ROM if you desire.

The C functions to do this are as follows.

Code: Select all

	char read_register(unsigned int address)
	{
		char RetVal;
		volatile char* register_ptr = (char*)address;
		RetVal = *(register_ptr + 0x00200000);		//Add SRAM base address to ICD pointer
		return RetVal;
	}


	void write_register(unsigned int address, char data)
	{
		volatile char* register_ptr = (char*)address;
		*(register_ptr + 0x00200000) = data;		//Add SRAM base address to ICD pointer
	}
Pop the code for the functions into the supplementary code window and then reference the functions by using C code icons.

Or modify one of the custom component C files and then you will be able to call the functions without resorting to C icons.

Re: No EEPROM in FlowCode ARM v4

Posted: Wed Nov 09, 2011 11:05 pm
by Odox00
Tanks!
Think I'm little to much newbie in C (the reason I choose FC) to figure out how to implement those functions. A simple (if there are one) sample code would help me.

Re: No EEPROM in FlowCode ARM v4

Posted: Thu Nov 10, 2011 10:49 am
by Benj
Hello,

Here is the code in the form of a custom component. Copy the C file into your "Flowcode ARM v4/Components" directory before starting Flowcode. Then add the Custom2 component to your program and you should gain access to the functions. Remember that the functions share the program memory space so be careful about which addresses you choose.

Re: No EEPROM in FlowCode ARM v4

Posted: Fri Nov 11, 2011 12:20 pm
by Odox00
I't seems to work except the write function. Can't get it to change the value in an address. Every time I read I get the value of (byte)147. I tried many different addresses but still the same value. I attached the program I made to test the function. Am I doing something wrong?

Re: No EEPROM in FlowCode ARM v4

Posted: Mon Nov 14, 2011 12:25 pm
by Odox00
Got it to work now. Don't know what I did wrong.
If I want the data to stay in the memory after power loss. So I can re-read the last stored values up on restart.

Re: No EEPROM in FlowCode ARM v4

Posted: Mon Nov 14, 2011 12:58 pm
by Benj
Great, glad its working for you now. Data you store in the ROM should be retained during a power cycle.