There is a custom component and two demo projects which accomplish just that. The easy one (save-recall-exit):
The original demo project which does exactly what you asking:
1. start and reload settings from EEPROM if available, else use default
2. update and save settings
3. re-start and reload last settings
Thank you for the reply. When I try to run this program, the UART port does not activate. In the device manager, all I see is my programmer (MiniProg4) and no other active ports. Is there something I need to do? I know the cable is good and the port is good because my original program is working.
Do I need to do anything with the myEEPROM_lib.cylib folder? Everything complied and programmed without any errors.
I added an EEPROM to your project.
From debugger, it seems to be working,
but without debugger, with my environment, it's difficult to very if it's working.
Anyway, I'll be glad if this can be a hint for how to use EEPROM.
What kit are you using? Below I will assume that it is CY8CKIT-059 Prototyping kit.
Start with basic demo which was last compiled using CY8CKIT-059 prototyping kit
Notice that UART TX output is connected to the specific pin 12_7. This pin is hardwired to the USB-UART converter located on the KitProg. So when you run the program, you should see extra COM port.
The original demo
was compiled for FreeSoc 1 board long time ago, when KIT-059 didn't exist. It doesn't have USB-UART converter built-in, like KIT-059.
In general, to see the COM port on PC one need to have USB-UART converter, as modern computers don't have COM ports available. I usually use FTDI USB-UART dongles with 5V i/o.
I was able to get your example to work. I had a few issues, the EEPROM component in my PSoC Creator 4.3 library was different from the one in the example. When I tried to use the current component, I got programming errors. I noticed something in the readme file and added the library folder as a dependency. I ended up copying and pasting the myEEPROM component from the example into my schematic and then I was able to get it to work.
From the example
From PSoC Creator 4.3
As for the UART, I switched it out for the USBUART and now have an active comm port with live data. I don't have the regular UART pins connected on the PCB, but I am familiar with the RS232-USB adapters.
The kit I am using is in the CY8CKIT-059 5LP.
Thank you for taking the time to modify my code. I will have to chew on it for a bit and try to understand what it is doing. I noticed you are using the standard EEPROM 3.0 component so that makes we want to investigate further.
Thank you both for your help and the quick responses.
Do not use extra EEPROM. The EEPROM component is already included into myEEPROM. Any time a new version of the EEPROM is released, all you need to do is to update components in the project: Project->Update Components and then follow menu commands. Another way is notice a small brown shield appeared in the bottom-right corner. It shows up every time newer version of a component is detected. Click this icon and follow the Update Components menu.
It is likely that Creator 4.3 had updated EEPROM version, and refused to work until Component Update is performed.
If you are using KIT-095 the additional Com port should appear in the menu. You don't have to connect anything to Pin_12 outside. Occasionally this extra com port doesn't want to show and then simple unplugging/plugging from PC usually helps.
Note that if using external adapter, it should not be RS232, which produces -12V and may damage the port. Use only USB-UART rated +5V (+3.3V won't work with KIT-059).
Thank you for the clarification. Currently I'm using the on-board mini-USB and have it set at +5V operation.
Is there any way to force the mini-USB port to use the power from the board and not the computer USB port? My PCB has a 12V and 5V power supply to power outputs, logic and the PSoC, but I've noticed that the PSoC still has power from the PC. The program is still active even though my power supply is off.
Or is there a way to pause the program if no power is detected? I can always unplug the USB cable but that would get annoying after a while.
>Is there any way to force the mini-USB port to use the power from the board and not the computer USB port?
- Not sure, but you can try to cut the +5V on the USB cable. Note that you have grounds and +5V Power supplies PCB to PC connected.
>Or is there a way to pause the program if no power is detected?
-You can check +5 voltage level from the Power supply using a digital pin and send PSoC it into Deep Sleep/Hybernate using API call. That might require some diode between power supply and PSoC. I think that using USB-UART dongle will be simpler. For example TTL-232R-5V-PCB
Do you program KIT-059 using a KitProg or an external Miniprog? Is KitProg still attached to the KIT-059? Do you need UART communication with PSoC other then debugging?
Since I have used some of my time modifying and preparing the sample, I
would appreciate it if you also download and test my sample
and let me know if it works for you or not.
Your sample works as well and it uses the EEPROM component that is included in my PSoC Creator 4.3. There is a lot more going on with your sample so need to educate myself. This is my first experience with PSoC and the trouble I'm having is sometimes the examples don't work with my device or an error is displayed that I have no idea how to address. Thank you again for taking the time because a working example is priceless to a newbie.