| Author |
Message |
zbasicandy
Joined: 26 Jan 2006
|
|
Posted: 25 April 2006, 21:48 PM Post subject: "Super Com Z" Serial Mass Storage Flash SD (2 gigs |
|
|
"Super Com Z" Serial Mass Storage Flash SD (2 gigs)
ZBasic's ZX-xx microcontrollers have a unique characteristic that other basic microcontrollers do not have - 4 software interrupt driven UARTS with software queues. All my applications will exploit this unique and powerful ZBasic microcontroller characteristic along with software modular
programming. All drivers can be changed in seconds between communication serial ports by just changing the port number and communication setup parameters (Edit Search/replace)
The "Super Com Z" is a generic (No special hardware IC's) serial 4 port R2322 board which can be programmed easily using the modular approach. To add hardware "just plug it in" and add the software module!
So far, the serial hardware / drivers / projects that I provided FREE for the ZBasic community for the "Super Com Z" or ANY ZBasic microcontroller which has serial RS232 ports are:
1. Serial LED message sign driver (BetaBrite)
2. Serial I-Bridge Powerline controller driver
3. Serial Email/SMS text Cell Phone alert driver
4. Serial Programmable Caller-ID driver
5. Serial Web Server (Schematic only - driver later)
What was missing until now was a Serial Mass Storage SD flash driver.
6. Serial Mass Storage SD flash driver <--- Now
Just Think ...
2 gigabytes of serial mass removable Flash storage (non-volatile) in a PC FAT readable format attached to a ZBasic ZX-xx microcontroller!
Serial SD Flash Mass Storage
• The cost of 1 gigabyte of SD Flash is falling to about $40.00. (with rebates) Trade journals indicate there is a glut of Nand flash and it won't be worked off until Q2 of 2006. Better stock up!
($0.04/megabyte) -> 4 cents per megabyte!
Having a SD flash memory removable mass storage interface connected a ZBasic microcontroller will add megabytes of low cost storage that was not previously available at a very low cost.
• The SD flash can be used for data acquisition and storage, home automation and any place where large amounts of data needs to be stored in a non-volatile (FAT file) removable flash memory.
• Some hobbyist would say why not use Ramtron's Fram?
At ~ $23.00/megabyte this would not even be a very cost effective solution and not to mention that is not removable and does not have a PC readable file format for further data analysis. To the "Ramtron diehards" please no offense!!!!!
• The SD flash memory interface vendors (See below) vary between commercial to hobbyist. The old saying "the devil is in the details" also applies in choosing the right / best SD card interface.
SPI/TTL interfacing, Fat(16)/Fat32 file formats, 3.3/5.0 VDC and current power requirements,vendor firmware update capability, max storage capability (Fat16 has 2 gigabyte), I/O interface e.g. 3.0/5.0 VDC, SD module physical board connections, number of files allowed opened at
one time, serial handshaking CTS/RTS, vendor supplied high level SD commands, baud rate of serial communications and cost are just a few items to consider when choosing a SD card interface vendor.
Also, you need to consider the "specific SD card vendor" flash cell endurance. (see below)
• Flash Cell Endurance: For Multi-Level Cell (MLC) Flash, up to 10,000 write cycles per physical sector. For Single-Level Cell (SLC) Flash, up to 100,000 write cycles per physical sector. According to Toshiba, the inventor of Flash memory: “the 10,000 cycles of MLC NAND is more than sufficient for a wide range of consumer applications, from storing documents to digital photos. For example, if a 256-MB MLC NAND Flashbased card can typically store 250 pictures from a 4-megapixel camera (a conservative estimate), its 10,000 write/erase cycles, combined with wear-leveling algorithms in the controller, will enable the user to store and/or view approximately 2.5 million pictures within the expected useful life of the card. For USB Flash drives, Toshiba calculated that a 10,000 write cycle endurance would enable customers to “completely write and erase the entire contents once per day for 27 years, well beyond the life of the hardware.” In my application @ 1000 chars a day = ~ 5494.5 years
using a 2 gig SD card. (crude estimate) Flash cell endurance = 5494.5 X 10,000 = 54,945,000 years!
• SD has proprietary/copyrighted/patented information that you'd need to spend several thousand dollars to access. That is why is don't see that many SD hobbyist projects. Keep in mind that making homemade
SPI SD routines and selling a product with them, the SD org will want their money for their trademark SD!
• For this SD card driver application I chose Comfiletech's SD card interface. ($38.00) (Comfiletech.com)
It has TTL serial interface, 2 Gigabytes max, 1 file open max., vendor supplied high level commands, vendor firmware upgradeable, 5 volt power and I/O interface, Fat16 file format and an even
0.100 inch grid to mount the interface on. Note: I did not choose the lowest cost because I needed an interface which was "proven" with high level commands and I did not want to spend my life writing SPI routines for SD flash cards and also pay royalties to SD org.
Be sure to download their SD "PDF" documentation.
Please Note: The vendor's SD PDF needs a lot of work done to it but I did most of the grunt work and tested almost all of the commands and converted them to functions and subroutines.
• Wiring to Comfiletech's SD Com5 card is tricky. I just put the SD module interface on a Radio Shack perf board, wired in the SD card insertion LED.
You need 3 wires (left side of module) "going direct" to a RS232 female soldercup connector for firmware updates.(From PC) (You also need 5VDC pwr and ground to that interface in that configuration) On the right side you need Tx, Rx and gnd for your communications interface. I chose to connect a Maxim RS232 converter to the TTL interface so I could "plug
and play" on the "Super Com Z" and also use the PC to run HyperTerimal to the device for testing & debugging.(You also need 5VDC pwr and ground to the interface in that configuration)
Note: You can use any ZBasic ZX-xx microcontroller to interface to this module. (5 VDC TTL non inverted) (9600 8 N 1)
• Be sure to format the SD card with the proper clusters. Go to SDcard.org and obtain the FREE SD formatter which will format the SD card using USB cards readers on the PC into the proper SD format. The standard Window's XP PC format utility will/might format the card in the wrong format. For instance, a 256M SD card using Fat(16) had 4k clusters but the program from SDcard.org "SD formatter" put the number of clusters to 16K in which the Comfiletech SD would initialize and work properly. Be forewarned -> if the cards fails to "init" the format could be wrong!
• The Comfiletech SD interface works with the PC program HyperTerminal (9600 8 N 1) for debugging and if you have the proper RS232 conversion. (Long message mode - Terminal mode) After all debugging was finished, the interface is put in the abbreviated response MCU mode. All the
functions that I created use this "MCU mode" and also have "boolean error feedback" on all commands for proper error/response/feedback programming.
SD formatter utility.
-----------------------------------------------------
[SD Flash memory interface vendors]
[Not complete! - just a random sample from the internet]
'----------------------------------------------------
If you know of any other SD interface modules please
do add them to this link.
----------------------------------------------------
uMMC Data Storage Module Roguerobotics.com -
$49 Can + $23 Can shipping
US dist.
http://www.hobbyengineering.com/CatINMEM.html -
$49 US
----------------------------------------------------
http://www.ghielectronics.com/uALFAT-SD.htm
uALFAT-SD is our OEM board of uALFAT™ chip. The low
cost and the ease of use makes ALFAT-SD the ultimate
solution for OEMs and hobbyists. uALFAT-SD is a lower cost replacement of ALFAT-SD.
$39.95
---------------------------------------------------
http://www.comfiletech.com/index.asp?PageAction=VIEWP
ROD&ProdID=79
SD Card - Com5 E04009
Read/Write to SD and MMC Cards!
List Price $38.00
----------------------------------------------------
http://www.mikroelektronika.co.yu/english/product/tools/etools.htm#7
MMC/SDboard $18.00 USD <---- no drivers?
----------------------------------------------------
http://www.compsys1.com/workbench/On_top_of_the_Bench/MMC_Project/mmc_project.html
$69 <---- no drivers?
----------------------------------------------------
http://www.sparkfun.com/commerce/product_info.php?products_id=204
SKU#: PCB-SDMMC
Price: $14.95 <----- the lowest cost & no drivers?
----------------------------------------------------
Before responding to any of my ZBasic microcontroller projects please keep in mind the following:
#1. I will not respond/reply to anything unless it is related to ZBasic, ZBasic hardware and applications/projects that does not include the use of ZBasic microcontrollers.
#2. Any "off the wall" or un-focus comments and personal attacks please keep to yourself or go to another website. This web site is for professionals
and serious hobbyist. I believe that new users would only like to focus on
ZBasic applications and microcontrollers.
#3. I make my projects, free of charge, for the ZBasic community. I do not have a "hidden personal agenda" of promoting my projects for commercial purposes. I expect the same from the ZBasic community
members. Please do not attach any links concerning you home/commercial projects to any of my topics or projects.
#4. What I am expecting, is a "constructive" suggestions on how I can improve my software/hardware application/project using ONLY ZBasic and
ZBasic hardware. If you feel you have a better alternative solution, do by all means post it yourself under a different topic and let the ZBasic User Forum Community judge it on its own merits.
I believe the purpose of this forum is to share and exchange ideas using ZBasic microcontrollers and not have inflated egos and bias
opinions due to promoting one's own commercial projects which would get in the way of good judgment when responding to a topic?
#5. PCs are great but has nothing to do with this forum except for ZBasic's IDE software. The ZBasic forum title states "A place to discuss ZBasic and ZX series of microcontrollers"!
To the "Serial Mass Storage Flash SD ZBasic Users ...bring it on ... comments/suggestions.
| Description: |
| User manual for SD Com5 interface card by Comfiletech.com |
|
 Download |
| Filename: |
SD_UserManual.zip |
| Filesize: |
505.8 KB |
| Downloaded: |
1374 Time(s) |
| Description: |
| SD Mass Storage subs/funs for SDcom5 SD interface using MCU mode. |
|
 Download |
| Filename: |
SD_Card_R2.bas |
| Filesize: |
49.11 KB |
| Downloaded: |
944 Time(s) |
|
|
| Back to top |
|
 |
twesthoff
Joined: 17 Mar 2006
Location: Virginia, USA
|
|
Posted: 25 April 2006, 23:57 PM Post subject: "Super Com Z" Serial Mass Storage Flash SD (2 gigs |
|
|
One similar product you did not have on your list is found at:
http://www.dosonchip.com
It is a new product, but I ordered one, and will report back how it works.
On the comfiletech unit, how fast will it write and read? For example, how long does it take to write a 10Mb file to it?
How long to read back the same file?
This could be done from a PC program, just for testing, I just want to get a feel for the max speed it can go. A ZBasic application would then follow...
|
|
| Back to top |
|
 |
zbasicandy
Joined: 26 Jan 2006
|
|
Posted: 26 April 2006, 0:08 AM Post subject: Speed |
|
|
From the above SD users manual - just download it for all the specs.
Specifications
Model SD-COM5 SD-COM3
Voltage 4.5~5.5V 2.7~5.5V
Read Speed
- 115200 bps: 10KB/s
- 9600 bps: 8KB/s
- 115200 bps: 8KB/s
- 9600 bps: 2KB/s
Write Speed
- 115200 bps: 8KB/s
- 9600 bps: 0.4KB/s
- 115200 bps: 2KB/s
- 9600 bps: 0.8kB/s
It's quite obvious that flash is slow but it is cheap for mass storage.
What application, using a Zbasic microcontroller, do you need a 10mb file?
|
|
| Back to top |
|
 |
twesthoff
Joined: 17 Mar 2006
Location: Virginia, USA
|
|
Posted: 26 April 2006, 0:16 AM Post subject: Speed |
|
|
Well if you don't need a 10Mb file, then you probably don't need 2GB of storage either...
It is just the size of a test file I have used to test other CF and SD card speeds. Not too big compared to 2GB...
When you are logging data at 300Kbits/sec, the files get big fairly soon.
|
|
| Back to top |
|
 |
zbasicandy
Joined: 26 Jan 2006
|
|
Posted: 26 April 2006, 0:32 AM Post subject: SD card interface |
|
|
Do you have the spec sheet for Dosonchip?
I hope they don't require you to use the RTS/CTS like one vendor did.
Like I said "the devil is in the details"
|
|
| Back to top |
|
 |
spamiam
Joined: 13 Nov 2005
|
|
Posted: 26 April 2006, 2:30 AM Post subject: Re: Speed |
|
|
| zbasicandy wrote: | It's quite obvious that flash is slow but it is cheap for mass storage.
What application, using a Zbasic microcontroller, do you need a 10mb file? |
Well, actually, I don't think that the NAND flash is THAT slow normally. I think it is to some degree the baud rate that is limiting things. 115K baud = 11.5K bytes per second MAX. I don't understand how the 9600 baud (read) speed can be nearly as high as the 115K baud. 9600 baud transfers 960 bytes per second MAX, I thought.... Unless the capital "B" they are referring to is bits instead of bytes.
SD cards are capable of much faster transfer rates. 20megabits/second? More, I think. Now that is probably using the parallel interface, but the SPI interface sould be able to manage well more than 115K bits/second.
Now, will the ZX be able to manage that speed? I was able to achieve only around 3K bytes/sec using the software SPI interface, as I remember. The hardware SPI interface would not work because the SD cards do not happily share the SPI buss concurrently.
I suspect that someone might be able to improve on the softwate SPI interface I used in my test software, but maybe not up to the 11K bytes/second that you can get with the comfile brand serial interface.
I would be interested to see what speed is possible. Of couse there is still the issue of NOT having a file system in the most rudimentary SPI interface.
So, I like the comfile SD card device overall. I think I might try one. If I had a raw AVR device, and did not care about the file system, I might try to do it myself on SPI instead of use something like the comfile device.
-Tony
|
|
| Back to top |
|
 |
twesthoff
Joined: 17 Mar 2006
Location: Virginia, USA
|
|
Posted: 26 April 2006, 2:36 AM Post subject: "Super Com Z" Serial Mass Storage Flash SD (2 gigs |
|
|
| Quote: | | I was able to achieve only around 3K bytes/sec using the software SPI interface, as I remember. The hardware SPI interface would not work because the SD cards do not happily share the SPI buss concurrently. |
Why do you say that the SPI and SD cards don't get along well? Any details? Or is it a Zbasic issue?
|
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Location: Portland, OR
|
|
Posted: 26 April 2006, 4:05 AM Post subject: |
|
|
| Quote: | | Why do you say that the SPI and SD cards don't get along well? |
I believe the issue was that the SD/MMC card requires data in 512 byte blocks during which transfer the chip select must remain active. The ZBasic SPICmd() procedure is capable of transferring a maximum of 255 bytes and the chip select is deactivated at the end of the transfer because the VM needs to use the SPI bus to fetch the next instruction.
[Edit] As of v1.2.0 of the compiler and v1.2.0 of the VM, SPICmd() transfer counts can be 16-bit values.
Last edited by dkinzer on 03 May 2006, 23:22 PM; edited 1 time in total |
|
| Back to top |
|
 |
JC
Joined: 20 Feb 2006
Location: Hudson,OH
|
|
Posted: 26 April 2006, 5:02 AM Post subject: SD/MMC Write Packet Length? |
|
|
Zbasicandy,
What is the MINIMUM number of bytes that one can write to your system at a time? I was under the impression that although one could read single bytes, one writes 512 bytes at a time. For small data loggers, etc, this is a major hassle and impediment to using (cheap) MMC.
Of interest, the Hobby Engineering SD/MMC module's data sheet, and example, demonstrate writing small (e.g. 18 byte) data packets, and imply that the minimum is 1 byte.
Are these systems just buffering the data within the module?
Any thoughts?
JC
|
|
| Back to top |
|
 |
pjc30943
Joined: 02 Dec 2005
|
|
Posted: 26 April 2006, 5:53 AM Post subject: |
|
|
JC, the Alfat units take care of the RAM issues. You can write as many or few bytes as desired, without having to worry about anything. That is why zbasicandy's choice is a good one, because GHI's SD boards all do these things automatically.
[I had a zx24 project that used the Alfat, it can be seen on the zx24 forum. This is not a personal agenda thing, so hopefully zbasicandy, this mention is acceptable:) ]
|
|
| Back to top |
|
 |
stevech
Joined: 23 Feb 2006
|
|
| Back to top |
|
 |
spamiam
Joined: 13 Nov 2005
|
|
Posted: 26 April 2006, 11:26 AM Post subject: |
|
|
| pjc30943 wrote: | JC, the Alfat units take care of the RAM issues. You can write as many or few bytes as desired, without having to worry about anything. That is why zbasicandy's choice is a good one, because GHI's SD boards all do these things automatically.
[I had a zx24 project that used the Alfat, it can be seen on the zx24 forum. This is not a personal agenda thing, so hopefully zbasicandy, this mention is acceptable:) ] |
From my quick read of the Comfile SD device's docs, it appears that the minimum write is less than a 512 byte sector. When I looked at the photo of the circuit board, it looks as if it uses a reasonably large microcontroller. Probably that controller has enough space for one 512 byte buffer, and probably two of them. In that case Comfile's strategy would probably be to buffer the incoming data, READ the destination entire sector, then overwrite the new data on the old in the buffer, then write the entire sector back.
Not hard to do, just a pain in the neck, and it incurs a speed penalty over a full sector write.
-Tony
|
|
| Back to top |
|
 |
zbasicandy
Joined: 26 Jan 2006
|
|
Posted: 26 April 2006, 18:27 PM Post subject: SD number of bytes |
|
|
| Quote: | | What is the MINIMUM number of bytes that one can write to your system at a time? |
Answer:
1 <--- if you download my code you will see I have two write/read SD "turnaround" tests. One for a small string and the other one for 1 (byte) character (string).
Please note: I did not write the subs/functions for speed. I wrote them for slow very reliable data storage. The write/read performance can be enhanced e.g. increase the Rx/Tx buffer size(s) from 41 to XX and decrease transmit/receiver time delay among other things.
|
|
| Back to top |
|
 |
zbasicandy
Joined: 26 Jan 2006
|
|
Posted: 26 April 2006, 18:43 PM Post subject: SDcard |
|
|
| Quote: | | When I looked at the photo of the circuit board, it looks as if it uses a reasonably large microcontroller. |
It's an Atmel ATMeg64 MCU.
|
|
| Back to top |
|
 |
zbasicandy
Joined: 26 Jan 2006
|
|
Posted: 26 April 2006, 19:35 PM Post subject: SD |
|
|
Application Hint.
I chose serial with an intelligent high level interface over SPI because "other" users had this problem below.
| Quote: | I have found that I can not use the built-in SPI functions because I
need to keep the Card-Select selected over a bunch of transfers, and
when the CS is deselected, apparently the transaction in progress is
lost. |
ZBasic users beware!
|
|
| Back to top |
|
 |
|