View Single Post
Old 22 August 2014, 09:47   #12
Mathesar
Registered User
 
Mathesar's Avatar
 
Join Date: Aug 2014
Location: Netherlands
Posts: 698
Solved

I have found it!

It had nothing to do with SPI after all. But, Stedy's suggestion to change SLRCON did somehow made me discover the real issue.

It was an SD card write timeout!

Here is how I discovered it: Once I figured out that the ADF part of the firmware also stopped working and that a reset of the Amiga side of the system didn't resolve the issue I turned my attention to the SD card code.
I turned on debugging in mmc.h and guess what: lots of errors being reported

Apperently, the first error that occurs is a write operation timeout; after that the firmware tries to do some read commands that fail immediately causing the endless read operations. The PIC firmware doesn't report failed SD card commands as failed ATA commands to the Amiga side so everythings seems to go OK while in reality it doesn't.

The write timeout in the original firmare is realized by counting the number of iterations in a loop. As the new PIC runs three times as fast the timeout counter also expires 3 times as fast. The SD card thus gets not enough time to complete the write operation and the system goes haywire.

I knew of some other busyloops that were used as timeouts and I had already fixed them but I overlooked this one.

I now replaced all timeout code in mmc.c (and other parts of the code) by code that uses the proper timer functions. I also increased the write timeout to 500ms(!). I found some SD specs that state that SD card can take up to 250ms or 500ms to complete a write operation in some circumstances. Normally it takes much less of course. You can find these specs here:
https://www.sdcard.org/downloads/pls.../part1_410.pdf
(see paragraph 4.6.2) I think the timeout in the original PIC version was marginal as well.

I now cannot get the system to fail; copies, installs, write operations, everything works perfect! And very snappy compared to the original version Almost like a sort of mini-ARM version .

I want to do some final things now (like bigger fonts, alternate core loading, some cleanups) and then it is ready for release!

Thanks for all your suggestions,

Mathesar
Mathesar is offline  
 
Page generated in 0.04850 seconds with 11 queries