SC131 - micro SD card - COMMAND ERROR

504 views
Skip to first unread message

Jacob Krall

unread,
Jul 2, 2020, 11:46:08 AM7/2/20
to retro-comp
Hello,

I have purchased the smallest micro-SD card I could find under $10, and confirmed that it mounts in my modern laptop. It's 32GB. I then inserted it into the SC131 using the MicroSD Card Adapter. Here is the output on boot with the card in place:

RomWBW HBIOS v3.0, 2020-03-27

SC131 Z8S180-N @ 18.432MHz IO=0xC0
0 MEM W/S, 2 I/O W/S, INT MODE 2
512KB ROM, 512KB RAM

ASCI0: IO=0xC0 ASCI W/BRG MODE=115200,8,N,1
ASCI1: IO=0xC1 ASCI W/BRG MODE=115200,8,N,1
MD: UNITS=2 ROMDISK=384KB RAMDISK=384KB
SD: MODE=SC OPR=0x0C CNTR=0xCA TRDR=0xCB DEVICES=1
SD0: COMMAND ERROR

Unit        Device      Type              Capacity/Mode
----------  ----------  ----------------  --------------------
Char 0      ASCI0:      RS-232            115200,8,N,1
Char 1      ASCI1:      RS-232            115200,8,N,1
Disk 0      MD1:        RAM Disk          384KB,LBA
Disk 1      MD0:        ROM Disk          384KB,LBA
Disk 2      SD0:        SD Card           --


SC131 Boot Loader

ROM: (M)onitor (C)P/M (Z)-System (F)orth (B)ASIC (T)-BASIC (P)LAY (U)SER ROM
Disk: (0)MD1 (1)MD0 (2)SD0

Boot Selection?


Without the card inserted, it says "SD0: NO MEDIA" instead, but otherwise looks the same.

I have checked the voltage on each of the six pins - the MISO pin appears to be 3.3V, but the others are 5V, except during a reset, when all but VCC dip down (presumably to 0V very briefly), so electrical connection appears to be good.

What other diagnostic steps should I try? Do I need to format the micro SD card like in https://github.com/wwarthen/RomWBW/blob/master/Doc/Contrib/SC126_How-To_No_2_Preparing_an_SD_Card_for_Use_with_SC126_v1.5.3.pdf ?

Thanks,
Jacob Krall

Frank P.

unread,
Jul 2, 2020, 12:59:46 PM7/2/20
to retro-comp
You need to copy an image (either a single hard disk image or the combo image which contains 6 hard disks) to the card first using either the win32diskimager or usbimagetool utility (run as administrator under Windows). See the documentation file RomWBW Getting Started.pdf, section "Using Disks", subsection "Disk Images".

Jacob Krall

unread,
Jul 2, 2020, 1:55:54 PM7/2/20
to retro-comp
Thanks for your quick response, Frank.

I don't have Windows readily available, but I have copied hd_combo.img to the SD card device using dd on Mac OS X:

$ sudo dd if=hd_combo.img of=/dev/disk4

But I still see SD0: COMMAND ERROR on reset.

I have also tried using balenaEtcher to write the SD card, with the same result.

Jacob

Frank P.

unread,
Jul 2, 2020, 4:21:00 PM7/2/20
to retro-comp
So you're at the step where you test the SD card before bending the pins and mounting it horizontally, right? Have you taken a good look at the soldering on the female header pins and Z180 pins 55,56,57. Clearly RomWBW is detecting something there because of the difference with/without the card inseted. Or maybe it's the card (I'm successfully using a 32GB SanDisk Ultra class 10 card (this one: https://www.amazon.com/SanDisk-Ultra-microSDXC-Memory-Adapter/dp/B073JWXGNT).

Wayne Warthen

unread,
Jul 2, 2020, 6:22:24 PM7/2/20
to retro-comp
On Thursday, July 2, 2020 at 10:55:54 AM UTC-7, Jacob Krall wrote:
Thanks for your quick response, Frank.

I don't have Windows readily available, but I have copied hd_combo.img to the SD card device using dd on Mac OS X:

$ sudo dd if=hd_combo.img of=/dev/disk4

But I still see SD0: COMMAND ERROR on reset.

Hi Jacob,

You have redisscovered an odd situation that occurs with SD Cards running with Rev K of the Z180 CPU.  The issue is a slight incompatibility between the Rev. K and the SD card protocol.  Although it is not a RomWBW bug, I did find a way to work around it cleanly.  The fix is in the "dev" branch of RomWBW on GitHub.  You will need to download and do your own ROM build.

Thanks,

Wayne

Jacob Krall

unread,
Jul 3, 2020, 12:25:10 PM7/3/20
to retro-comp
Hi Wayne,

Thanks for the advice. I believe I have the 'N' revision of the Z180.

I tried building & running wwarthen/RomWBW @ dev (a67d0d9da21d5e0c43511f9ac348de469cc8dff0), but still get a COMMAND ERROR:

RomWBW HBIOS v3.1.1-pre.20, 2020-07-03


SC131 Z8S180-N @ 18.432MHz IO=0xC0
0 MEM W/S, 2 I/O W/S, INT MODE 2
512KB ROM, 512KB RAM

ASCI0: IO=0xC0 ASCI W/BRG MODE=115200,8,N,1
ASCI1: IO=0xC1 ASCI W/BRG MODE=115200,8,N,1
INTRTC: Wed 2020-01-01 00:00:00

MD: UNITS=2 ROMDISK=384KB RAMDISK=384KB
SD: MODE=SC OPR=0x0C CNTR=0xCA TRDR=0xCB DEVICES=1
SD0: COMMAND ERROR

Unit        Device      Type              Capacity/Mode
----------  ----------  ----------------  --------------------
Char 0      ASCI0:      RS-232            115200,8,N,1
Char 1      ASCI1:      RS-232            115200,8,N,1
Disk 0      MD1:        RAM Disk          384KB,LBA
Disk 1      MD0:        ROM Disk          384KB,LBA
Disk 2      SD0:        SD Card           --


SC131 Boot Loader

Boot [H=Help]:

I will attempt to get the MicroSD Card Adapter to work with a different microcontroller, to see if it's a hardware issue.

I probably should have followed Steve's instructions correctly and tested the adapter before bending the header pins!

Jacob

Jacob Krall

unread,
Jul 3, 2020, 1:29:16 PM7/3/20
to retro-comp
I connected the MicroSD Card Adapter to an Arduino, and couldn't get it to recognize the card, either. I suspect there's a hardware issue with the adapter, likely due to my manhandling it. I soldered some new header pins on, to see if that would fix the problem, with no luck.

Ordered five replacement SD adapters on Amazon. They'll be good for all sorts of breadboard projects, I'm sure. Will update on Sunday!

Jacob

Wayne Warthen

unread,
Jul 3, 2020, 1:36:43 PM7/3/20
to retro-comp
On Friday, July 3, 2020 at 10:29:16 AM UTC-7, Jacob Krall wrote:
I connected the MicroSD Card Adapter to an Arduino, and couldn't get it to recognize the card, either. I suspect there's a hardware issue with the adapter, likely due to my manhandling it. I soldered some new header pins on, to see if that would fix the problem, with no luck.

Ordered five replacement SD adapters on Amazon. They'll be good for all sorts of breadboard projects, I'm sure. Will update on Sunday!

Yeah, that does sound like hardware. 

Steve Cousins

unread,
Jul 4, 2020, 10:05:51 AM7/4/20
to retro-comp
Hi Jacob,

For the last few months, I've been giving each SD card adapter a brief test on SC126 so if your adapter was part of a kit it should have been working. I started testing these after two (I think it was) were found to be faulty. In the last few months I've found two more faulty adapters during testing. If your adapter arrived in a small bag with one end closed with tape then it was one I tested. It could be you have a dodgy contact between the card and the sprung contact hidden in the SD card socket. I've seen a few micro SD cards and sockets that didn't work well together.

Steve

Jacob Krall

unread,
Jul 5, 2020, 11:12:50 PM7/5/20
to retro-comp
Tried it with a new SD card adapter - no luck!

I also discovered I was wrong about the Arduino. Arduino Mega uses different pins for SPI, of course. I found the correct pin-out, and both the new and original adapters work in the Arduino IDE now.

Still get the COMMAND ERROR on the SC131 when a card is inserted, with either adapter.

It seems like an electrical issue would cause RomWBW to be unable to distinguish between the "NO MEDIA" and "COMMAND ERROR" states. (Or am I wrong about that? Not familiar enough with the SD card protocol yet...)

Anything else I might try?

Best regards,
Jacob

Frank P.

unread,
Jul 6, 2020, 6:54:27 AM7/6/20
to retro...@googlegroups.com
Yes, try another card - it could be the card, especially if it's an off-brand (it happens quite often on the AltairDuino - some cards just don't work). You could try any old card less than or equal to 32GB you have laying around; or I know for sure that this one works because I've been using alternating 2 of them in my SC131: https://www.amazon.com/SanDisk-Ultra-microSDXC-Memory-Adapter/dp/B073JWXGNT

Jacob Krall

unread,
Jul 6, 2020, 2:30:15 PM7/6/20
to retro-comp
Frank,

Of course a second card immediately worked. Sorry for all the noise, everyone, but at least I learned some more about SD cards in the process.

The non-working card says "Samsung EVO Select 32" - not exactly off-brand! And the one that works is an 8GB no-brand card that came with a Raspberry Pi from years and years ago. Go figure.

Jacob

Andy Cooper

unread,
Dec 31, 2020, 10:32:12 AM12/31/20
to retro-comp
Greetings to all from a new member.  I completed building an SC126 kit (Christmas present from me to me :-)) and kudos to Steve for an outstanding quality kit and documentation, and also to Wayne for the excellent RomWBW package.  All is working well except the Micro SD Card support seems to be sensitive to card type.  I have two SanDisk Ultra cards that work perfectly but three other vendors whose cards report "command error."  The three brands that fail are PNY, KEXIN, and Samsung EVO.  Note that all work fine on my Linux server and Linux and Windows laptops.  I note that member Frank P. has also had luck with the SanDisk cards so I will purchase more SanDisk Ultra media but a data point for further thought.

Regards, Andy

Steve Cousins

unread,
Dec 31, 2020, 10:59:00 AM12/31/20
to retro-comp
Hi Andy

The compatibility issue may be improved by updating RomWBW to the latest version. I ship my kits with the most recent full release, but there have been improvements in the more recent pre-release versions. 

You can pick up the necessary package at  https://github.com/wwarthen/RomWBW

It is well worth the time to download this and build the required ROM image. It is not as difficult as it may initially look. In fact, it is quite easy. Once you get the hang of it you can customise the ROM with simple edits of the configuration files. Updating the FLASH "ROM" can be done without an EPROM programmer, although in the unlikely event of something going wrong you would need to reprogram the chip with a programmer.

Steve

Steve

Andy Cooper

unread,
Dec 31, 2020, 1:13:05 PM12/31/20
to retro-comp
Hi Steve,

thanks for the fast reply.  I created a new RomWBW rom (not without some minor drama) which boots as version 3.0.1.  Unfortunately the symptoms have not changed - only the SanDisk media is recognized.  I tested a number of the micro SD Cards and was actually surprised by the results.  All tested "genuine" and the "noname" KEXIN cards performed very well with the PNY and Samsun EVO performing the worst.

The minor drama was related to the build process which failed on three different Linux machines appearing to hang assembling camel80.azm.  I switched to a Windows 10 laptop and the build completed successfully

Regards, Andy

Richard Deane

unread,
Dec 31, 2020, 1:52:34 PM12/31/20
to Andy Cooper, retro-comp
Yes I can confirm the same build problem with newest dev download, where it hangs on camel80 asm. (Using Raspberry Pi)

building in /home/pi/Downloads/RomWBW-dev/Source/Forth
make[2]: Entering directory '/home/pi/Downloads/RomWBW-dev/Source/Forth'
../../Tools/Linux/zx ../../Tools/cpm/bin/ZSM =camel80.azm -/L
Z80/Z180/Z280 Macro-Assembler V4.1



Richard

--
You received this message because you are subscribed to the Google Groups "retro-comp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to retro-comp+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/retro-comp/fe5423a1-b501-4d95-a886-473230b60976n%40googlegroups.com.

Wayne Warthen

unread,
Dec 31, 2020, 1:56:17 PM12/31/20
to retro-comp
Hi Andy,

The latest SD Card compatibility corrections are only in the "dev" branch.  Please pull the latest source from GitHub on the dev branch and try that.  Your symptoms look exactly like one of the compatibility fixes that were made there.

Thanks,

Wayne
Message has been deleted

Wayne Warthen

unread,
Dec 31, 2020, 2:06:06 PM12/31/20
to retro-comp
On Thursday, December 31, 2020 at 8:52:34 AM UTC-10 rwd...@gmail.com wrote:
Yes I can confirm the same build problem with newest dev download, where it hangs on camel80 asm. (Using Raspberry Pi)

building in /home/pi/Downloads/RomWBW-dev/Source/Forth
make[2]: Entering directory '/home/pi/Downloads/RomWBW-dev/Source/Forth'
../../Tools/Linux/zx ../../Tools/cpm/bin/ZSM =camel80.azm -/L
Z80/Z180/Z280 Macro-Assembler V4.1

Hi Richard,

Unfortunately, building under Linux is a perpetual battle.  There are so many variants and versions that attempting to correct one almost always breaks others.

The Linux build is definitely working via the GitHub automated build process.  This is done on every check-in (dev or master branch).  Since it impossible to test all of the Linux variants, I use the GitHub Linux environment as my official supported Linux build.

I will try to see what is happening on Raspbian.  If there is a simple fix that does not break my default GitHub Linux build, I will take care of it.  Can you tell me which version of Raspbian you are running?  If someone sees the specific issue causing this failure, please let me know.

Thanks,

Wayne

Andy Cooper

unread,
Dec 31, 2020, 3:00:40 PM12/31/20
to retro-comp
Wayne,

I cloned the dev branch and the ROM signature is   RomWBW HBIOS v3.1.1-pre.24.

The good news is the PNY and KEXIN cards are now working however the Samsung EVO still generates a command error.  This is an older card that I was using on a Pi "a while back" but it does work on other devices.  All in all though a great step forward :-).

Thanks, Andy

Richard Deane

unread,
Dec 31, 2020, 6:34:01 PM12/31/20
to Wayne Warthen, retro-comp
Wayne:
Using the latest Raspbian (Buster 10 32bit on Raspberry PI 4b )  (updates/upgrades to today) gives the problem. Same problem occurs if just running make from the source/forth directory

Richard




--
You received this message because you are subscribed to the Google Groups "retro-comp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to retro-comp+...@googlegroups.com.

Wayne Hortensius

unread,
Dec 31, 2020, 6:53:33 PM12/31/20
to retro...@googlegroups.com
It doesn't appear to be Raspbian related (though it does also occur on
the previous Stretch release as well). I woke up an ancient Ubuntu 12.04
system to try out the make there. Other than having to add a '-std=c99'
to the compile flags, everything went swimmingly - right up to where it
hung on assembling camel80.azm.

Regards,
Wayne

Wayne Warthen

unread,
Dec 31, 2020, 10:13:06 PM12/31/20
to retro-comp
On Thursday, December 31, 2020 at 10:00:40 AM UTC-10 k3...@coolioh.com wrote:
I cloned the dev branch and the ROM signature is   RomWBW HBIOS v3.1.1-pre.24.

The good news is the PNY and KEXIN cards are now working however the Samsung EVO still generates a command error.  This is an older card that I was using on a Pi "a while back" but it does work on other devices.  All in all though a great step forward :-).

OK, well, that is an improvement.  If you are up to it, I would like to give you some instructions for turning on some debug options in the SD card driver to see if that helps me see what is going wrong with the Samsung EVO card.  I am away from home this week, but will circle back next week.

Thanks,

Wayne 

Wayne Warthen

unread,
Dec 31, 2020, 10:15:32 PM12/31/20
to retro-comp
On Thursday, December 31, 2020 at 1:34:01 PM UTC-10 rwd...@gmail.com wrote:
Using the latest Raspbian (Buster 10 32bit on Raspberry PI 4b )  (updates/upgrades to today) gives the problem. Same problem occurs if just running make from the source/forth directory

Thanks Richard.  I should be able to recreate the problem pretty easily if the latest Raspbian exhibits it.  I won't be able to work on this until next week though.

-Wayne 

Wayne Warthen

unread,
Dec 31, 2020, 10:49:33 PM12/31/20
to retro-comp
So, I was able to remotely login to my Raspberry Pi running Stretch.  I was able to build the dev branch with no problems.  This is very confusing.

Could there have been a failure in the build prior to the hang?  There are certain failures in the build that will not end the build process, but will cause problems later in the build.  Did you add the libncurses5-dev package to your system before building?

-Wayne W

Wayne Hortensius

unread,
Dec 31, 2020, 11:17:11 PM12/31/20
to retro...@googlegroups.com
Oops, argh, and mea culpa. I tried it with main. I just did it again
with dev and it works for me on Stretch as well (and on the ancient
Ubuntu 12.04 system, just for completeness sake).

Wayne

On Thu, 31 Dec

Richard Deane

unread,
Jan 1, 2021, 3:00:04 AM1/1/21
to Wayne Hortensius, retro-comp
There was this error earlier:
building in /home/pi/Downloads/RomWBW-dev/Source/Prop
make[1]: Entering directory '/home/pi/Downloads/RomWBW-dev/Source/Prop'
building in /home/pi/Downloads/RomWBW-dev/Source/Prop/Spin
make[2]: Entering directory '/home/pi/Downloads/RomWBW-dev/Source/Prop/Spin'
../../../Tools/Linux//bstc -e -l PropIO.spin
../../../Tools/Linux//bstc: 1: ../../../Tools/Linux//bstc: Syntax error: "(" unexpected


I did have libncurses5-dev installed prior to the build.

Richard



--
You received this message because you are subscribed to the Google Groups "retro-comp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to retro-comp+...@googlegroups.com.

Andy Cooper

unread,
Jan 1, 2021, 9:46:41 AM1/1/21
to retro-comp
>If you are up to it,

Sure, let me know how I can help and I will give it a try.

And FYI, the dev tree also builds for me on Linux

Regards
Andy

rwd...@gmail.com

unread,
Jan 1, 2021, 2:09:12 PM1/1/21
to retro-comp
If I git clone to get dev branch of ROMWBW it builds ok on Raspberry Pi, but if I download the zip and build, then the build will fail.

I have tended to do zip download as I am an extreme git novice. But I am getting more experience.

Richard

Bob Bird

unread,
Jan 4, 2021, 10:37:43 AM1/4/21
to retro-comp
I have just got the combo card software installed from macOS Catalina.  

I put the SD card into my Mac and as expected got an error saying it could not be read. I accepted the option to format it. 

I then  used Etcher (free download) to copy the  image onto the card.  Immediately put it in my SC126 and booted into Z-System.  All the drives were present and there is a map of what's in what drive/user in C0.

Also you might soon need to chop off bits of files and inspect the binary structure of file.  The free program Hex Fiend does this job nicely.

Bob
On Thursday, 2 July 2020 at 18:55:54 UTC+1 Jacob Krall wrote:
Thanks for your quick response, Frank.

I don't have Windows readily available, but I have copied hd_combo.img to the SD card device using dd on Mac OS X:

$ sudo dd if=hd_combo.img of=/dev/disk4

But I still see SD0: COMMAND ERROR on reset.

I have also tried using balenaEtcher to write the SD card, with the same result.

Jacob

On Thursday, July 2, 2020 at 12:59:46 PM UTC-4 Frank P. wrote:
You need to copy an image (either a single hard disk image or the combo image which contains 6 hard disks) to the card first using either the win32diskimager or usbimagetool utility (run as administrator under Windows). See the documentation file RomWBW Getting Started.pdf, section "Using Disks", subsection "Disk Images".


On Thursday, July 2, 2020 at 11:46:08 AM UTC-4, Jacob Krall wrote:
Hello,

I have purchased the smallest micro-SD card I could find under $10, and confirmed that it mounts in my modern laptop. It's 32GB. I then inserted it into the SC131 using the MicroSD Card Adapter. Here is the output on boot with the card in place:

RomWBW HBIOS v3.0, 2020-03-27


SC131 Z8S180-N @ 18.432MHz IO=0xC0
0 MEM W/S, 2 I/O W/S, INT MODE 2
512KB ROM, 512KB RAM

ASCI0: IO=0xC0 ASCI W/BRG MODE=115200,8,N,1
ASCI1: IO=0xC1 ASCI W/BRG MODE=115200,8,N,1
MD: UNITS=2 ROMDISK=384KB RAMDISK=384KB
SD: MODE=SC OPR=0x0C CNTR=0xCA TRDR=0xCB DEVICES=1
SD0: COMMAND ERROR

Unit        Device      Type              Capacity/Mode
----------  ----------  ----------------  --------------------
Char 0      ASCI0:      RS-232            115200,8,N,1
Char 1      ASCI1:      RS-232            115200,8,N,1
Disk 0      MD1:        RAM Disk          384KB,LBA
Disk 1      MD0:        ROM Disk          384KB,LBA
Disk 2      SD0:        SD Card           --


SC131 Boot Loader

ROM: (M)onitor (C)P/M (Z)-System (F)orth (B)ASIC (T)-BASIC (P)LAY (U)SER ROM
Disk: (0)MD1 (1)MD0 (2)SD0

Boot Selection?


Without the card inserted, it says "SD0: NO MEDIA" instead, but otherwise looks the same.

I have checked the voltage on each of the six pins - the MISO pin appears to be 3.3V, but the others are 5V, except during a reset, when all but VCC dip down (presumably to 0V very briefly), so electrical connection appears to be good.

What other diagnostic steps should I try? Do I need to format the micro SD card like in https://github.com/wwarthen/RomWBW/blob/master/Doc/Contrib/SC126_How-To_No_2_Preparing_an_SD_Card_for_Use_with_SC126_v1.5.3.pdf ?

Thanks,
Jacob Krall

Wayne Warthen

unread,
Jan 5, 2021, 8:10:44 PM1/5/21
to retro-comp
On Friday, January 1, 2021 at 12:00:04 AM UTC-8 rwd...@gmail.com wrote:
There was this error earlier:
building in /home/pi/Downloads/RomWBW-dev/Source/Prop
make[1]: Entering directory '/home/pi/Downloads/RomWBW-dev/Source/Prop'
building in /home/pi/Downloads/RomWBW-dev/Source/Prop/Spin
make[2]: Entering directory '/home/pi/Downloads/RomWBW-dev/Source/Prop/Spin'
../../../Tools/Linux//bstc -e -l PropIO.spin
../../../Tools/Linux//bstc: 1: ../../../Tools/Linux//bstc: Syntax error: "(" unexpected

I am not seeing this error in any of my builds.  Linux or Windows.  I can't explain this.

-Wayne 

Wayne Warthen

unread,
Jan 5, 2021, 8:13:35 PM1/5/21
to retro-comp
On Friday, January 1, 2021 at 11:09:12 AM UTC-8 rwd...@gmail.com wrote:
If I git clone to get dev branch of ROMWBW it builds ok on Raspberry Pi, but if I download the zip and build, then the build will fail.

When I tested my Raspberry Pi build, I used a zip download.  This was on Raspbian  Stretch.  I can't imagine why the zip download would fail while the git clone would work.  In theory, they should be identical.  GitHub itself provides the different formats from the same source.

-Wayne

Wayne Warthen

unread,
Jan 10, 2021, 2:49:17 PM1/10/21
to retro-comp
On Thursday, December 31, 2020 at 12:00:40 PM UTC-8 k3...@coolioh.com wrote:
The good news is the PNY and KEXIN cards are now working however the Samsung EVO still generates a command error.  This is an older card that I was using on a Pi "a while back" but it does work on other devices.  All in all though a great step forward :-).

After getting a huge amount of support from Andy, we tracked down a very subtle anomaly in  the Samsung EVO card.  I have posted a minor revision to the SD Card driver on the RomWBW GitHub repository (dev branch) that allows this card to work.  Andy did a logic analyzer trace between RomWBW and Arduino that isolated the issue.

For those interested, the problematic SD Card required that the unused CRC value in SPI command packets be set to 0xFF.  I had been setting it to 0x00  The standard indicates that this value should be totally ignored, but apparently it is not for some cards.  So, there wasn't a error per se in the SD code, but this change accommodates cards like the Samsung EVO.

-Wayne
 
Reply all
Reply to author
Forward
0 new messages