SPI Bus board for RC2014

623 views
Skip to first unread message

Jay Cotton

unread,
Jun 7, 2018, 11:29:20 PM6/7/18
to RC2014-Z80
I have pushed a beta version of my SPI bus board and driver code to:
https://sourceforge.net/projects/spi-bus-z80-rc2014/


This drop includes a driver for the SPI bus board and a few lame support programs that
allow directory viewing and copying of files.  The file code is based on FatFS, and is compiled
using z88dk.

These both will need a lot of work to be truly useful.

It is my hope that in time I can get the driver working with RomWBW,  thus closing the loop
....  spinning rust, CF cards and SD cards.

My driver is probably not nearly ready for RomWBW yet.

I'd like to recognize J.B. Langsdon for the inspiration for this project and some of his code
can be found in the sdir.c program.

Notes about performance.

The spi bus spec says it will work at 20mhz or better.  Not much need to worry about hitting that
limit with the Z80.  The good news is, the Z80 supplies the data clock, and since I bit bang the
data, we are good and slow.

I have copied 2 mb files from the sd card to the cf card using scopy.  This takes quite some time 
to complete.  No idea yet what the throughput is, but its low.

I suspect that some optimizations can be applied to the FatFS code that will make it smaller and
somewhat faster.  My SPI.C driver is a combination of C and asm code that I optimized by looking
for low hanging water melons.  

Well, I hope people find this to be useful.

jc



J.B. Langston

unread,
Jun 9, 2018, 9:40:42 PM6/9/18
to RC2014-Z80
Cool project! I had thought about doing something similar at one point.  There are also people who have used shift registers with the Z80 to make SPI faster than bit banging the data and clock lines... maybe an idea for future optimization.  To give proper credit, that dir function actually came from the fatfs AVR demo by ChaN... I only slightly adapted it to my project.

Jay Cotton

unread,
Jun 9, 2018, 10:30:41 PM6/9/18
to RC2014-Z80
TNX JB.

O.k. so I modified your modifications to ChaN's code.  Just making sure every one gets
credit.

mmm  shift registers.  Well that's a good idea, one I completely missed.  I think I'll stick with the bit banger for now, its most
malleable, unlike h/w.

jc

Jay Cotton

unread,
Jun 21, 2018, 11:16:38 PM6/21/18
to RC2014-Z80
The boards came in today.  

I had to make a small rework do to a routing error (on my part).

The board is now running.  I'll post some updates to the project
in a few days, and call it done.

jc

Jay Cotton

unread,
Jun 26, 2018, 11:42:54 PM6/26/18
to RC2014-Z80
sourceforge updated with new board layout.  Small bug in the layout that was easy to fix.
Here is a link to the new board.  Old one is deleted.
https://www.oshpark.com/shared_projects/IBGLloBl
including a screen shot of the code running.
Capture.PNG

Jay Cotton

unread,
Jun 26, 2018, 11:46:34 PM6/26/18
to RC2014-Z80
Since size matters with the z80, sdir is currently 36k
and scopy is 40k.  



On Thursday, June 7, 2018 at 8:29:20 PM UTC-7, Jay Cotton wrote:

Jay Cotton

unread,
Jul 4, 2018, 9:43:10 PM7/4/18
to RC2014-Z80
Updated the board again.  Never trust autoroute.

Added multi disk support (still needs some work).

Been trying to read a USB stick... no joy yet.

jc


On Thursday, June 7, 2018 at 8:29:20 PM UTC-7, Jay Cotton wrote:

Jay Cotton

unread,
Jul 5, 2018, 8:12:35 PM7/5/18
to RC2014-Z80
USB.  Needs a different fatfs handler.   :(

Jay Cotton

unread,
Jul 21, 2018, 3:42:18 PM7/21/18
to RC2014-Z80
Well, I am making progress on the usb via spi driver.  Had it reading the status from the chip last night, then it fritz'd out.
I suspect a compile bug (compiler not doing the right thing) we will see about that....

Getting very close to reading the usb drive....  can't wait.

jc

Jay Cotton

unread,
Jul 22, 2018, 9:26:25 PM7/22/18
to RC2014-Z80
Self inflicted bug.  Now reading registers on the controller and so on.  Not seeing the usb bus 
activity I expected.  

One thing that really held me up was the lack of a pull down resister on the miso line.  Added a 10k and that
got the miso working, btw a 10k pull up did not work...  

jc

Jay Cotton

unread,
Jul 24, 2018, 11:45:26 PM7/24/18
to RC2014-Z80
flaky code or something.

today I was able to detect a keyboard plug in.  Now, I can seem to repeat the
success.    various combinations of power cycle, reset and swearing does
not seem to work now.



On Thursday, June 7, 2018 at 8:29:20 PM UTC-7, Jay Cotton wrote:

Jay Cotton

unread,
Aug 20, 2018, 9:52:35 AM8/20/18
to RC2014-Z80
I'm taking a break from the USB board.  Now I have this nifty 8 digit led board that is spi buss based.
I have a driver working for it and it seems very stable.

I think at this point, my spi board is working and will only need a code cleanup.  So I will work on that
this week and push the v1.0 code.

I looked at using the jtlpcb site for the final v1 board, its a bit fiddly, but for the cost it should be worth
the effort to get the board from them.

guess Ill get back to usb latter next week..
Reply all
Reply to author
Forward
0 new messages