TWR-K24F120M flash memory interface

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

TWR-K24F120M flash memory interface

1,140 Views
ahmedzaidi
Contributor I

Hi,
    As twr-k24f120m has 16Mbit memory. my project need more space i decided to interface external flash memory with it and i couldn't find any thing on internet search to connect with it. Now my questions are :

1) Can i interface external memory with this K24?

2) what brand and type i can interface?

3) what range of memory available to interface?

4)How i interface through processor expert KDS?

0 Kudos
7 Replies

666 Views
mjbcswitzerland
Specialist V

Hi

The K24 on the TWR-K24F120M has no FlexBus so there is no parallel memory that can be added (without bit-banging the interface). Other K24 types do have FlexBus.

The TWR-K24F120M does have 2MByte Atmel SPI Flash connected via SPI, which can be used for data storage or file systems. It can't be used for running programs from though.

It is not clear from your question as to which interface you are referring to but the 16mbit Atmel Flash on the TWR-K24F120M is supported in the uTasker project (for FAT and data storage) as are alternatives from Spansion, Winbond, SST and ST (ranges from a few kBytes to 32MBytes).

Regards

Mark

Kinetis: µTasker Kinetis support

K24: µTasker Kinetis TWR-K24F120M support

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos

666 Views
ahmedzaidi
Contributor I

How i can write and read data from SPI Flash connected via SPI ?

0 Kudos

666 Views
mjbcswitzerland
Specialist V

Hi

If using the uTasker framework for the K24 the SPI Flash can be read and written (or deleted) using the low-level routines described on page 13 of http://www.utasker.com/docs/uTasker/uTaskerFileSystem_3.PDF

When starting from scratch you will need to study the data sheet to the SPI Flash in question (they are not all the same since they use differnet command sets and have different memory organisation) and write a driver that uses the SPi Flash's command set to allow the user to pass data to be written and retrieve data form the device from specified SPI Flash addresses.

More advanced features may include the ability to suspend SPI Flash operations that are in progress (deletes can take quite a long time) so that they can be temporarily interrupted in order to continue reading/writing when needed. There is a discussion of this at µTasker Spansion S25FL1xK Driver with Suspend/Resume

Regards

Mark

Kinetis: µTasker Kinetis support

K24: µTasker Kinetis TWR-K24F120M support

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos

666 Views
ahmedzaidi
Contributor I

I am using KDS processor expert. How i can write and read using KDS? i have configure SPI but i need code for read and write from SPI flash ?

0 Kudos

666 Views
mjbcswitzerland
Specialist V

Hello Ahmed

I can't help with PE - it will presumable have configured an SPI interface, which is however only about 1% of the code needed to actually use SPI Flash.

You will need to see whether PE includes any addition support for the SPI Flash itself and add it if it does. If it doesn't, you will need to study the interface the PE has given you and then either write the rest yourself or search the Internet for examples and port these accordingly.

As starting point I have attached the low level interface used by the uTasker project and the ATMEL SPI Flash on the TWR-K24F120M. In order to actually use the Flash a higher level driver interface is required to coordinate the use of the commands and the mapping of address area. On top of that you may need also a file system unless you are doing simple data writes to fixed addresses.

Regards

Mark

Kinetis: µTasker Kinetis support

K24: µTasker Kinetis TWR-K24F120M support

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos

666 Views
ahmedzaidi
Contributor I

I am using this to write on Buffer it is not working, what shout i used to write ?

uint8_t buffer_write[] = "\x84\xFF\xFC\x01\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x20\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12";

 

I can read 528bytes from this command:

uint8_t buffer_read[] = "\x54\xFF\xFC\x01\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF;

Now what is my mistake ? i am writing but getting garbage. I am not getting write numbers.

0 Kudos

666 Views
mjbcswitzerland
Specialist V

H

The command 0x84 is a command to copy data to the buffer 1.

You need to follow this with the command "program from buffer 1 - 0x88" to actually write it to the flash - then you need to poll the status until the write has completed, before reading it back.

The ATMEL Flash chips has quite a lot of options so it it is worth first investing some time to get to understand its command set.

Regards

Mark

Kinetis: µTasker Kinetis support

K24: µTasker Kinetis TWR-K24F120M support

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos