cancel
Showing results for 
Search instead for 
Did you mean: 

[q]writing a byte into flash memory

byounghoon_koh
Associate II
Posted on May 29, 2003 at 22:45

[q]writing a byte into flash memory

7 REPLIES 7
joseph2399
Associate II
Posted on May 17, 2011 at 11:54

Hi,

You can not use the Conventional Programmer from the PSDsoft Express to view the Flash Sectors located in the Page Memory, however, you can use the ''upload'' feature to upload the memory to a file via the JTAG port. Also if you are using memory paging, make sure you setup the PSD Page Register before calling the flash_write_with_poll () function.

byounghoon_koh
Associate II
Posted on May 17, 2011 at 11:54

Hi,

Thanks. I used 'upload' feature but it is not supported for uPSD yet.(Ver. 7.91) I'm still confused for address mapping.

I set direct mapping in PSDsoft and set the common flash address such as

define FLASH_COMMON_XAAA (volatile unsigned char xdata *) 0x9AAA

define FLASH_COMMON_X555 (volatile unsigned char xdata *) 0x9555

and set page by 'UPSD_xreg.PAGE = 0' However, the writing is not completed.

If you don't mind, give me some more advice please.

Best regards,

Byounghoon

byounghoon_koh
Associate II
Posted on May 17, 2011 at 11:54

Hi,

I'm trying to write a byte into primary flash memory. I used the

function flash_write_with_poll - written in DK3200_C_2 for USB.

This is the method I used,

flash_write_with_poll(0x00, 0x30)

0x00 is the address and 0x30 is the data I want to write. However, I can't read 0x30 by Conventional Programmers. I think the modification of the address will be incorrect but I can't fix it.

I'll very appreciate if anyone can help.

Thanks,

Byounghoon

[ This message was edited by: aormaniac on 27-05-2003 02:34 ]

joseph2399
Associate II
Posted on May 17, 2011 at 11:54

''Upload'' through the conventional programmer is not supported, however ''Upload'' via the JTAG port is. It is in the ''STMicroelectronics JTAG / ISP'' menu, there is a pull-down menu under ''Select Operations'', the default setting is ''Program/Verify'', you can click the down arrow to select ''upload'', then specify a file name to upload your Flash memory content to.

byounghoon_koh
Associate II
Posted on May 17, 2011 at 11:54

Oh! It is succeeded!! Thanks a lot!! I misunderstood your advice.

Now, I faced one more problem. I wrote about 20KB hex file into first page of primary memory and confirmed it through JTAG. However, I can't read the file. I tried to read by this way

unsigned char *addr;

unsigned char dat;

~~~~~

addr = 0x8000;

dat = *(addr);

Is it wrong? Confirming the 'dat' After this code, some garbage value is written. I don't know well why operate like this.

Best regards,

Byounghoon

joseph2399
Associate II
Posted on May 17, 2011 at 11:54

Hi,

Have you setup the Page Register before you issued the read?
byounghoon_koh
Associate II
Posted on May 17, 2011 at 11:54

Hi,

Surely, I set up the page by the same way with writing.

UPSD_xreg.PAGE = 0;

The pre-work for this line is below.

include ''upsd3h''

xdata PSD_REGS UPSD_xreg _at_ 0x0200;

Thanks,

Byounghoon

-----

I fixed up this problem!! I should define the address variable as xdata!!

[ This message was edited by: aormaniac on 30-05-2003 17:37 ]