SD Card as USB Mass Storage with TowerK20D72M

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

SD Card as USB Mass Storage with TowerK20D72M

1,422 Views
palakpatel
Contributor I

Hello,

I want to use sd card as usb mass storage device in TWR-K20D72M.

I am using IAR 7.40.3xxx Version.

I guess Freescale USB Stack will be useful in this.

1. I have Downloaded stack from official site.

2. Added Freescale\Freescale USB Stack v4.0.3\Source\Device\app\msd\iar_ew\kinetis_20\USB_MSD project

3. But while importing in IAR, I found this.

error.png

so, i have chosen other debugger file from available.for debugger, i am using PE micro and using 64k_RAM file.

I am not using Flash

After doing this, i am able to load and run code. 

Set up :

1. I am attaching USB Mini cable for power and code loading.

2. I load code and run code

3. Now attaching Board through micro usb cable to my host.

but here, on right side pop up comes as "USB Device Not Recognized".

error1.png"

I have Tried with all Version of USB stack, all Demo (HID,cdc) available in stack.

where i am doing wrong?

Some of My doubts :

1. Please provide all correct jumper connection for my requirement

2. I am doing it with 64k_RAM .icf file.Does this make any sense because originally, stack is using Flash.

3. From where i can have those missed files for debugger and flash loader specified in demo of stack?

4. My method is correct or something is wrong?

Give me best method for sd card as usb mass storage for TWR-K20D72M

Thanks in Advance.

@Primoz REBEC,@ Dawei You,@Nick Nax

#TWR-K20D72M, #Freescale USB Stack

Labels (2)
0 Kudos
6 Replies

736 Views
palakpatel
Contributor I

Hello,

Thank you so much for your reply.

I am moving to KDS due to issues with IAR. I will update you after environment setting and testing.

Thank you so much.

0 Kudos

736 Views
palakpatel
Contributor I

Hello Mark,

Thank you so much for your Reply.

Due to above mentioned errors, utasker was not done.So i have tried to debug code of USB Protocol Stack 4.1

  • I am trying to connect my board as msd right now,then will see for SD card.
  • .After much efforts, i am succeeded to get msd Example works.Now MSD example is showing my K 20 board as Mass storage device in Device manager.But saying Device drivers not installed successfully.
  • If I do same changes with HID example then it shows as Successfully installed Drivers
  • I am not getting Why msd is not getting worked.

Please help to this issue.error5.png

0 Kudos

736 Views
mjbcswitzerland
Specialist V

Hi

USB-MSD doesn't need a driver. if it is not being recognised it means that it is not working fully, but it is only really possible to know why by monitoring the enumeration with a USB analyser. I don't think that the examples work completely but are just to show enumeration (maybe with a little disk in RAM ?).

Have you tried loading the binary at the link I gave to check correct operation?

If you can't get the IAR project to open in your version you can also use KDS (or CW or Keil, Rowley, etc.) or just run the GCC make file. You can also upgrade the IAR version (to a new Kick Start one if you have no subscription) since this version is adequate for USB-MSD (smaller than 32k code).

Regards

Mark

0 Kudos

736 Views
palakpatel
Contributor I

Hello Mark,

Thank you very Much for your Reply.

When I am following steps given by you it shows this error.

error_utasker.pngerror_broken page.png

Another Question is UTasker is OS. Isn't My task possible without any OS???

0 Kudos

736 Views
mjbcswitzerland
Specialist V

Hi

The IAR version is for IAR 7 and I have no problems opening the .eww with IAR 7.70.2. Possibly your 7.40.3 version can't open it since it was saved with 7.70 (? Although I would expect IAR to be better than that - since IAR 5 (which trashed projects when opened with different versions) I think that they got their act together). I have attached an old version for IAR 6 (it will miss a few new project files but these can be added manually) which should at least allow an upgrade.

The project uses a co-operative scheduler. This means that it has some OS advantages (modular development, achieves deterministic behavior and non-blocking using state-event methods) but has lower RAM footprint, faster reaction and generally faster overall operation, combined with easier to achieve total reliability. If you are frightened of OS just think of it as an intelligent main super-loop (and look in main() to see it operating) and you will probably be OK. It is intended for those who want most OS advantages but don't want some of the inherent OS overhead and complications.

The parts can probably be used without the main() if you prefer to replace it with your own but it will lose all simulation capability, will need various software tricks to patch together the modules in a reliable and efficient manner and at the end of the day you will have the same code size but probably a few weeks of redevelopment/redesign, as well as the fact that the framework will then be lacking in 12 years or proven stable operation. The risk is therefore not really worth it and on top of that it will not be able to support it.

Regards

Mark

0 Kudos

736 Views
mjbcswitzerland
Specialist V


Hi

Try pre-built binaries from
http://www.utasker.com/kinetis/TWR-K20D72M.html
to check that your HW is OK.

Complete operating source for USB-MSD to SD card is available at http://www.utasker.com/kinetis.html which includes an IAR project for your board and can be used with an SD card or internal Flash and mixed with various other USB device composites.

Documents and videos at http://www.utasker.com/docs/documentation.html

To build what you want:
1. Open the uTaskerV1.4 project by loading \Applications\uTaskerV1.4\IAR7_Kinetis\uTaskerV1.4.eww to IAR workbench
2. Set the K20 target
3. Set the linker script to \Applications\uTaskerV1.4\IAR7_Kinetis\settings\K_256_64.icf
4. In the header config.h select the target TWR_K20D72M (de-select the one that was originally set) and enable USB_INTERFACE, enable USE_USB_MSD (with or without other USB classes) and SDCARD_SUPPORT
5. Build and load to board - finished
6. To do the same in internal Flash use FLASH_FAT instead of SDCARD_SUPPORT - or enable both to have two MSD LUMs, or use FAT_EMULATION to use FAT emutation techniques instead

There is also a command line shell on the UART which has a DOS like interface for viewing the FAT, as well as doing file analysis function (formatting, creating files and directories, delete/un-delete etc.)

The USB device classes are industrial quality with several years of track record in many products - the complete operation can be simulated in Visual Studio for quality reviews, development, debugging.

Regards

Mark

pastedImage_1.png

0 Kudos