BMOW title
Floppy Emu banner

Archive for the 'Floppy Emu' Category

SD Card SPI Initialization

floppy-emu-error-10-5

What happens when two devices share the same SPI bus? With a good design, each device is enabled one at a time for use of the bus, and they coexist without problems. With a bad design, SPI communication that’s intended for one device is sent to the other, leading to confusion and buggy behavior. In the Floppy Emu disk emulator, the SPI bus is shared between an SD card and an LCD display. As it turns out, it had a bug like this that escaped notice for almost two years, with the occasionally flaky behavior wrongly attributed to bad SD cards, faulty boards, or the phase of the moon. Doh!

The symptom was a “No SD card” message, with error code 10:5, when using a few specific models of SD card. During startup, the Floppy Emu firmware was sending SPI commands to the LCD to draw an image, then sending SPI commands to the SD card to initialize it. In rare circumstances, the initial communication with the LCD was confusing the SD card, leaving it in a state where it refused to respond to any further commands until the power was turned off and on. This caused the Emu to think no card was present. The problem didn’t always happen 100% of the time, and it appeared to depend on the electrical characteristics of each board and anything attached to it. But for certain models of SD card, it happened so consistently that the only remedy was to use a different SD card.

My solution was simple: initialize the SD card before doing any LCD communication. Grab the new firmware with the fix here:

floppy-emu-1.0R-F13Mac Floppy
hd20-0.7E-F14.5Mac Floppy + Hard Disk and Lisa Floppy
apple-II-0.1K-F7Apple II, for Model B
apple-II-0.1K-F6Apple II, for Model A

 
SPI Mysteries

You might wonder how a problem like this could have gone unnoticed for so long. Looking back over two years of support emails, I only found four problem reports that could be retroactively attributed to this issue. In each case, the person was able to get things working by trying a different SD card, so we chalked up the problem as a damaged or flakey card. It was only recently that I received two reports from people who’d tried multiple cards, all of which failed with the “No SD Card” message and error 10:5. Following up on their hardware, I bought two suspect 16 GB cards (1, 2), and confirmed that they both just plain didn’t work. Ouch. I’ve now verified that the new firmware gets both these SD cards working, and also received confirmation from some other users that the new firmware gets their troublesome cards working too.

So what exactly was the problem? The frustrating answer is that I don’t really know, and my description of the issue intentionally glossed over some important details. It’s true that the LCD communication somehow confused certain SD cards, but I can’t explain why.

Floppy Emu SPI Bus

Here’s a simplified diagram of Floppy Emu’s SPI bus. The LCD and SD card are independently enabled by separate, active low signals LCDE and SDE. Because the AVR microcontroller operates at 5V, all its outputs are passed through a 74LVC244 buffer to step them down to 3.3V for the LCD and SD card (the 3.3V signal MISO is an output from the SD card, and doesn’t need level conversion). SDE also has a 10K ohm pull-up resistor to +5V, to ensure that the SD card is disabled when the AVR isn’t actively driving the signal, during reset and microcontroller startup.

The only way it should be possible for the SD card to be confused by LCD communication traffic is if SDE were asserted at the wrong time. Looking at the schematic and the firmware code, I just don’t see how that’s possible. The pull-up resistor ensures that the SD card will be enabled if the AVR isn’t actively driving it. And once the AVR does begin actively driving it, it drives SDE high (unasserted) until it’s ready to begin communication with the SD card. So the card should be disabled during the initial LCD communication, and should ignore whatever is happening on the SPI bus.

If I weren’t so lazy, I would put a scope on the SPI bus, and verify that SDE is truly unasserted during LCD communication. But I’m lazy, and didn’t do that.

A few hints point to an electrical problem. With some cards, the 10:5 error occurred more often when I had an AVR programmer attached to the SPI bus, even if the programmer wasn’t active. And with those same cards, seemingly trivial firmware changes would cause the error to appear and disappear. Sometimes I’d only get the error on half my attempts, so it wasn’t a deterministic problem.

Maybe poor circuit design causes a momentary noise spike on SDE, during startup and LCD communication. Ringing, ground bounce, or cross-coupling of signals might cause SDE to briefly appear asserted when it shouldn’t be, causing the SD card to try to interpret communications meant for the LCD. But if that were the case, I’d expect to see all kinds of similar communication errors with the SD card during normal operation.

Another possibility is that there’s something fishy going on with AVR pin PB4, which is also the SPI SS (slave select) pin. The datasheet mentions that there’s some special behavior related to this pin. But after reading that section of the datasheet, I don’t think that’s the cause.

My last theory is that the problem is caused by accidentally switching the SD card into 4-bit mode. SD cards can operate in three different modes: SPI, 1-bit SDIO, or 4-bit SDIO. The latter two modes use the card’s pins like a conventional data bus. I believe the details of 1-bit and 4-bit SDIO may be proprietary and require an NDA, and every hobbyist-made microcontroller project I’ve seen has used SPI instead.

The catch is that SD cards initially power on into 1-bit SDIO mode, and part of the SD card initialization process is to switch to SPI mode, which will remain active until power off. With the old firmware, during the Floppy Emu’s initial LCD communication, the SD card was still in 1-bit SDIO mode rather than SPI mode. I don’t know anything about 1-bit SDIO mode, but maybe the chip select input is used differently in that mode, and my LCD communication was accidentally triggering a switch to 4-bit SDIO mode. As I understand it, once switched to another mode, that mode will remain active until power off, which is consistent with the “zombie SD card” behavior I observed with certain cards under the old firmware. Hmmm…

Read 3 comments and join the conversation 

Clearance Sale: $79 Floppy Emu Model A

20150619_122211_resized

While supplies last, the Floppy Emu Model A is on sale at a clearance price of just $79. If you’ve been waiting to add one of these hard disk / floppy disk emulators to your Apple computer collection, now is your chance. The response to the new Model B has been great – maybe a little too great, and I need to close out the remaining inventory of Model A hardware. If you’re a Macintosh or Lisa user, or an Apple IIgs/IIc/IIc+ user looking for a Smartport hard disk, this is a great value! See the compatibility table on the order page and the Model B announcement for more details on Model A vs B differences.

If I were a savvier businessman, I might have waited to introduce the Model B until my inventory of Model A hardware was gone. It’s not quite the Osborne Effect, but introducing a new model that kills demand for the old model may not have been the smartest move. Fortunately for you, my loss is your gain! The good news is that interest in the Model B has been strong. In the past I typically made about one sale per day, but recently it’s been much busier. This was the scene heading to the post office after the 3-day MLK Day weekend:

box-tower

The Model A is the original Floppy Emu design that’s been featured here at BMOW for over a year. It emulates a classic Macintosh HD20 hard disk or 3.5 inch floppy disk, or a Lisa 3.5 inch floppy disk, or an Apple IIgs/IIc/IIc+ Smartport hard disk, or an Apple IIgs/IIc/IIc+ 5.25 inch floppy disk. Many people have purchased both a Model A and a Model B, to get a dedicated drive for each Apple computer in their collection. Don’t miss this chance to pick up a Model A at a great price!

Read 3 comments and join the conversation 

Introducing Floppy Emu Model B

model-b-750

Today I’m excited to introduce the first significant update to the Floppy Emu disk emulator for Apple II and classic Macintosh computers: Floppy Emu Model B. The new Model B has the same disk emulation functions as the Model A and Universal Adapter, but with several new convenience features:

  • Built-in Apple II Compatibility – Model B is directly compatible with the entire Apple II line, emulating a 5 1/4 inch disk, 3 1/2 inch disk, or Smartport hard disk. While Model A required a separate Universal Adapter for the best Apple II compatibility, Model B has the equivalent functionality built-in. Classic Macintosh and Lisa disk emulation is still supported too.
  • microSD Card Support – The SD card slot is now a push-push microSD type, identical to what’s used in most mobile phones. This will make it easier to find suitable SD card media, since the older full-size SD cards are becoming rare.
  • SD Card Hot-Swap – The SD card can be removed and re-inserted while the Floppy Emu is powered on.
  • Improved Protection Circuitry – Model B features improved protection circuitry on the disk drive interface connector. This circuitry will help protect the Floppy Emu from electrical damage caused by voltage spikes and surges. It also eliminates the risk of potential damage if an Emu board running the Apple II firmware is inadvertently connected to a Mac or Lisa computer.
  • Same Great Emulation Features – All of the time-tested Macintosh, Apple II, and Lisa disk emulation features from Model A are still present. Model B reads and writes emulated 140K, 400K, 800K, or 1.4MB floppy disk images, or hard disk images up to 2GB, if supported by your Apple computer. For full details, see the instruction manual.

If you’re new to Floppy Emu, it’s an external hardware device for vintage Macintosh, Apple II, or Lisa computers. It uses a removable SD memory card to mimic an Apple floppy disk and drive, or an Apple hard drive. The Emu behaves exactly like a real disk drive, requiring no special software or drivers. Floppy Emu is perfect for booting your favorite games, moving files between modern and vintage machines, and troubleshooting a computer without a working OS. Just plug in the Emu board, and you’ll be up and running in seconds.

Floppy Emu Model B is available for sale now. While supplies last, I’m also selling the remaining inventory of Floppy Emu Model A units for a reduced price. It’s disk emulation madness!

Read 31 comments and join the conversation 

Oops! Laser Cut Material Thickness

emu-case-parts

Manufacturing is hard. The thickness of my supplier’s clear acrylic material has magically increased 15%, meaning that the latest batch of Floppy Emu acrylic cases are impossible to assemble. The buttons and light pipes don’t fit in the cut-outs made for them, so this entire batch of product will have to be thrown out. I’m hoping the supplier will agree to re-run my order or provide a refund, but I’m not optimistic since 15% is just within their stated tolerance. An expensive mistake in manufacturing for me!

For the past year, I’ve been offering laser-cut case enclosures as a Floppy Emu accessory, and I’ve sold hundreds of the cases to happy customers. They’re made from 3.0 mm (nominal) clear acrylic. With all of my past orders from the laser cutter, the parts I received had an actual thickness between 2.73 mm and 2.83 mm, and my design accounts for that. A case assembled from the old ~2.75 mm thick material looks like this:

emu-case-assembled

I just received a new delivery of parts yesterday, and the material thickness changed to 3.15 mm! Imagine if you were building a house with 8 foot ceilings, but some of the framing lumber was over 9 feet – it would never work. That’s the same magnitude of change I’m facing now. The buttons and light pipes are cut from the same material as the case body, so now they’re 3.15 mm thick. But the cut-outs in the top of the case are only about 3.05 mm, and the parts won’t fit through. It’s still possible to assemble the six sides of the case, but without the buttons and light pipes it’s useless.

The supplier’s material thickness is rated at +/- 15%, so this is really my fault and not theirs. But +/- 15% is a huge margin. How am I supposed to make that work? If I make cut-outs big enough to accept 3.45 mm (+15%) thick buttons, but the actual material thickness in a future delivery is 2.55 mm (-15%), it’ll be so loose that buttons will just fall out. There’s no way I can see to accommodate a thickness tolerance that large.

Some of you may be thinking that I should never have made a design that relied on the material thickness as a critical parameter, and you’re right. But again, I’m not sure how I could have avoided it – any design where two parts meet at right angles with a tab-and-slot system will suffer from the same problem. For now, I’m faced with either re-cutting all the buttons and light pipes using thinner material if I can find some, or re-cutting all the case tops using bigger cut-outs.

Read 15 comments and join the conversation 

GS/OS 6.0.2 for Floppy Emu

welcometo602

If you follow the Apple II world, then you probably already know that a group of hobbyists recently released GS/OS 6.0.2 – a new version of the Apple IIGS operating system based upon Apple’s last official version from 1993. This new version includes many bug fixes and added features.

To make life easier for Floppy Emu owners, I’ve created this pre-configured GS/OS 6.0.2 hard disk image. It’s a 32 MB ProDOS disk image with GS/OS 6.0.2 already installed and ready to go. If your Floppy Emu has the Apple II firmware installed and is set for Smartport mode, then all you need to do is copy the smart0.po file onto your SD card, and power up your IIGS to begin exploring 6.0.2. Even if you don’t have a Floppy Emu, this disk image should also work with other Apple II hard disk emulators – it’s just a generic ProDOS disk image.

Some software-based Apple IIGS emulators like Sweet16 don’t like ProDOS disk images that are larger than 800K. For those, I’ve also created a pre-configured GS/OS 6.0.2 hard disk image in 2MG format. This 2MG disk image will also work with Floppy Emu, but I/O performance will be worse than with the PO disk image, so the PO version is preferred.

Read 4 comments and join the conversation 

New Product: Universal Adapter Extension Cable

universal-adapter-with-cable-large

January 2016 Update: The current hardware version Floppy Emu Model B has built-in Apple II functionality that’s equivalent to the Universal Adapter described here. The Universal Adapter is therefore not necessary when using a Floppy Emu Model B. For information on how the Universal Adapter can improve Apple II compatibility with Floppy Emu Model A, read on.

Today I’m announcing the Universal Adapter for Floppy Emu, which improves the emulation behavior with certain Apple II system configurations. If you use the Emu exclusively with Macintosh and Lisa computers, then you won’t need this. Apple II users, check the table below to see if your intended usage would benefit from the Universal Adapter:

Emulation Type Model A with Standard Adapter Model A with Universal Adapter Model B
Macintosh
   3 1/2 inch floppy disk ok-green ok-green ok-green
   HD20 hard disk [1] ok-green ok-green ok-green
Lisa
   3 1/2 inch floppy disk ok-green ok-green ok-green
Apple II, II+, IIe
   5 1/4 inch floppy disk 1437100947_ko-red [2] ok-green ok-green
Apple IIc
   5 1/4 inch floppy disk ok-green ok-green ok-green
   Smartport hard disk ok-green ok-green ok-green
Apple IIc+
   5 1/4 inch floppy disk ok-green ok-green ok-green
   3 1/2 inch floppy disk 1437100947_ko-red 1437100947_ko-red 1437100947_ko-red
   Smartport hard disk ok-green ok-green ok-green
Apple IIgs
   5 1/4 inch floppy disk ok-green ok-green ok-green
   3 1/2 inch floppy disk 1437100947_ko-red [3] ok-green ok-green
   Smartport hard disk ok-green ok-green ok-green

[1] Requires Macintosh 512K, 512Ke, Plus, SE, Classic, Classic II, Portable, IIci, IIsi, or LC-I
[2] Reading the disk works, but writing does not
[3] Apple IIgs with ROM 01 can boot from a 3 1/2 inch disk


The Universal Adapter also contains a protection resistor to guard against accidental damage when switching between the Floppy Emu firmware for Apple II and the firmware for Mac/Lisa. With the Standard Adapter, if a Floppy Emu board running the Apple II firmware is accidentally plugged in to a Mac or Lisa, it could damage the Emu or the computer.

To use the Universal Adapter, set its slide switch to the appropriate position, depending on the selected emulation mode of the Floppy Emu. If the Emu is set to 3 1/2 inch floppy disk mode, then set the switch to the “3.5” position. If the Emu is set to any another mode (5 1/4 inch floppy, HD20 hard disk, Smartport hard disk), then set the switch to the “other” position. Setting the switch to the wrong position won’t harm anything, but it may cause disk-related errors.

universal-adapter-alone

So how does the Universal Adapter work, and how does it differ from the Standard Adapter? The Standard Adapter is a passive device that maps the 19 pins of a male DB-19 connector to the 20 pins of a male 10×2 shrouded header. It rearranges the order of the signals on the pins, but it doesn’t alter them or affect them in any way. In contrast, the Universal Adapter is an active device with an on-board IC that helps with Apple II disk connections. Because the Floppy Emu hardware was originally designed for the Macintosh, it can’t handle some Apple II disk signals correctly, so the Universal Adapter does the necessary interface work. Depending on the switch setting, the disk drive enable signal from the computer may be modified before it’s passed on to the Floppy Emu, and some signals will be forced to different voltages.

It’s OK to use the Universal Adapter with a Mac or Lisa computer, even though it’s not needed for those systems – that’s why it’s called “universal”. People who use a single Floppy Emu board with both Mac and Apple II computers may find this convenient.

The Universal Adapter is available for sale now at the Floppy Emu product page. It includes a detachable three foot extension cable (about 1 meter), just like the Standard Adapter/Cable, and it’s available by itself or bundled with a new Floppy Emu board.

Read 2 comments and join the conversation 

Older Posts »