Please let us know your real question!
When I try to write a reply I get:
You don't have permission to access "http://www.cypress.com/comment/reply/568581" on this server.
This happens if:
1) I try to format test
2) I try to upload an image
3) I try to upload a file
I'm working on programming the internal flash memory of the microcontroller, an MB91F467DA.
I found different informations in hardware manual (table 54.7-1 in http://www.cypress.com/file/250861/download) and in application note AN300034 (see http://www.cypress.com/file/244151/download) about how to write data.
#define wseq_1 ((volatile unsigned int *)0x00041557)
#define wseq_2 ((volatile unsigned int *)0x00040AAF)
unsigned char FLASH_WriteWord(unsigned int adr, unsigned int data)
/* Start FLASH Write Sequence */
*wseq_1 = 0x00AA;
*wseq_2 = 0x0055;
*wseq_1 = 0x00A0;
*((volatile unsigned int *)adr) = data;
Hardware manual (Table 54.7-1):
Write AAAAh at address (adr & FFFC000h) + 1553h
Write 5555h at address (adr & FFFF000h) + AABh
Write A0A0h at address (adr & FFFC000h) + 1553h
Write data at destination address
“adr” is the target address or an address within the target sector
In the first case I write 0x00AA at address 0x00041557, in the latter I write 0xAAAA at offset 1553 in the destination sector.
What are the right commands?
I have to write block of data, could I use Continuous mode set - Continuous writing - Continuous mode
What is the right command sequence?
Thanks a lot
have you tested the code of the Application note? Did it fail?
I think both examples are okay.
As described by the hardware manual (54.7.1 Command Sequences)
" ...Writing the command sequences is possible in byte, halfword or word mode. The table (!) shows halfword data (“F0F0H”) because it simplifies the calculation of the addresses.
The data width used for the 4th bus write cycle of the write command (program address and program data)
determines the write mode of the Flash (byte, halfword or word). ... "
I have attached another example for you. Please check it.
The code I tested works and comes from application note http://www.cypress.com/documentation/application-notes/an205210-fr-family-mb91460-series-flash-writeerase-cpu.
The attached sourcecode contains the folder
The example You attached contains the folder
Thus is more updated, moreover is aligned with the datasheet.
I'll try it.
working code sounds good :-)
Just let me know in case you need additional support.
the code must be in the RAM, for this purpose a pragma is used in the source file:
#pragma section CODE=IDRAM,attr=CODE
the IDRAM section then is copied from flash to RAM by the Start91460.asm setting
#set ID_RAM ON
If I set speed optimization (-K SPEED) the generated section is not IDRAM but IDRAM_4 as the label are aligned to 4 byte boundaries, but is not copied from FLASH to RAM.
To avoid this problem the sample code set the option -Xalign for the entire project.
I'd like to set this option just where I need, i.e. in the Flash.C source file.
Is there a way to specify -Xalign in the source file with a pragma directive?
Thank You and Best Regards
If you are using our Softune IDE for FR, you can configure customized C/C++ compiler setting (like use -Xalign) for one source file only. It is possible to combine common option and custom option for dedicated source files. Please check attached picture for reference.
For detailed description of -align and -Xalign options, please kindly check FR Family SOFTUNETM C/C++ Compiler Manual for V6.