EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

IDE interface....compact flash

Started by yeloohwnala September 2, 2003
Hi,
Im trying to interface a compact flash card to a Spartan2 FPGA in
TrueIDE mode.I am having two main problems
1)My LBA address is being ignored. If I write data to one address and
read a different address, I still get the data back.Checking the
Cylinder High\low registers etc they do contain the LBA adress I
want, but the card just seems to ignore it
2)Also if i try and read read more than one sector (i.e change the
sector count registor to greater than 1!) I just get 2 sectors
repeated eg if I write 40 sectors and read 40, i get sectors 39 and
40 of the data I "wrote" 20 times!
Below is the setup steps that I use when writing(reading similar)
[I have "wait till the device is ready" loops after most steps]
A)Hard reset
B)Initilise Device Parameters
C) Setup as Master LBA mode
D) Soft reset
E) Setup as Master LBA mode
F) Write Sector Count Register
G) Write the LBA address(Sector Num Reg., Cylinder
High\low,DeviceHead Reg)
H)Write the "Write Sectors command"("Read sectors command" when
reading)
I)Wait transfer ready
J)Write word....I and J loop till completion

If anyone here has any experience with compactflash(or hard drive)
interfacing your help would be much apreciated.At my wits end!!
Thanks
Alan



Hi Alan,

I got Tony Burch's B5_Compact_Flash Working in 8 bit mode with a 6800/1 CPU.
I wrote routines to read and write single sectors but I have not tried
it with multiple blocks.
How are you using the Compact Flash ? ie. are you using dedicated
hardware to read
the sectors, or are you using a CPU ?

I'd offer to look at your code, and perhaps try it out on my board, if
you wanted.

John.

yeloohwnala wrote:

>Hi,
> Im trying to interface a compact flash card to a Spartan2 FPGA in
>TrueIDE mode.I am having two main problems
>1)My LBA address is being ignored. If I write data to one address and
>read a different address, I still get the data back.Checking the
>Cylinder High\low registers etc they do contain the LBA adress I
>want, but the card just seems to ignore it
>2)Also if i try and read read more than one sector (i.e change the
>sector count registor to greater than 1!) I just get 2 sectors
>repeated eg if I write 40 sectors and read 40, i get sectors 39 and
>40 of the data I "wrote" 20 times!
>Below is the setup steps that I use when writing(reading similar)
>[I have "wait till the device is ready" loops after most steps]
>A)Hard reset
>B)Initilise Device Parameters
>C) Setup as Master LBA mode
>D) Soft reset
>E) Setup as Master LBA mode
>F) Write Sector Count Register
>G) Write the LBA address(Sector Num Reg., Cylinder
>High\low,DeviceHead Reg)
>H)Write the "Write Sectors command"("Read sectors command" when
>reading)
>I)Wait transfer ready
>J)Write word....I and J loop till completion
>
>If anyone here has any experience with compactflash(or hard drive)
>interfacing your help would be much apreciated.At my wits end!!
> Thanks
> Alan >
>To post a message, send it to:
>To unsubscribe, send a blank message to:
>
>">http://docs.yahoo.com/info/terms/

--
http://members.optushome.com.au/jekent




Hi,
my code is actually based around Tony's board/sample code also.I
kept it in 16bit mode.The compact flash is interfaced toan XESS FPGA
board which issues all instructions to it.I contacted Tony yesterday
evening and he is working on new CompactFlash examples so he'll send
them onto me when finished.If you wouldnt mind I could send you on my
CF controller if you could just have a quick look at it.Its basically
a large state machine stepping through my control signals....very
repeditive. Maybe you would notice a control I am missing.No problem
if you cant.
Alan --- In , John Kent <jekent@o...> wrote:
> Hi Alan,
>
> I got Tony Burch's B5_Compact_Flash Working in 8 bit mode with a
6800/1 CPU.
> I wrote routines to read and write single sectors but I have not
tried
> it with multiple blocks.
> How are you using the Compact Flash ? ie. are you using dedicated
> hardware to read
> the sectors, or are you using a CPU ?
>
> I'd offer to look at your code, and perhaps try it out on my board,
if
> you wanted.
>
> John.
>
> yeloohwnala wrote:
>
> >Hi,
> > Im trying to interface a compact flash card to a Spartan2 FPGA
in
> >TrueIDE mode.I am having two main problems
> >1)My LBA address is being ignored. If I write data to one address
and
> >read a different address, I still get the data back.Checking the
> >Cylinder High\low registers etc they do contain the LBA adress I
> >want, but the card just seems to ignore it
> >2)Also if i try and read read more than one sector (i.e change the
> >sector count registor to greater than 1!) I just get 2 sectors
> >repeated eg if I write 40 sectors and read 40, i get sectors 39
and
> >40 of the data I "wrote" 20 times!
> >Below is the setup steps that I use when writing(reading similar)
> >[I have "wait till the device is ready" loops after most steps]
> >A)Hard reset
> >B)Initilise Device Parameters
> >C) Setup as Master LBA mode
> >D) Soft reset
> >E) Setup as Master LBA mode
> >F) Write Sector Count Register
> >G) Write the LBA address(Sector Num Reg., Cylinder
> >High\low,DeviceHead Reg)
> >H)Write the "Write Sectors command"("Read sectors command" when
> >reading)
> >I)Wait transfer ready
> >J)Write word....I and J loop till completion
> >
> >If anyone here has any experience with compactflash(or hard drive)
> >interfacing your help would be much apreciated.At my wits end!!
> > Thanks
> > Alan
> >
> >
> >
> >To post a message, send it to:
> >To unsubscribe, send a blank message to: fpga-cpu-

> >
> >">http://docs.yahoo.com/info/terms/
> >
> >
> >
> >
> >
>
> --
> http://members.optushome.com.au/jekent




Hi Alan,

I had a suspician you might have been using Tony's code.
I have not tried the state machine code yet, but I'm
sure it works ok (on single sectors).
I used it as the basis of my 6800 driver ie. finding out
what commands to issue it, so I'm reasonably familiar
with how it worked.

I'm not 100% clear on what you are doing to interface
the compact flash ...

Do you have Tony's Compact Flash board wired up to
the XESS board or are you using the XESS board to
interface to one of Tony's boards running the Compact Flash
code ?

I've been helping a friend port some simple micrprocessor
code to an XSA-100 board. From what I understand of
the XSA-100 (if thats what you are using) is that it has a
6 bit DRAM chip and a 8 bit x 512K byte static RAM
on the mother board (If you have that).
I assume you are using the 16 Bit DRAM, in which case
you must be using the DRAM controller logic as well.

Check out www.retromicro.com . I think Doug had some
problems with the DRAM Controller Code at one stage.
There is updated DRAM code on the XESS web site I beleive.

What might also be of some interest is that I noticed on
the open cores web site a week or so ago, someone
posted a MSDOS File reader. I think it was for compact
flash. I think it was based around a microprocessor core
though. It had the code for it under CVS.

In any case, send the code over, and I'll have a look at it.
I'll try intergrate it into my memory examine and change code
which works on 16 bit SRAM, to see what it's doing.

My email address should be on the top of this email.

John.

yeloohwnala wrote:

>Hi,
> my code is actually based around Tony's board/sample code also.I
>kept it in 16bit mode.The compact flash is interfaced toan XESS FPGA
>board which issues all instructions to it.I contacted Tony yesterday
>evening and he is working on new CompactFlash examples so he'll send
>them onto me when finished.If you wouldnt mind I could send you on my
>CF controller if you could just have a quick look at it.Its basically
>a large state machine stepping through my control signals....very
>repeditive. Maybe you would notice a control I am missing.No problem
>if you cant.
> Alan >
>

--
http://members.optushome.com.au/jekent




The 2024 Embedded Online Conference