dsPIC EEPROM

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
beambase
Posts: 94
Joined: Wed Jul 29, 2009 5:15 pm
Has thanked: 6 times
Been thanked: 8 times
Contact:

dsPIC EEPROM

Post by beambase »

Hello
sorry to have to raise this gain but I realy need to get thiis working
I am doing a project with a 30F6012A in dsPIC using the EEPROM component.
The problem is that I can't write the eeprom more than one time/location...
Even if I put 2 write eeprom macros, and delay between them, the eeprom has result of first write..
Or try the loop which increment the value in eeprom, the value is the first write value..
And even if I program the program memory again, but leave the eeprom intact, I can't write it again, only when I write the program and eeprom memory again, I can write the location once..

I've tried to use both address and data in HEX or decimal format. I've tried different lengts of data and locations and I tried to use borth INT and BINARY format for the data but nothing fixes the problem. Have you actually tested the EEPROM component before releasing it? Do you have some working example of a FC file that uses the EEPROM component that you could post here?

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Re: dsPIC EEPROM

Post by Mikat »

Hi.

I am not sure where the problem is, but at least in 30f reference manual gives different code, than flowcode uses, the code what flowcode uses is in 33/24f series ref manual, Ben or Steve you might know better is that code which is in 33/24f series ref manual and in the flowcode eeprom component, now days compliant at 33f series too (if you have time, look the 33F series ref manual in eeprom section..)?

Mika

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: dsPIC EEPROM

Post by Benj »

Hello,

I've had a bit of a look at the code and can see the 30F examples but they seem to all be assembler based which is causing issues.

Can you tell if the value gets erased. Eg if you pop in a value on the first write and then try to write again is the location 0 or 255 or is it equal to the value you first wrote. Could be there is a problem with the erase portion of the current code on 30F devices.

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Re: dsPIC EEPROM

Post by Mikat »

Ben I saw somewhere in the microchip forum topic, which say that the C30 update was it 3.01b brings functions like write_EE, read_EE at 30F devices, and those should be in c code, and build in functions...
Those should be in compiler manual...
Here is the topic http://www.microchip.com/forums/m416332.aspx
And at attachment has the: CE017 Reading, Erasing and Writing to dsPIC30F Data EEPROM

Mika
Attachments
CE017_DataEEPROM_write_erase_functions_110907.zip
EE_functions
(20.46 KiB) Downloaded 275 times

beambase
Posts: 94
Joined: Wed Jul 29, 2009 5:15 pm
Has thanked: 6 times
Been thanked: 8 times
Contact:

Re: dsPIC EEPROM

Post by beambase »

The data from the first write after programming the chip is still there even if it is read back after turning VDD off and then back on again. But a new write is only possible after that the chip has been reprogrammed.

beambase
Posts: 94
Joined: Wed Jul 29, 2009 5:15 pm
Has thanked: 6 times
Been thanked: 8 times
Contact:

Re: dsPIC EEPROM

Post by beambase »

Hello Ben
Any news on how to get this to work? I am stuck at the moment with this project and I realy need be able to successfully read and write to the eeprom to move forward.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: dsPIC EEPROM

Post by Benj »

Hello,

Right I have done some testing with a dsPIC30F3012 and the EEPROM on this is working correctly and letting me write multiple times with the existing component code.

I will try and get hold of a 30F6012A to do some further testing with this and see if I can replicate the problem your having. However with the device being surface mount its going to be a tricky one for me to test.

Have you had a go at using the custom code functionality to try and edit the code behind the EEPROM component? The links Mikat posted should help. If you get code that works then I can do some testing here with other devices and try to add it into our code base.

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Re: dsPIC EEPROM

Post by Mikat »

Ben, I found following at the c30 3.02 release notes..

Several new functions are defined in libpic30.a for erasing and writing to EEDATA memory.
void _erase_eedata(_prog_addressT dst, int len)

erases EEDATA memory on dsPIC30F devices. The length may be _EE_WORD or _EE_ROW (bytes).
void _erase_eedata_all(void)

erases the entire range of EEDATA memory on dsPIC30F devices.
void _wait_eedata(void)

waits for an erase or write operation to complete.
void _write_eedata_word(_prog_addressT dst, int dat)

writes 16 bits of EEDATA memory on dsPIC30F devices.
void _write_eedata_row(_prog_addressT dst, int *src)

writes _EE_ROW bytes of EEDATA memory on dsPIC30F devices. Source data must be aligned to an integer address.

Example:
#include "libpic30.h"
#include "p30fxxxx.h"

char __attribute__((space(eedata), aligned(_EE_ROW))) c_dat[_EE_ROW];
int __attribute__((space(eedata), aligned(_EE_ROW))) i_dat[_EE_ROW/sizeof(int)];

int main()
{
char c_source[_EE_ROW] __attribute__((aligned(2)));
int i,i_source[_EE_ROW/sizeof(int)];
_prog_addressT p;

for (i = 0; i < _EE_ROW; i++) {
c_source = i; /* initialize char data */
if (i < _EE_ROW/sizeof(int))
i_source = i; /* initialize int data */
}

_init_prog_address(p, c_dat); /* get address in program space */
_erase_eedata(p, _EE_ROW); /* erase a row */
_wait_eedata(); /* wait to complete */
_write_eedata_row(p, (int *)c_source); /* write a row */
_wait_eedata();

_init_prog_address(p, i_dat); /* get address in program space */
_erase_eedata(p, _EE_ROW); /* erase a row */
_wait_eedata(); /* wait to complete */
_write_eedata_row(p, i_source); /* write a row */
_wait_eedata();
}
But the ee_data macros won't pass the compiler, and I can't find the libpic30.h anywhere to include it in my program..
Correct if I am wrong, but shouldn't those ee_data macros be in the libpic30.h file and it should be included?

Mika

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: dsPIC EEPROM

Post by Benj »

Hi Mika,

Not sure about the h file as it doesn't seem to exist in our version of the compiler toolchain.

You could maybe download a standard free release of the latest C30 compiler from Microchip and see if you can move the necessary h and library files into the Flowcode compiler toolchain. The folder is "Flowcode PIC24&dsPIC V4\Tools\C_tools".

Let me know how you get on.

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Re: dsPIC EEPROM

Post by Mikat »

Hi Ben.
Installed the c30 compiler, and managed to get those ee macros through the compiler, but not working..
I don't actually understand how to use that code, so if you kindly could look the readme which is in the CDE017 package, and clarify me how to use those macros.. The prog addressT and init_prog_address is the problem, those is used somehow to point the eeprom address, but I don't know how to use those...

Mika

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: dsPIC EEPROM

Post by Benj »

Hello Mika,

I'm afraid the main reason I haven't chipped in with example code to try is that the Microchip example EEPROM code is on the whole unreadable and seems to throw strange new functions in when and where they feel necessary without any explaination. I will try and find a bit of time this week to sit down and go through what is happening with their code.

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Re: dsPIC EEPROM

Post by Mikat »

Hi.
So I am not feeling myself so stupid anymore :lol: .
I think that the init_prog_address is something which is used to point the address on eeprom, but I don't know should that be "initialized" some way... Because some examples have something like this:

Code: Select all

 void EEPROM_Write (void)
 {
 _prog_addressT p;                        //makes p a pointer 
 _init_prog_address(p, ConfigDatainEE);   //points p to EE space
 _erase_eedata(p, _EE_ROW);        //erase EE data
 _wait_eedata();        //wait
 _write_eedata_row(p, ConfigDatainRAM);   //write the contents of the RAM array to EE
 }

What the heck is the ConfigDatainEE??

Mika

beambase
Posts: 94
Joined: Wed Jul 29, 2009 5:15 pm
Has thanked: 6 times
Been thanked: 8 times
Contact:

Re: dsPIC EEPROM

Post by beambase »

Hello Ben,
any news or a solution to the EEPROM problem with 30F6012A yet?
It would be realy good if there was a solution: Otherwise I have to change chip for this project. Do you know any compatible chip (not 30F6012 since it is not recommended for new designs) that the EEPROM component has been tested on? The minimal requirements would be

-12bit ADC
-Internal CAN controller
-2 UARTS
-EEPROM
-SPI
-minmum 30 I/O
- 5V operation

Held in stock by DigiKey, Mouser, Farnel, RS etc

User avatar
DavidA
Matrix Staff
Posts: 1076
Joined: Fri Apr 23, 2010 2:18 pm
Location: Matrix Multimedia Ltd
Has thanked: 58 times
Been thanked: 258 times
Contact:

Re: dsPIC EEPROM

Post by DavidA »

Hello,

Have you seen the chip selection tool from Microchip? http://www.microchip.com/productselecto ... ector.html

I ran it with your requirements and it came up with the following:
ProductSelector.jpg
(250.91 KiB) Downloaded 1488 times

beambase
Posts: 94
Joined: Wed Jul 29, 2009 5:15 pm
Has thanked: 6 times
Been thanked: 8 times
Contact:

Re: dsPIC EEPROM

Post by beambase »

yes I know about the search tool. The problem is that 30f6011A, 30F6012A, 30F6013A, 30F6014A does not work with the EEPROM component and current compiler.
30F5011 could work. Have you tested it with the EEPROM component?

User avatar
DavidA
Matrix Staff
Posts: 1076
Joined: Fri Apr 23, 2010 2:18 pm
Location: Matrix Multimedia Ltd
Has thanked: 58 times
Been thanked: 258 times
Contact:

Re: dsPIC EEPROM

Post by DavidA »

Hello,

We have not tested the 30F5011 as we dont have any of them available here, the only one out of that list i can say works with confidence is the the 30F4013 as we have it here. We can get some in to order if you wish us to test it with the EEPROM before you order the chip.

beambase
Posts: 94
Joined: Wed Jul 29, 2009 5:15 pm
Has thanked: 6 times
Been thanked: 8 times
Contact:

Re: dsPIC EEPROM

Post by beambase »

Hello,
if possible, a fix for the 30F6012A EEPROM problem would be best. I have already designed a pcb for this chip and I have also spent a lot of time on the code for this chip.
If it not possible to solve the problem, please test the 30F5011 and see if it works.

Thanks.

saschech@gmx.de
Posts: 714
Joined: Wed Jan 31, 2007 12:41 pm
Has thanked: 1 time
Been thanked: 26 times
Contact:

Re: dsPIC EEPROM

Post by saschech@gmx.de »

Hello beambase

I dont no,the v4dspic have these updates inside....
I have these files become in the beta-phase
Inthe moment,I work with a 30F6012A with no probs on eeprom(only adr. 0 work not correct)

rename the org-files to xxx.xxx_org and copy the updat files in the folder,so you can change alltime back

Regards Wolfgang
Attachments
Updates.rar
(73.84 KiB) Downloaded 168 times

beambase
Posts: 94
Joined: Wed Jul 29, 2009 5:15 pm
Has thanked: 6 times
Been thanked: 8 times
Contact:

Re: dsPIC EEPROM

Post by beambase »

It seams to be working. I have tried a small test program that writes and reads the eeprom successfully. Thanks for your help.
These beta files, what release are they part of?

saschech@gmx.de
Posts: 714
Joined: Wed Jan 31, 2007 12:41 pm
Has thanked: 1 time
Been thanked: 26 times
Contact:

Re: dsPIC EEPROM

Post by saschech@gmx.de »

Hello

More and more modified files for all flowcode progs are in the air......nobody no, what is the newest one ; I think.

Exception picV4.5 with a "Temporary fixes for V4.5 PICmicro release "

These updates was bevore start the dspic release to fix the eeprom probs.
My vers. is v4.4.13.69
Regards Wolfgang

Post Reply