cancel
Showing results for 
Search instead for 
Did you mean: 

Data banking (or paging) using Main Flash (256K)

wendell_wm
Associate II
Posted on April 10, 2006 at 19:04

Data banking (or paging) using Main Flash (256K)

5 REPLIES 5
wendell_wm
Associate II
Posted on May 17, 2011 at 11:50

Hi,

I'm developing a firmware using uPSD3334D-40 and Ride 6 as IDE.

Its main feature is: few code (32KB max) - large data (8 pages of 32KB each) and I've had difficults in paged data handling. The memory map was made using PSDSoft Express and is described as follow:

Secundary Flash:

- csboot0..csboot3 (32K - 0x0000 - 0x8000)

Main Flash:

- rs0 (sram) (4K - 0x0000 0x1000)

- csiop (0x7F00 - 7FFF)

- fs0..f7 (paged: 0x8000 - 0xFFFF)

The manual (uPSD3334 - Datasheet) informs that the page selection is made by PSD_Register::PAGE. So, I must use the PAGE field of PSD_REG struct to select the page before using it. The code bellow shows an example of page selection and writting (I guess!!!):

xdata PSD_REGS pr at 0x7F00;

xdatachar* ptr;

char c;

...

{

pr.PAGE = 1; // select page of fs1

ptr = (char *)0x8000; // ptr now points to the base of fs1

for (c = 32; c < 120; c++) //put some content in fs1

*ptr++ = c;

}

This code compiles and run without erros, but when reading the content of page 1 nothing was modified.

There are something more to do about paged memory handling?

If someone have a working code example to share, please help me!

Regards.

Wendell.

vincentchoplin9
Associate II
Posted on May 17, 2011 at 11:50

Hi,

Have you looked at the banking example in RIDE?

It is a fully configured project showing how to use the banking on uPSD devices.

Look there:

C:\RIDE\EXAMPLES\8051\DERIVATIVES\ST_UPSD\UPSD3300\DK3300\BANKING\...

Vincent

wendell_wm
Associate II
Posted on May 17, 2011 at 11:50

Vincent,

Thanks for the answare.

However, the RIDE's example is about CODE banking.

I'm trying to use DATA banking, i.e. pages mapped to DATA space, not code space, like in RIDE's example.

Any other idea?

Wendell.

jdaniel
Associate II
Posted on May 17, 2011 at 11:50

Wendell,

You're almost to the point you need to be, but you've overlooked one very crucial detail. Even though you might map the flash into ''data'' space, that doesn't change the fact that it's STILL FLASH MEMORY. Like any flash memory, it has a complicated programming sequence that you need to use to program each byte. In addition, you have to make sure you ERASE a block before you attempt to program it.

Take a look in the datasheet for the PSD portion of the chip and look at the table on programming the flash. You'll essentialy need to write some commands to the locations first before you attempt to program them. This will also be time-consuming and if your application expected to be able to write to the flash as though it was RAM, you might not be able to do what you want.

-Phaze426

wendell_wm
Associate II
Posted on May 17, 2011 at 11:50

Phaze426,

You're rigth... I've overlooked this crucial detail. Flash memories have a really complicated (and magic :o ) programming sequence. I've modified my code and the benchmarks for ''flash-write'' operations have revealed suitable for my project.

Problem solved.

Thanks everybody.