Thanks benp, I'll keep that in mind. However I've been thinking more about why Benj's simple 2 line BoostC examples seemed to fail. Keep in mind that these worked perfectly for me until I reset my ECIO-40P, either with the reset button or by powering down, and then back up. Unlike a normal PIC, the ECIO goes through a BootLoader sequence before relinquishing control to my actual program. Is there a possibility that the BootLoader is somehow messing things up... perhaps even erasing the unused flash locations?
I guess the best way to find out would be to substitute a stand-alone PIC18F device, program it with my MeLabs programmer, and then try resetting the chip and see what happens.
write to flash component
Moderator: Benj
- mytekcontrols
- Posts: 95
- Joined: Sun Aug 19, 2007 6:38 pm
- Location: Santa Rosa, California
- Has thanked: 4 times
- Been thanked: 7 times
- Contact:
Re: write to flash component
Michael St. Pierre
FlowCode V3&V4 Pro Registered User
Manufacture: Heat Load Controllers,
and a variety of other widgets.
FlowCode V3&V4 Pro Registered User
Manufacture: Heat Load Controllers,
and a variety of other widgets.
-
- Posts: 155
- Joined: Sat Mar 28, 2009 5:44 pm
- Location: LYON FRANCE
- Has thanked: 3 times
- Been thanked: 41 times
- Contact:
Re: write to flash component
I have 2 questions:
1-With the benj method, is it possible to write just one byte at one adress?
2-If yes, is it possible to write if the content is anything else than FF?
If 1 and 2 are true, In my opinion, to do this, boostC needs to read 64 bytes in RAM,erase64 bytes, modify one byte in RAM, write 64 bytes. This means 128 writes if you want to modify the 64 bytes(unless boostC optimise the code). In one of my application (gps datalogger), it can be a problem.
Can you point your final working 2 lines because I is now difficult to find the right data in the forum.
If your bootloader really write to flash each restart, your flash can be stressed too...
1-With the benj method, is it possible to write just one byte at one adress?
2-If yes, is it possible to write if the content is anything else than FF?
If 1 and 2 are true, In my opinion, to do this, boostC needs to read 64 bytes in RAM,erase64 bytes, modify one byte in RAM, write 64 bytes. This means 128 writes if you want to modify the 64 bytes(unless boostC optimise the code). In one of my application (gps datalogger), it can be a problem.
Can you point your final working 2 lines because I is now difficult to find the right data in the forum.
If your bootloader really write to flash each restart, your flash can be stressed too...
- mytekcontrols
- Posts: 95
- Joined: Sun Aug 19, 2007 6:38 pm
- Location: Santa Rosa, California
- Has thanked: 4 times
- Been thanked: 7 times
- Contact:
Re: write to flash component
Yes1-With the benj method, is it possible to write just one byte at one adress?
Yes, in my program I was writing the time/date-stamped status of 4 switches into sequential flash memory cells. So in essence each time a switch state changed in hardware, a new sequential line of data consisting of: "month-day-year-hours-minutes-seconds-switch status (single byte snapshot of input port)" was written into the Flash memory.2-If yes, is it possible to write if the content is anything else than FF?
Benj's BoostC code for Flash Read/Write:Can you point your final working 2 lines because I is now difficult to find the right data in the forum.
Read from Flash Memory
Code: Select all
volatile char* register_ptr = (char*)FCV_ADDR;
FCV_TEMP = *register_ptr;
Code: Select all
volatile char* register_ptr = (char*)FCV_ADDR;
*register_ptr = FCV_TEMP;
I don't know if it is, but quite frankly I am at a loss as to what is causing the problem. I really wish that Benj or someone else with good BoostC knowledge would hop in here and give us some better insight on this problem. in the mean time, I have placed an order for a PIC18F4455, and will be trying my code on it to see what happens.If your bootloader really write to flash each restart, your flash can be stressed too...
I was also thinking that perhaps a post in the BoostC forums might get us some answers as well.
Michael St. Pierre
FlowCode V3&V4 Pro Registered User
Manufacture: Heat Load Controllers,
and a variety of other widgets.
FlowCode V3&V4 Pro Registered User
Manufacture: Heat Load Controllers,
and a variety of other widgets.
- mytekcontrols
- Posts: 95
- Joined: Sun Aug 19, 2007 6:38 pm
- Location: Santa Rosa, California
- Has thanked: 4 times
- Been thanked: 7 times
- Contact:
Re: write to flash component
After taking a long hard look at my current project, I decided that I can make due with the available space in the internal 256 byte EEPROM. Because this is much easier to implement within FlowCode, I have opted to fore go the use of Flash memory for my data storage. So for the time being, I will not be putting anymore effort into getting the BoostC Flash read/write code to work properly for my application.
Michael St. Pierre
FlowCode V3&V4 Pro Registered User
Manufacture: Heat Load Controllers,
and a variety of other widgets.
FlowCode V3&V4 Pro Registered User
Manufacture: Heat Load Controllers,
and a variety of other widgets.