Editing Dosonchip

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
== NEW FIRMWARE & ROYALTY-FREE API C SOURCE CODE AVAILABLE (MANY IMPROVEMENTS) ==
+
The DOSOnChip module is perhaps the most poorly documented piece of technology I've yet come across. After many days of trying to get this thing to communicate via SPI, I finally have it working. However, some caveats:
There is a new host interface with royalty-free host-side C source code available direct from the DOSonCHIP website:
 
  
http://dosonchip.com
+
DosOnChip "SPI" for Dummies (IE, me two days ago):
  
that works with the new firmware version 2.xx which is available on all new chips.
+
1. SPI
 
 
-SDHC up to 32GB is supported.
 
-Speeds are MUCH MUCH faster.
 
-The SPI interface is now a true SPI interface without the need for the DIR and BUSY handshake signals.
 
-The UART interface only requires 2-pins: RX and TX (hardware handshake signals are optional (UART_CTS should be set to GND if not used).
 
-New functionality.
 
 
 
 
 
 
 
= PLEASE NOTE THAT THE SUBSEQENT INFORMATION APPLIES TO FIRMWARE VERSIONS 1.xx =
 
 
 
 
 
 
 
Host communication via SPI:
 
 
 
"SPI" for Dummies (IE, me two days ago):
 
 
 
1. SPI (see any SPI tutorial website for more info)
 
  
 
SPI is a four-wire interface consisting of the following signals:
 
SPI is a four-wire interface consisting of the following signals:
Line 52: Line 33:
 
Aside from VCC and GND, these are assigned to bits in the header file in the first code section below.
 
Aside from VCC and GND, these are assigned to bits in the header file in the first code section below.
  
Notes:
+
== WHY THIS ISN'T SPI ==
 +
 
  
1. When using only one device on SPI, you should be able to leave the CS  signal in the active state at all times, also called "3 wire mode." The DOSOnChip module (DOC for short) recommends that you wiggle this pin as part of its communications protocol in noisy environments (more later).
+
1. When using only one device on SPI, you should be able to leave the CS  signal in the active state at all times, also called "3 wire mode." The DOSOnChip module (DOC for short) requires that you wiggle this pin as part of its communications protocol (more later).
  
2. In addition to the above signals, DOC requires that you monitor an additional pins: BUSY.
+
2. In addition to the above signals, DOC requires that you monitor two additional pins: BUSY and DIR. Now we're up to six pins (not including the power supply) which is not in accordance with SPI.
  
3. DOC requires that you toggle the RESET pin to reset the device. It is possible to put the module to sleep via SPI, but reawakening the device requires that you disconnect power and reapply it. Even toggling the RESET pin will not cause the device to wake up.  
+
3. DOC requires that you toggle the RESET pin to reset the device. While I understand this from a design point of view, it should be possible to reset the device via an SPI command. It IS possible to put the module to sleep via SPI, but reawakening the device requires that you disconnect power and reapply it. Even toggling the RESET pin will not cause the device to wake up.  
  
 
So, the "SPI"-like interface consists of the following signals:
 
So, the "SPI"-like interface consists of the following signals:
  
  
'''SCLK''' - clock. Must be toggled up and down to write or read a bit. (two transitions per bit).
+
'''SCLK''' - clock. This pin is normally low, and must be toggled up and down to write or read a bit. (two transitions per bit).
  
 
'''MISO''' - master in/slave (DOC) out
 
'''MISO''' - master in/slave (DOC) out
Line 79: Line 61:
 
That gives us 7 signals. Personally, when I order a device that advertises itself as SPI compatible, I expect to be able to drive it with the host controller's SPI system. Especially when I am using a Silicon Labs C8051F124, a close cousin of the C8051F310 that DOC burns their firmware into and sells as their own device. Since both SPI systems were designed by the same people, you'd think they could talk to each other. However, getting this to work within the context of the SPI interrupt handler is difficult. I wound up using a spare timer interrupt instead so I could have bit- and clock-level control.
 
That gives us 7 signals. Personally, when I order a device that advertises itself as SPI compatible, I expect to be able to drive it with the host controller's SPI system. Especially when I am using a Silicon Labs C8051F124, a close cousin of the C8051F310 that DOC burns their firmware into and sells as their own device. Since both SPI systems were designed by the same people, you'd think they could talk to each other. However, getting this to work within the context of the SPI interrupt handler is difficult. I wound up using a spare timer interrupt instead so I could have bit- and clock-level control.
  
 +
== OTHER COMPLAINTS ==
  
The documentation for this device is inadequate. The PDF datasheet for the DOC has no timing specifications, no example code (one section includes the directive "Insert Pseudocode Here") no mention of the case-sensitivity of the command interpreter. However, new documentation is planned for later in 2007.
+
 
 +
The documentation for this device is inadequate. SparkFun should point this out on their product page, or, if they plan on continuing to hawk this device, obtain or write some example code or at least a short pdf with, at very least, an accurate timing diagram. The PDF datasheet for the DOC has no timing specifications, no example code (one section includes the directive "Insert Pseudocode Here") no mention of the case-sensitivity of the command interpreter.  
 +
 
 +
The device tends to spit out an extra bit or two after reset which throws the byte-level SPI buffer on my mcu out of sync. In my timer interrupt, I shift each bit into an unsigned int (2 bytes) until the int is equal to 0x0D3E, the prompt string from the DOC. At that point, I set a "synchronized" flag to true and assume that the next bit starts a new byte. This usually necessitates tossing out a few bits at the beginning.  
  
  
Line 86: Line 72:
  
  
+ Your device should NEVER write to the BUSY or DIR pins as these are output pins on the DOC silicon. Doing so will cause very strange things to happen.
+
+ Your device should NEVER write to the BUSY or DIR pins. Doing so will cause very strange things to happen.
 +
 
 +
+ After sending a complete command (which may be multiple bytes), you must toggle the CS line to inform the DOC that you have completed sending a command. If its firmware were well-written, it would be able to tell this by the fact that you must ALSO send a 0x0D carriage return at the end of a command.
  
 
+ BUSY is set to a 1 by the DOC to tell you that it's, well, BUSY. This makes sense, but is not documented adequately.  
 
+ BUSY is set to a 1 by the DOC to tell you that it's, well, BUSY. This makes sense, but is not documented adequately.  
Line 96: Line 84:
 
When you get the DOC working, itms to remember:
 
When you get the DOC working, itms to remember:
  
+ commands must be LOWER CASE and filenames must be UPPER CASE (this follows the Microsoft FAT file naming convention).  
+
+ commands must be LOWER CASE and filenames must be UPPER CASE.  
  
 
+ To write data to a file:
 
+ To write data to a file:
  
+ The SD card must be formatted as FAT16 or FAT32 (not FAT12).
+
+ The SD card must be formatted as FAT 16.
  
+ when you attempt to use a file or directory name with LOWERCASE, even if is a FAT16 file structure, DOC will respond with an error -14, "Long Filenames Not Supported." Note that a filename like "aadsf.txt," is not 8.3-filename (FAT16) compliant - this should be "AADSF.TXT".
+
+ when you attempt ot use a file or directory name with LOWERCASE, even if is a FAT 16 file structure, DOC will respond with an error -14, "Long Filenames Not Supported." This is confusing when using a filename like "aadsf.txt," wich is 8.3-filename (FAT16) compliant.
  
 
<pre>
 
<pre>
Line 133: Line 121:
 
</code>
 
</code>
  
== SUMMARY ==
+
== SUMMARY AND IMPRESSIONS ==
  
  
 
That's about it. I had some issues with receiving bit streams that were off by a bit because the DOC clocks data out and in on different edges, so if your clock transition is 1-0-1 instead of 0-1-0, you'll drop the last bit of the transmission and the first bit you receive will be incorrect.  
 
That's about it. I had some issues with receiving bit streams that were off by a bit because the DOC clocks data out and in on different edges, so if your clock transition is 1-0-1 instead of 0-1-0, you'll drop the last bit of the transmission and the first bit you receive will be incorrect.  
  
Now that I have this thing working, it's great.  
+
Now that I have this thing working, it's great. It's interesting that the DOC is a processor almost as powerful than I am using to drive two OLEDs, a GPS receiver and the DOC itself in addition to JTAG and a serial interface to my PC, and it doesn't provide sufficiently correct errors (Long Filenames Not SUpported?! "ASDF.TXT" is not a LONG FILENAME!) or diagnostic information.
 +
 
  
 
== CODE for the C8051F124 ==
 
== CODE for the C8051F124 ==
Line 438: Line 427:
 
* [http://www.sparkfun.com/commerce/product_info.php?products_id=8215 Breakout Board with DOSonCHIP + micro-SD socket]
 
* [http://www.sparkfun.com/commerce/product_info.php?products_id=8215 Breakout Board with DOSonCHIP + micro-SD socket]
 
* [http://www.sparkfun.com/commerce/product_info.php?products_id=7956 DOSonCHIP]
 
* [http://www.sparkfun.com/commerce/product_info.php?products_id=7956 DOSonCHIP]
* DOSonCHIP Website http://dosonchip.com/  
+
* DOSonCHIP Website http://chipdos.com/  
 
* [http://chipdos.com/library/CD17B10_User_Guide_0v1.pdf CD17B10 User Guide]
 
* [http://chipdos.com/library/CD17B10_User_Guide_0v1.pdf CD17B10 User Guide]
 
* [http://chipdos.com/library/CD17Bxx-0v8.pdf CD17Bxx Datasheet]
 
* [http://chipdos.com/library/CD17Bxx-0v8.pdf CD17Bxx Datasheet]
  
 
Alternatives:
 
Alternatives:
 +
* the [[TRAXMOD]] shows how a ARM can play raw digital audio files streaming off of a FAT formatted MMC/SD Card.
 +
* [http://www.sparkfun.com/commerce/product_info.php?products_id=545 Prototyping Board for LPC2148] apparently connects a LPC2148 ARM processor directly to a SD/MMC card connector without any DOSonCHIP.
 +
* [http://www.compsys1.com/html/avr_sd_dev_board.html the very small AVR_SD3 development board] apparently connects an Atmel AVR directly to a SD/MMC socket without any DOSonCHIP.
 +
* [http://www.embeddedrelated.com/usenet/embedded/show/70279-1.php someone ranting about "It's a pet peeve of mine to have SD slots if there's no SD filesystem software. Of the hundreds of DEV boards that have a slot, only a couple have open software to utilize the slot. I'm not sure if the AVR world has this kind of open software?"]
 +
* [http://www.freelabs.com/~whitis/sd_card/ "Embedded SD Card/MMC Card"] includes a nice "Comparison of different types of MMC/SD cards", "Competing Formats", and a schematic and PCB for a "Embedded MMC/SD card reader board".
 +
* [http://forum.sparkfun.com/viewtopic.php?t=2770 Reading from SD card?]
 +
* the [http://balloonboard.org/balloonwiki/FrontPage Balloon board] apparently has a MMC socket connected to an ARM XScale processor
 +
* [http://www.avenhaus.de/EEG/MMC/MMC.shtml "MMC/SD memory cards for Atmel AVR"] "This project allows Atmel AVR microcontrollers to read and write  ... Multi Media Cards (MMC) and Secure Digital Cards (SD) ...  The file system is PC compatible, so that data can be transferred between the two."
 +
* [http://microcontrollershop.com/product_info.php?cPath=154_170_266&products_id=1707 "Atmel AT91SAM9261 Evaluation Kit"] with ARM9 (ATMEL AT91SAM9261) connected to MMC/SD socket, and Compact Flash socket
 +
* [http://pontoppidan.info/lars/index.php?proj=mmc2iec the "MMC2IEC device"]: yet another Atmel AVR to SD/MMC card socket. Supports FAT16 and FAT32 support. Oh, and it can also connect to a C64, emulating a Commodore 1541 disk drive.
 +
* [http://www.priio.com/productcart/pc/viewPrd.asp?idproduct=79 ARM7X Development Board] includes a MMC/SD socket.
 +
* [http://www.linux-hacker.net/cgi-bin/UltraBoard/UltraBoard.pl?Action=ShowPost&Board=MJB&Post=104&Idle=0&Sort=0&Order=1&Page=0&Session= connecting a JuiceBox to a SD card] (also [http://www.elinux.org/wiki/JuiceBoxMMCHack eLinuxWiki:JuiceBoxMMCHack], [http://www.elinux.org/wiki/JuiceBoxUMDCart eLinuxWiki:JuiceBoxUMDCart])
 +
* [http://www.moxa.com/product/EM-1220.htm yet another ARM9 on a credit-card-sized motherboard] that includes a SD card slot (and runs uClinux)
 +
* [http://www.larwe.com/zws/products/polyceph/index.html Polyceph Mk.I] has complete source code and schematic and PCB files in EAGLE format. Shows how several (?) different processors connect to a SD/MMC card slot
 +
* [http://www.sparkfun.com/commerce/product_info.php?products_id=8298 Evaluation Board for MSP430FG4619] connects that processor to a SD/MMC card connector
 +
* [http://www.makezine.com/blog/archive/2006/08/usb_circuit_design.html "USB2.0 reference project"] "a USB2.0 Card Reader. It support cards such as Compactflash, Memory Stick, Memory Stick Duo, Magic Gate, Secure Digital, MultimediaCard and SmartMedia. The schematic and source code of the reference projects are provided."
 +
* [http://www.makezine.com/blog/archive/2007/03/avr_based_usb_sd_card_rea.html "AVR based USB SD card reader"]
  
See the many alternatives at [[MMC]].
+
''FIXME: consider making another page about "how to interface a microcontroller to a SD/MMC card", and move all these alternatives to that page?''

Please note that all contributions to OpenCircuits may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see OpenCircuits:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)