How can I operate the LPC2136 flash so that a portion of its space can be used as EEPROM, like AT24C02
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:
my code2:
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.
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.
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
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:
Could you share me the .ZIP again?
Also, can you provide me the IDE version that you are currently using?
BR
Habib.
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:
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:
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.
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.
This is my function called 'ram_to-flash', please take a look and see if there are any issues
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.