View Single Post
Old 18 August 2014, 17:59   #1
Mathesar
Registered User
 
Mathesar's Avatar
 
Join Date: Aug 2014
Location: Netherlands
Posts: 698
Question Minimig PIC1826K20 help needed (solved!)

Hi All,

I have been working on a port of Goran Ljubojevic's excellent PIC firmware for the Minimig to the PIC18F26K20. The port is based upon PGL100818 from google code.

The PIC18F26K20 is 3 times as fast, has much more ram and twice as much flash as the original PIC.

The new firmware now supports 16MHz SPI bus speed, multiple read/write commands to the HDF and is generally much more responsive. I have also added HDF indexing and a more efficient fileseek() function.

From power on to kickstart screen takes about 8 seconds on a class-4 SDHC card. Faster cards boot even faster.
Booting WB68Lite from a 1Gb HDF takes about 12 seconds .
All in all a good upgrade from the original PIC for Minimig owners on a budget (the PIC18F26K20 costs a few euros).

The port is finished but one bug remains and I am pulling my hair out on how to solve this: HDf writes get stuck or corrupt the hardfile.

The scenario:
I have created a 1gb HDF with stock WB68K lite loaded. maxtransfer properly set to 0x1fe00. The SDHC card is a kingston class-4 4Gb card.
The FPGA core is FSB131020(42MHz).
CPU is turbo (42MHz), Kick 3.1, 1mb chip, 0.5mb fast. SPIMOD on board is done.

I load up dirpopus and copy the folder programs to my-files.
Then, somewhere, the copy operation hangs. The drive led stays on and through the debug console I can see that the PIC executes read or multiple-read commands endlessly.

The strange part is that it only happens with the SPI bus is set to 16MHz. On 4MHz everything goes fine. Also when, i add a small delay after each read or write command (10..20ms) everything goes fine as well. Even on 16MHz.

So, I am really puzzled. I have tried to mimic the behaviour of the ARM version as much as possible. I suspect a timing problem as adding delays or changing the SPI speed changes things. But where?

Can anyone help me?

Last edited by Mathesar; 22 August 2014 at 12:14. Reason: Issue has been solved
Mathesar is offline  
 
Page generated in 0.04474 seconds with 11 queries