ExtremeElectronics / RC2040

Z80 CP/M80 emulation of an RC2014 using the RP2040 (PI PICO) processor
GNU General Public License v3.0
40 stars 7 forks source link

hang in CP/M #12

Closed andypiper closed 2 years ago

andypiper commented 2 years ago

Currently, a range of things seem to be working on a small RP2040 board I'm testing with, based on v0.9 and the "get you started" SD card download - I've made no changes - but attempting to enter CP/M hangs at the A> prompt - no more input is accepted. Am I doing something wrong here?

ExtremeElectronics commented 2 years ago

If the code runs non CPM basic with no issues (select a13/a14/a15 to all zeros in the rc2040.ini Then its likely to be be a SD card issue, or a SPI speed issue.

Try another SD card (ideally from another manufacturer)

Do you have pull-ups (4k7) from the MOSI, MISO and Clock lines to the SD card? That would also be worth a try.

Or you could knock down the SPI speed, but that would require a recompile, change .baud_rate = 10000 1000, to .baud_rate = 1000 1000, in hw_config.

andypiper commented 2 years ago

Good to know, as the SD breakout itself is suspect (has 5V/3.3V issues that I’m looking into - it’s a board so not sure about the pull-ups, I can try something simpler). Thanks. This gives me some angles to investigate!

ExtremeElectronics commented 2 years ago

Please tell me how you get on. Not an issue anyone (to my knowledge) has had before.

ExtremeElectronics commented 2 years ago

If your SD socket is dubious, haw about using an SD adapter ?

SD-Adapter-to-Pico-GPIO

andypiper commented 2 years ago

yep, have plenty of those. I likely will have to get to this in a day or so. Thank you for the pointers!

andypiper commented 2 years ago

Right, sharing troubleshooting for posterity.

Same behaviours so far. This is using a WaveShare RP2040 Zero in place of a Pico, though.

Next steps:

The behaviour is, however, so far consistent. Everything works, up until entering cpm!

--- Miniterm on /dev/cu.usbmodem21101  115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
SIO selected
Loading: '24886009.BIN'[rombank:2] for 0x4000 bytes
CPM/IDE File:'CPM Inc Transient Apps SIO2.img CPMIDE.id'

 ##################################
 ######## RC2040 STARTING #########
 ##################################

Small Computer Monitor - RC2014
*dir
Monitor .EXE
BASIC   .COM
WBASIC  .COM
BASIC   .HLP
CPM     .COM
CPM     .HLP
*
*basic

Memory top?
Z80 BASIC Ver 4.7b
Copyright (C) 1978 by Microsoft
31427 Bytes free
Ok
10 PRINT "Hi RC2040"

RUN
Hi RC2040
Ok

MONITOR
*
*cpm
␌Z80 CP/M BIOS 1.0 by G. Searle 2007-13

CP/M 2.2 Copyright 1979 (c) by Digital Research

A>

... and we're frozen, from an input point of view.

OK... hitting a bit of a dead end now. This is all over USB Serial rather than UART on pins, but apart from that, I am not sure what might be going wrong. Thoughts?

andypiper commented 2 years ago

I observe that the text on connection varies depending on the SPI speed, e.g. initially I was seeing

 #####################################

#Core 1 Starting#
 ########## RC2040 STARTING ##########
 #####################################

With modified SPI baud rate I see

 ##################################
 ######## RC2040 STARTING #########
 ##################################
andypiper commented 2 years ago

Taking a step back, bearing in mind I've never run an RC2014 myself - is this simply PEBKAC - should I still be able to enter anything after starting CP/M directly from the "Get you started" SD card? am I missing other content on the disk?

*?
Small Computer Monitor by Stephen C Cousins (www.scc.me.uk)
Version 1.0.0 configuration R4 for Z80 based RC2014 systems

Monitor commands:
A [<address>]  = Assemble        |  D [<address>]   = Disassemble
M [<address>]  = Memory display  |  E [<address>]   = Edit memory
R [<name>]     = Registers/edit  |  F [<name>]      = Flags/edit
B [<address>]  = Breakpoint      |  S [<address>]   = Single step
I <port>       = Input from port |  O <port> <data> = Output to port
G [<address>]  = Go to program
BAUD <device> <rate>             |  CONSOLE <device>
FILL <start> <end> <byte>        |  API <function> [<A>] [<DE>]
DEVICES, DIR, HELP, RESET
BASIC    Grant Searle's adaptation of Microsoft BASIC
WBASIC   Warm start BASIC (retains BASIC program)
CPM      Load CP/M from Compact Flash (requires prepared CF card)

... I've done nothing additional to prepare the CF / SD card - should I have added additional disk image files to the SD card?

For now, I've gone back to the default build config / release v0.09 version, and I'm working with that, since SCM and BASIC are letting me tinker... I might move on to sound and see if I can get that working.

Jimbob-B commented 2 years ago

Yes, you should be able to change drives, list files and start or load programs. What are the contents of your SD card? Mine has,

24886009.BIN CPMIDE.id CPM Inc Transient Apps ACIA.img R0001009.BIN CPM Inc Transient Apps SIO2.img rc2040.ini

My rc2040.ini is just a copy and paste from the git repo. I'm also using the USB serial connection and have tried the UART connection too. Worse case scenario is completely wipe the SD card (I use the SD card formatter from sdcard.org to apply a full format) and copy files over again.

andypiper commented 2 years ago

Well. That was quite the wild goose chase...

I still do not know exactly what the problem is (was), but I now know where the problem lies.

I've been using the pyserial module's miniterm (I have a shell alias, alias miniterm="python3 -m serial.tools.miniterm") as a convenient terminal emulator. I never thought to try another option.

Anyway: I did indeed do a full reformat of the SD card (now back to the 8Gb card I started with), and copied the basic files back over. Still, the same issue.

Then I thought, what if it's my client? So I switched from iTerm to macOS Terminal... same thing. Then finally... and what if I use screen?

Bingo. I can type commands to CP/M!

Closing this as resolved, with apologies for the distraction, and thanks for your patience. Off to try some sound.