Hello,
because of, that the K60N512 has no Data Flash Memory.
Can I save Data, for example the Calibrate the TouchScreen values nonvolatile.
Best Regards
Thomas
Hi Thomas
The K60 has Flash with 2k sector size. This can thus be simply used as data Flash without the need for other types.
The only restriction when writing to memory is that the write size should be long word length.
Regards
Mark
Hello Mark,
thank you for help.
For the MC56F8323 i have a module called IFsh.c to handle the Flash.
I can erase sectors with IFsh1_EraseSector(Address);
And after that I can write words with IFsh1_SetWordFlash.
Have you got something like that for the K60N512 from the tower ?
On which address begins the flash data memory ?
I need this for a bare metal project.
Thank you
Thomas
Hello Thommi
You have the flash drivers for Kinetis, here:
C90TFS_FLASH_DRIVER: TFS Flash Driver Software.
http://cache.freescale.com/files/32bit/software/C90TFS_FLASH_DRIVER.zip?fpsp=1&WT_TYPE=Device Drivers&WT_VENDOR=FREESCALE&WT_FILE_FORMAT=zip&WT_ASSET=Downloads&sr=16
Best Regards,
Hello Luis,
thank you for the link.
I did not find a demo for the CodeWarrior 10.1.
I think its for The IAR Workbench.
The CodeWarrior demo is only for the MCF51JF128.
I need the flash driver for the TWR-K60N512 and the CW10.1
Hello Luis, hello Mark,
I have the K60N512 Tower and so i think i have following flash derivate:
(FTFL_KX_512K_0K_0K == FLASH_DERIVATIVE)
/* Endianness */
#define ENDIANNESS LITTLE_ENDIAN
/* cpu core */
#define CPU_CORE ARM_CM4
/* FTFL module base */
#define FTFL_REG_BASE 0x40020000
#define DFLASH_IFR_BASE 0xFFFFFFFF /* unused */
#define PFLASH_BLOCK_BASE 0x00000000
#define DEFLASH_BLOCK_BASE 0xFFFFFFFF /* There is not DFlash */
#define EERAM_BLOCK_BASE 0x14000000
/* Flash sector size */
#define FTFL_SECTOR_SIZE 0x00000800 /* 2 KB size */
#define PBLOCK_SIZE 0x00080000 /* 512 KB size */
#define DEBLOCK_SIZE 0x00000000 /* 0 KB size */
#define EERAM_BLOCK_SIZE 0x00001000 /* 4 KB size */
This derivate has no d flash. Can i save my values in a special space of the program flash ?
Is the P Flash protected ?
Can I import the SSD to my project (add the .c files and include the .h files) ? And than I can read and write to the flash.
The demo for kinetis K60 and K40 in the C90TFS folder is only for the IAR Workbench.
Have you got a demo for the CodeWarrior ?
Many Thanks
Thomas
Hi,
I think there is not any working example for CW10.1 yet.
Yes, you can save your data in P-Flash as well. Just reserve a flash page for that and remove that page from code in linker file.
Best Regards,
Hallo Luis,
thank you for your request.
First I copied the header files in the folder of my project headers.
Than I added the .c files to my project. I took the code of the NormalDemo.c in my main program.
I can compile my project, but it will not work.
The programcounter jumps in the kinetis_sysinit.c voit isr_default(void)
How do I have to change the .lcf-file.
Do I have to change the length of m_text e.g. in LENGTH = 0x00040000 (256K) instead of 0x00080000 (512K).
So I think I have 256K for D-Flash.
Now I think I can take the NormalDemo.c code of the K40 for my K60N512 project because I have the same P and D Flash as ihe K40X256. Is that correct ?
In the demo project they took the program code in the RAM. I want to lokate it in the flash. Do I have to change something else.
I only need the code for erase, write and read the D-Flash.
Hope you can help
Thomas
Hi,
You can make the flash driver running on CW10.1 as below:
- Take the helloworld example in CW installed folder: \Freescale\CW MCU v10.1\MCU\CodeWarrior_Examples\ARM_Examples\k60\hello_world
- Add driver sources (\Freescale\Standard Software Driver vBeta025\C90TFS\drvsrc) in to that project. Remember to add Paths to project setting
- Add demo source file (NormalDemo.c and NormalDemo.f for example) to the project. Then change main function of the NormalDemo to a different name, and call it in helloworld's main function.
- Change Flash devirative type in SSD_FTFL.h to the value for K60N512 (I assume you want to run the example on TWR-K60N512)
/* Derivative selection */#define FLASH_DERIVATIVE FTFL_KX_512K_0K_0K
That is all. Good luck.
Regards
Hello Dekiru,
the application worsks well in RAM.
What do I have to change if it has to run in Flash ?
Have I to change the Start and End Address of PFlash IFR and DFlash IFR?
Have I also change the linker Command file ?
Thanks Thomas
Hi,
The NormalDemo has a pFlashEraseAllBlock command that will cause exception if you run it from flash.
If you want to use that from flash, you have to modify the demo so it doesn't touch the portion you are using for your app.
Addtional information:
This type of flash doesn't not support read-while-write operation, so you can access the 2nd (upper 256k) bank only while your code is in 1st bank.
To access flash area that is in the same bank with your program, you have to put the code that exexute flash command to RAM. It is only a portion in FlashCommandSequence function. You can choose to put only that some commands
/* clear CCIF bit */ REG_WRITE(PSSDConfig->ftflRegBase + FTFL_SSD_FSTAT_OFFSET, FTFL_SSD_FSTAT_CCIF); /* check CCIF bit */ while(FALSE == (REG_BIT_TEST(PSSDConfig->ftflRegBase + FTFL_SSD_FSTAT_OFFSET, FTFL_SSD_FSTAT_CCIF))) { /* wait till CCIF bit is set */ /* serve callback function if counter reaches limitation */ if(NULL_CALLBACK != PSSDConfig->CallBack) { (PSSDConfig->CallBack)(); } else { /* do nothing */ } }
, or you can put the whole FlashCommandSequence function into RAM.
The procedure to put a function into RAM in Codewarrior was discussed some where else in this forum:
}
#pragma section CopyToRAM end
I tested it with the whole FlashCommandSequence in RAM and it works fine.
Regards
Hello Dekiru,
thank you for your help.
Now I can write into the flash memory.
Reading from flash is also okay.
Sometimes when i debug while I watch the flash with the memory browser the program counter jumps into a isr.
When I did not use the memory browser everything is okay.
My pflash base address is 0x40000. This address is far away from my code. I did not change the LCF. I only have to save
700 words.
Thanks a lot
Thomas
Hi,
That can be the problem with flash cache in early Kinetis revision.
Check this thread if it helps: https://community.freescale.com/message/88872#88872
Regards
Thomas
The uTasker project includes flash drivers for the Kinetis internal Flash as well as for various other external Flash types (I2C, SPI, parallel via FlexBus).
It also allows you to work with the flash as simple file system (for FAT compatibilily a second file system can also be used but the simple one is very often adequate, faster and requires much less code).
The internal Flash in your device starts at 0x00000000. The file system (or low level read/write/erase routines) allow multiple memory types and multiple devices (eg. often multiple SPI Flash are connected to greatly extend Flash with minimum space requirements and cost) to be worked with without needing to know which type is actually being accessed in the file system memory map, or which one of several devices is being accessed physically. This is all described in detail in the following documents:
http://www.utasker.com/docs/uTasker/uTaskerFileSystem_Revision1.pdf
http://www.utasker.com/docs/uTasker/uTaskerFileSystem_3.PDF
http://www.utasker.com/docs/uTasker/uTaskerFileSystemSPI_FLASH_003.PDF
Regards
Mark