How can I operate the LPC2136 flash so that a portion of its space can be used as EEPROM, like AT24C

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can I operate the LPC2136 flash so that a portion of its space can be used as EEPROM, like AT24C

4,935 Views
jacob3
Contributor I

How can I operate the LPC2136 flash so that a portion of its space can be used as EEPROM, like AT24C02

0 Kudos
Reply
15 Replies

4,882 Views
jacob3
Contributor I

For example, for LPC2136, I can successfully read it by writing to flash first and then reading it, but I failed to read flash alone. So, did I fail to save or read successfully?

my code1:

https://sgw-dx.xf-yun.com/api/v1/sparkdesk/18428095907_4cz0f7mmexport1728876925008.jpg?authorization...

my code2:

https://sgw-dx.xf-yun.com/api/v1/sparkdesk/18428095907_5vdbaammexport1728876927420.jpg?authorization...

 

0 Kudos
Reply

4,905 Views
Habib_MS
NXP Employee
NXP Employee

Hello @jacob3,
In order to support you better, can you provide me more information regarding the propose of your application, for example which peripheral will be writing into this flash or if will be used by the MCU?

BR
Habib.

0 Kudos
Reply

4,877 Views
jacob3
Contributor I
hello,.@Habib_MS ,Please see my latest reply about myself in my post
0 Kudos
Reply

4,880 Views
jacob3
Contributor I
For example, for LPC2136, I can successfully read it by writing to flash first and then reading it, but I failed to read flash alone. So, did I fail to save or read successfully?

my code1:

https://sgw-dx.xf-yun.com/api/v1/sparkdesk/18428095907_4cz0f7mmexport1728876925008.jpg?authorization...

my code2:

https://sgw-dx.xf-yun.com/api/v1/sparkdesk/18428095907_5vdbaammexport1728876927420.jpg?authorization...
0 Kudos
Reply

4,853 Views
Habib_MS
NXP Employee
NXP Employee

Hello again @jacob3,
For company politics we are not allowed to open external links. For code reviewing please help us to share a .ZIP on this thread or you can create a support ticket.

Also, which method are you currently using to write/read the flash, ISP mode or IAP mode?

BR
Habib.

0 Kudos
Reply

4,828 Views
jacob3
Contributor I

This is my code

 

0 Kudos
Reply

4,830 Views
jacob3
Contributor I

Please compare these two codes to help me analyze why the value read is not the same as the value I stored in flash when only reading

1.png2.png

0 Kudos
Reply

4,721 Views
Habib_MS
NXP Employee
NXP Employee

Hello again @jacob3,
For the purpose of supporting you better, I will kindly ask you to continue the communication and comments of this thread in English in order to prevent mistranslations or misunderstandings.
I cannot see the .c files that you provided me, because they are shown as the next image:

Habib_MS_1-1729638827893.png

Could you share me the .ZIP again?
Also, can you provide me the IDE version that you are currently using?
BR
Habib.

0 Kudos
Reply

4,717 Views
jacob3
Contributor I

Last Friday, I already sent you the pictures in this post. Please find last Friday's record and check the relevant code. Please analyze why I cannot successfully save the data in flash using the IAP operation method shown in the picture.

0 Kudos
Reply

4,687 Views
Habib_MS
NXP Employee
NXP Employee

Hello again @jacob3,

According to the first image that you provided me I understand the next flow code (correct me if I am wrong):

You define a pointer that points to 0x4000000 that is the initial section of the RAM and puts 555 in this direction:

Habib_MS_0-1729705360254.png

After, you select sector of the FLASH that you will write, and then is used the function called " RAM_to_FLASH", in order to support you better, can you provide me the code inside this function?

Finally, you make a pointer that will point to the FLASH address (0x1000) and you read the value:

 

Habib_MS_1-1729705360255.png

However, in the debug section can be observed that the variable called "nn" already have the data that you have written in FLASH.

On the other hand, when you write a new image, the flash is erased, taking this in mind, if you read an address before writing, you do not know what data will have.

Also, in the chapter 29.8 called "IAP commands" explains the function of IAP and explains the "IAP Command Summary" that could be helpful.

BR

Habib.

0 Kudos
Reply

4,660 Views
jacob3
Contributor I

This is my function called 'ramtoflash'. Please take a look and let me know if there are any issues

0 Kudos
Reply

4,549 Views
Habib_MS
NXP Employee
NXP Employee

Hello again @jacob3,
I apologize the chapter that I referred you is the Reference manual, where you can find the RM in this page.

When you write a new image Keil erase all flash, independently if you do not erase a specific sector in code.

Also, your function called "RamToFlash" seems fine according to the chapter 29.8.2 called "Copy RAM to flash" in the RM.

BR
Habib.

0 Kudos
Reply

4,665 Views
jacob3
Contributor I

This is my function called 'ram_to-flash', please take a look and see if there are any issues

0 Kudos
Reply

4,668 Views
jacob3
Contributor I

Thank you for your reply, but I would like you to answer two more questions. Firstly, in the second image I sent you, I did not erase the 0x1000 address of the flash. Why can't I read the data I wrote in the first image. Secondly, which article is the 29.8 chapter you mentioned in? Can you provide me with the corresponding PDF or website.

0 Kudos
Reply

4,829 Views
jacob3
Contributor I
IAP
0 Kudos
Reply