News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Gryzor

Use a Raspberry Pi as an HxC drive!

Started by Gryzor, 16:27, 26 November 13

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bryce

I never went looking for the source. I only wanted to build myself one, so the HEX dump was all I needed.

Bryce.

Munchausen

#26
I built an SDiskEmul last year but haven't had much luck getting it to work yet. I got a good oscilloscope and logic analyser recently so that should help :)


I actually think it's superior to the HxC, as it's completely seamless - you plug the joystick into it, then from it into the CPC, and the video comes out of the CPC to it, then to the monitor. It has a button, which when pressed brings up a menu as an overlay on the monitor, and you can select a new disk image with the joystick, once selected the joystick acts as normal again. Also, it supports dsk images so you don't have to convert anything.


The only problem is it doesn't support writing to dsk images.

Munchausen

#27
I had another go with my SDiskEmul last week. Still haven't got it working, but the oscilloscope helped me figure out that the LM1881 wasn't producing the sync signals correctly. The reason turned out to be too much parasitic capacitance (damn strip board)... I shortened as many traces as I could, which still didn't work but was better (signals weren't quite right but almost), then removed the IC socket on the LM1881 and it now works correctly.


Next was debugging the SPI connection to the SD card. I got the logic analyser out and hooked it up, and could see valid SPI packets going between the two. Had a break for a while (and left it turned on), and when I came back the PIC now doesn't seem to be producing any valid packets at all. No clue what's up with it, I've tried a few things, the LM1881 is still going ok (I think the PIC software is interrupt driven based on the hsync so needs this), so I'll have to come back to it another time. Hopefully nothing died because I left it turned on (can't imagine why it would though).


It even displayed part of the screen overlay at one point, so I think I'm almost there.


I'd like to make a nice small PCB layout for it if/when I can get it working.

Gryzor


Munchausen

Think I may have cracked it. Looks like I've been using the wrong PIC micro.


The thing is on the website it says to use PIC18Fxxxx, so I didn't know what to use - I looked at the pictures and could read 18f452<unreadable last digit> so I went for an 18f4520, mostly because I can get them easily. I disassembled the hex file yesterday, then tried to reassemble it for the 18f4520, and I got a lot of errors about invalid RAM addresses. Reassembled for the 18f4525 (which is the same but with more RAM) and it worked!


So it looks like it was working as far as getting a directory listing from the card (I checked the SPI packets yesterday), and then crashing. I've ordered a new micro, though I may be able to rewrite the code to fit on the 18f4520 I'm not so hot on pic18 assembly and its RAM banking, so a new PIC is the easiest route. Fingers crossed for when it arrives...

Munchausen

Well, I got the new PIC today, changed it over, and for a few minutes thought it was working. The overlay works, I can select a disk image from the SD, but when I run cat on the CPC I get a garbled directory listing. I'm out of ideas for now, but will have another look when I can. So close!

Munchausen

It lives! I was missing a pull up resistor, now it's working fully! W00P! :D


Will post some pics later.

jrodriguezv


Gryzor

Ohhh yeah, definitely pics please!

Munchausen

#34
Well, I've got pics, but also some bad news :( . Pics first.


Here's the SDiskEmul itself. On the left are the joystick, video and power connectors. On the right are SD card and floppy drive connectors.



Just to show it's really plugged in to a CPC:




The image selection menu:



After you choose an image you have to tell it whether to be A or B drive (not sure if this actually does anything):



Running cat:



And finally, we hit a problem:



So, something's up and I'm stumped. It sometimes works and sometimes doesn't. It generally says it can't find a file, and then cat just shows an empty disk, but type cat again and it shows the files just as it should. I didn't check it properly this morning, just loaded up the intro to prince of persia and that's it (I can actually get to watch the full intro, but pressing a key after that causes it to freeze). Similar stuff with every image I've tried.

I've checked the circuit and I'm pretty sure it's fine. I've tried with two different cables and two different CPCs, but I don't have any other cables (and both occasionally give me problems with my 3.5" drive). So I think it's either the cable or just limitations of strip/vero board?

Anyone got any clues? Bryce to the rescue!?

Gryzor

Oh my, this is sweet! I hope you get there :) The OSD is super-cool.


Just take a deep breath, grab a beer or six, get some sleep, I'm sure you'll find the solution.


Awesomeness!

Token

That and this OSD is indeed instant wowcool.  8)


Bryce

Hi Munchausen,
      looking at the your PCB / setup, the cables between the VeroBoard and the SDCard PCB are way longer than recommended and could cause the effects you're having. Shorten these to the minimum and it might resolve your problem.

Bryce.

Munchausen

Thanks Bryce, I'll give this a try :D


I shortened all the traces I could elsewhere, but didn't think of the SD card cables...

Powered by SMFPacks Menu Editor Mod