Kwikstik K40 SDCard Code: Demo Project

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Kwikstik K40 SDCard Code: Demo Project

2,707件の閲覧回数
mukesh_rdk
Contributor I

I have a kwikstik k40 rev 5. In this revision it should be possible to read and write to SD card. But i searched the demo projects and could not find one for Kwikstik for sd card. Most of them are either for freedom board or TWR systems.  I tried all the examples from MCUOnEclipse site (like data logger using FatFS)and other forums for various dev board. I could not write to SdCard either in SPI mode or SDHC protocol. I'm using codewarrior 10.6 special edition with processor expert. Tried using KDS 3.0 and processor expert but it didnt work. The card does not even detect.  Generated code returns error while FAT1_init() function. Can anybody let me know whether its possible to write to the card in this board.  I need a demo project either through SPI or SDHC with PE generated code or any example project with successful results. I dont want any rtos or mqx code.

ラベル(1)
0 件の賞賛
返信
10 返答(返信)

1,959件の閲覧回数
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi

Please refer attached ESDHC module example code, which just write data to SD Card without using file system.

If customer want to use FATFS, customer need to refer NXP MQX RTOS example demo.


Wish it helps
Have a great day,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

1,959件の閲覧回数
mukesh_rdk
Contributor I

Hi,

The code that you provided is for K40 tower systems. I'm using KWIKSTIK k40 devlopment board. Can you please provide code for this dev board. When i tried to adapt your code for my controller it throws an error.

0 件の賞賛
返信

1,959件の閲覧回数
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi

Please check below link about KwikStik K40 bare-metal project based on CodeWarrior IDE software:
KWIKSTIK K40 Getting Started

Customer can select one project as a platform project then porting related ESDHC project code to that platform project.

Wish it helps

Have a great day,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

1,959件の閲覧回数
mukesh_rdk
Contributor I

Hello Hui_Ma,

I ported the code for Kwikstik Sd card from your ESDHC demo code. The card is detected but it gets stuck in initialisation. It is at this line in Init_SD_Card() function.

pastedImage_0.png
When I tried to analyse the register SDHC_IRQSTAT, I could see that the command complete bit is set. But the response that I receive, after sending command SD_ACMD41, is 'ff803f' from register SDHC_CMDRSP0. I could not understand what exactly this means. I have attached the debug output below

APP CMD (55)    APP CMD (55)
   Response48 = 120

    SD_SEND_OPCON(A41)    SD_SEND_OPCON(A41) Done

   Response48 = ff803f

Can you let me know what is the expected output here or something is wrong in implementation.

0 件の賞賛
返信

1,959件の閲覧回数
mjbcswitzerland
Specialist V

Hi

pastedImage_0.png

The result is showing that you don't have an HC card - it is useful to collect the OCR value but it is only the CCS bit that is of importance during initialisation. The card can be busy up to 1s during this initialisation phase.

Regards

Mark

0 件の賞賛
返信

1,959件の閲覧回数
mukesh_rdk
Contributor I

Hello Mark,

I use Sandisk 8GB Class 4 SD card. I think this can be classified under HC card. Do you think I need to give more initialisation time for this SD Card?

Can you give me link to the Specification document that you referred to, in previous post. Thanks for guidance!

0 件の賞賛
返信

1,959件の閲覧回数
mjbcswitzerland
Specialist V

Hi

The register has to be read many times until it finally indicates that it is not busy (that is why there is a while loop in the code - this is blocking code so is not recommended unless you are using a pre-emptive operating system because it will stop everything else working while waiting).

In fact the busy bit is still set in your value so the HC details are not yet valid.

Attached is the SD card specification 3.01.

Regards

Mark

0 件の賞賛
返信

1,959件の閲覧回数
mjbcswitzerland
Specialist V

Hi

You can also get KWIKSTIK SD Card support at:

http://www.utasker.com/kinetis/KWIKSTIK.html

Uses powerful utFAT2.0 and requires no porting. Works out-of-the-box with CW, KDS, IAR, Keil, CooCox, Rowley Crossworks, Atollic, Green Hills and allows (approx.) real-time simulation of the KWIKSTICK and SD card.

The pure utFAT2.0 is available at http://www.utasker.com/forum/index.php?topic=1667.0

Documentation: http://www.utasker.com/docs/uTasker/uTasker_utFAT.PDF

Regards

Mark

1,959件の閲覧回数
mukesh_rdk
Contributor I

Hello Mark,

I tried your method from another post for detecting whether Kwikstik supports SD card. I have version 5 Kwikstik and it works. I loaded your bootloader and the SLCD shows display that SD card is detected. When SD card is loaded with code, it shows correct display and executes the code which confirms that SD card works in my Kwikstik. But none of the other demo code works. I want to use your utasker project code. But it uses taskscheduler. How can I use your code for my board just for simple read and write to the sd card.

0 件の賞賛
返信

1,959件の閲覧回数
mjbcswitzerland
Specialist V

Hi

The uTasker scheduler is used to manage the various tasks and functions so that they can be designed in a modular fashion and allows efficient maintenance and general operation. If you remove it you save about 1k of code space but will then have other issues to be solved (requiring dedicated code in each case) which will generally make the overall code size much larger and each project more compicated to manage since it is then each time a special case.

utFAT2.0 can however also work without the scheduler, with the following exceptions:

- formatting disks is performed as a background task with the scheduler - large cards can take several minutes to format in the simple case and even hours to be completely deleted and format. If not realised as a background task the system will be almost unusabled for other things when formatting.

- if FAT 32 fomatted cards lose their INFO bock it is necessary to count free clusters. Again this is realised as a background activity since it can take several seconds each time. Without the scheduler it would cause long blocking delays.

- Managed files would not always be able to be used (therefore a file could not be opened by several application at the same time since the protection and synchronisation mechanisms would not be fully in place)

- Card mounting involves some software timers to control delayed and retries and these would need to be handled by an application layer instead if the scheduler can't automate it

- Card slots without HW removal detection require perodic checking of the card's presence. Thsi woudl need to be implemented at the appliation layer if not automated by the existing scheduler.

All other lower level read / writes can be used by just calling the appropriate utFAT2.0 function, or even its low level driver code.

Note that the SD card is accurately simulated in the uTasker K40 simulator so that development and testing can be performed in (approx.) real-time without any debugging complictions.

Regards

Mark

0 件の賞賛
返信