SDCARD example issues

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

SDCARD example issues

1,378 Views
Mohsin455
Contributor IV

Hi All,

 

           I am using K60N512 Tower kit and MQX3.8. I am trying to use the SCARD example. I have enabled the following flags

 

#define BSPCFG_ENABLE_ESDHC      1

 

When I run the code I get the following screen and I can read the contents of the SDCARD using dir command.

 

The problem is when I try to do a read I get the following message.

 

 

 

SD card demo

Shell (build: Jan 24 2012)
Copyright (c) 2008 Freescale Semiconductor;
shell>
shell> SD card installed to a:

shell> dir
                    0 01-01-1980 00:01:02      A
TEST.TXT           16 01-24-2012 10:34:58      A TEST.TXT
TEST2.TXT          17 01-24-2012 10:35:20      A TEST2.TXT
shell> read a:\TEST.TXT
Error, unable to open file a:\TEST.TXT.
shell>

shell> read TEST.TXT
Error, unable to open file TEST.TXT.

shell>

shell> pwd
a:\
shell>

 

Can anyone please let me know how to do read/write using shel commands ?

 

Thanks,

Mohsin

0 Kudos
6 Replies

615 Views
Mohsin455
Contributor IV

Hi,

 

     Can anyone please let me know if they are having similar issues ?

 

Along with the read problem, I am having the following issues

 

I am using microSD card. When I copy the files (e.g.  test.txt) from Windows XP into the microSD card and display it using the shell program I am seeing .TXT.

 

I tried formatting it from the shell and the format went ok but still I am having the same issues. Can anyone please advise whats going on ?

 

 

Thanks,

Mohsin

 

0 Kudos

615 Views
mjbcswitzerland
Specialist V

Hi

 

If you can look at the sectors on the SD card you may be able to interpret why the effects are seen (confirm whether the file entries are really written like that or whether there is some obvious corruption etc.).

 

Assuming this is possible, there is a guide to understanding the data here: http://www.utasker.com/docs/uTasker/uTasker_utFAT.PDF

 

You can also try a reference binary here: http://www.utasker.com/SW_Demos.html which will allow you to read the content and also reformat the card (K60 Tower assumed) and see whether it then operates correctly (it allows interfacing similar to DOS and also managing files via FTP). This would distinguish whether the problem is at the SW or HW level.

 

Regards

 

Mark

 

 

0 Kudos

615 Views
Mohsin455
Contributor IV

Hi Mark,

 

                  Thanks very much for your reply. I will try loading the binary but the diference is I am using SDHC interface. I am getting similar resuls on the TWRK60N512 and custom board so I was wondering if there is any restriction to use microSD card (i.e size, make etc).

 

Regards,

Mohsin

0 Kudos

615 Views
mjbcswitzerland
Specialist V

Hi Mohsin

 

SDHC and SPI modes should give same results on almost all cards (size is not important and manufacturer shouldn't be either - uSD card can be inserted into an adapter to fit full-size SD card sockets); some new high speed card may no longer support SPI mode (although I didn't encounter such a card yet) so SDHC should be less troublesome in any case.

 

It is also useful to have a range of test cards (different memory sizes, from different manufacturers) for comparison should unexpected results be obtained.

 

Regards

 

Mark

 

 

 

0 Kudos

615 Views
Mohsin455
Contributor IV

Hi Mark,

 

                I have tried downloading the uTasker binary using CW -> Flash File to Target and I am getting the following message

 

Erasing Sector 0x0001C000 to 0x0001C7FF   
 Erasing ...
 Erase Command Succeeded    
cmdwin::fl::write
 Beginning Operation ...    
-------------------------
Using restricted address range 0x00000000 to 0x0007FFFF   
Programming file D:\K60_Tower_Kit\uTaskerV1_4-014.bin   
Auto-detection is successful.   
  File is of type Binary/Raw Format.   
 
 Downloading Flash Device Driver ...   
 Reading flash ID ...
Auto-detection is successful.   
  File is of type Binary/Raw Format.   
 
Downloading 0x0000EE98 bytes to be programmed at 0x00000000   
Executing program ....   
Error:  Program failed.   Flash driver reports the following error(s):  Security area can not be programmed
 
Error: Program failed. Flash driver reports the following error(s):  Security area can not be programmed

 

Any clues whats happenning ?

 

Regards,

Mohsin

0 Kudos

615 Views
mjbcswitzerland
Specialist V

Hi Mohsin

 

I just tried with CW10 to see whether I could reproduce the problem but it worked OK (although it does take quite a long time - about 2 minues).

 

The console output that I had is below, as comparison.

 

I also made a screen shot of the Flash Programming dialog. It looks a bit different - I am using CW10.1 (version 1.0.0) and you may be using a newer version.

Also the code started correctly (once you get it loaded, use the serial menu at 115k or also connect to the board via Telnet - default IP = 192.168.0.3 - and go to the SD card menu. Then you will have a DOS-like interface).

 

This seems to be a CW problem (or a target configuration one) so it may be workth asking in the CodeWarrior forum what is going on.

 

Regards

 

Mark

 

 

 

CONSOLE OUTPUT when programming

 

fl::target -lc "MK60N512VMD100_INTERNAL_FLASH_PnE OSJTAG"
fl::target -b 0x20000000 0x10000
fl::target -v on -l off -ie on -i "" -p MK60N512VMD100
cmdwin::fl::device -d "FTFL_PFlash512" -o "128Kx32x1" -a 0x0 0x7ffff
cmdwin::fl::image -f "C:\\MJBC\\Internal\\temp_to_delete\\K60_Tower_Kit\\uTaskerV1_4-014.bin" -t "Auto Detect" -re on -r 0x0 0x7ffff -oe off
cmdwin::fl::erase image
 Beginning Operation ...    
-------------------------
Auto-detection is successful.   
  File is of type Binary/Raw Format.   
 
Initializing remote connection ...    
Performing target initialization ...    
 Downloading Flash Device Driver ...   
 Reading flash ID ...
Erasing Sector 0x00000000 to 0x000007FF   
Erasing Sector 0x00000800 to 0x00000FFF   
Erasing Sector 0x00001000 to 0x000017FF   
Erasing Sector 0x00001800 to 0x00001FFF   
Erasing Sector 0x00002000 to 0x000027FF   
Erasing Sector 0x00002800 to 0x00002FFF   
Erasing Sector 0x00003000 to 0x000037FF   
Erasing Sector 0x00003800 to 0x00003FFF   
Erasing Sector 0x00004000 to 0x000047FF   
Erasing Sector 0x00004800 to 0x00004FFF   
Erasing Sector 0x00005000 to 0x000057FF   
Erasing Sector 0x00005800 to 0x00005FFF   
Erasing Sector 0x00006000 to 0x000067FF   
Erasing Sector 0x00006800 to 0x00006FFF   
Erasing Sector 0x00007000 to 0x000077FF   
Erasing Sector 0x00007800 to 0x00007FFF   
Erasing Sector 0x00008000 to 0x000087FF   
Erasing Sector 0x00008800 to 0x00008FFF   
Erasing Sector 0x00009000 to 0x000097FF   
Erasing Sector 0x00009800 to 0x00009FFF   
Erasing Sector 0x0000A000 to 0x0000A7FF   
Erasing Sector 0x0000A800 to 0x0000AFFF   
Erasing Sector 0x0000B000 to 0x0000B7FF   
Erasing Sector 0x0000B800 to 0x0000BFFF   
Erasing Sector 0x0000C000 to 0x0000C7FF   
Erasing Sector 0x0000C800 to 0x0000CFFF   
Erasing Sector 0x0000D000 to 0x0000D7FF   
Erasing Sector 0x0000D800 to 0x0000DFFF   
Erasing Sector 0x0000E000 to 0x0000E7FF   
Erasing Sector 0x0000E800 to 0x0000EFFF   
Erasing Sector 0x0000F000 to 0x0000F7FF   
Erasing Sector 0x0000F800 to 0x0000FFFF   
Erasing Sector 0x00010000 to 0x000107FF   
Erasing Sector 0x00010800 to 0x00010FFF   
Erasing Sector 0x00011000 to 0x000117FF   
Erasing Sector 0x00011800 to 0x00011FFF   
Erasing Sector 0x00012000 to 0x000127FF   
Erasing Sector 0x00012800 to 0x00012FFF   
Erasing Sector 0x00013000 to 0x000137FF   
Erasing Sector 0x00013800 to 0x00013FFF   
Erasing Sector 0x00014000 to 0x000147FF   
Erasing Sector 0x00014800 to 0x00014FFF   
Erasing Sector 0x00015000 to 0x000157FF   
Erasing Sector 0x00015800 to 0x00015FFF   
Erasing Sector 0x00016000 to 0x000167FF   
Erasing Sector 0x00016800 to 0x00016FFF   
Erasing Sector 0x00017000 to 0x000177FF   
Erasing Sector 0x00017800 to 0x00017FFF   
Erasing Sector 0x00018000 to 0x000187FF   
Erasing Sector 0x00018800 to 0x00018FFF   
Erasing Sector 0x00019000 to 0x000197FF   
Erasing Sector 0x00019800 to 0x00019FFF   
Erasing Sector 0x0001A000 to 0x0001A7FF   
Erasing Sector 0x0001A800 to 0x0001AFFF   
Erasing Sector 0x0001B000 to 0x0001B7FF   
Erasing Sector 0x0001B800 to 0x0001BFFF   
Erasing Sector 0x0001C000 to 0x0001C7FF   
 Erasing ...
 Erase Command Succeeded    
cmdwin::fl::write
 Beginning Operation ...    
-------------------------
Programming file C:\MJBC\Internal\temp_to_delete\K60_Tower_Kit\uTaskerV1_4-014.bin   
Auto-detection is successful.   
  File is of type Binary/Raw Format.   
 
 Downloading Flash Device Driver ...   
 Reading flash ID ...
Auto-detection is successful.   
  File is of type Binary/Raw Format.   
 
Downloading 0x0000E8C0 bytes to be programmed at 0x00000000   
 Programming .....
 Program Command Succeeded    
Downloading 0x00001740 bytes to be programmed at 0x0000E8C0   
 Programming ....
 Program Command Succeeded    
Downloading 0x0000C618 bytes to be programmed at 0x00010000   
 Programming ....
 Program Command Succeeded  

 

 

 

 

0 Kudos