Parallel ata IDE devices help

TERD

New Member
Hi, i plan to use a 120gb hard drive for one of my projects. I dont need to worry about a file system just yet as I'm hoping to use the device in much the same way as you would a memory eeprom: set the address then, read/write a byte to the device.

Does anyone have any experience with i usng a picaxe (or any microcontroller) to read/write directly to/from a 40 pin IDE hard drive / cd writer / dvd rom etc?

Please post any info you have on the subject of ata communicaton, thanks.
 

hippy

Ex-Staff (retired)
I've considered it. First problem is the large I/O line count, or complex shift-register hardware to interface between the PICAXE and IDE drive. Second problem is lack of RAM memory to buffer 'pages' of data from the IDE drive. If only ever reading or writing it could work but updating single bytes at random could be difficult at best. Third problem is understanding the IDE specification and commands.

Bottom line is it could be done, but the question is, is it worth it ?

Writing to CD-Rom or DVD would be a whole lot of extra complexity which is probably beyond the PICAXE. That would almost certainly require some sort of file system handling.

I did some calculations and it would take 40 years to fill a 120GB HDD writing one byte every 10mS. What project are you thinking of ?
 

TERD

New Member
media files

I have made my own firmware that runs on the picaxe. it allows the picaxe to load and run programs stored externally.

I need more space so my programs can call upon media files for displays, sounds, recording audio, mass data logging, mass storage media backup and copying.

The firmware is programmed using an insruction set and works much the same as asm, there is an instruction pointer,4 general purpose 16 bit registers, zero flag, sign flag, carry flag, overflow flag, stack etc. most of the picaxe functions are linked to the instruction set plus many custom subroutines too.

here is an example of code that would be compiled and stored to an sd card or a memory chip

(memory line) (instruction) (data,[data],[data],)
00 TPN 0 'test input 0
01 CMP 1 'compare to 1
02 JNE 00 'jump back to 0 if not equal
03 TRX 79,78 'sertxd("ON")
04 HPN 0 'high 0
05 SLP 1000 'pause 1000
06 LPN 0 'low pin 0
07 JMP 00 'jump to line 00
 

demonicpicaxeguy

Senior Member
i gather speed isn't much of an issue since you've written it to run on a picaxe, interpreter running and interpreter,(try saying that 10 times really fast)

if you use a 24lc256 i2c eeprom you can get about 32k worth of code storage but it's fairly slow to interpret code from on a byte by byte basis

the next reasonable option is to use a picaxe with the most pins 40x1 , hook it up to a parallel eeprom with a internal sequencial counter and interpret code off that shouldn't take much code to inplement, that would certainly speed things up a fair bit

as for mass storage with a picaxe,

the current state of affairs with mass storage is

sd cards: to my knowledge no-one has been able to get it going reliably

mmc cards: hippy has done it but mmc cards aren't as readily availble

compact flash: it should be quite easy but it would require quite a few pins to do , i'm not sure how many people have done it

xd cards : i don't think anyone has actaully tried , however i'm going to give it a go now that i have a xd card socket the interface is the same as the samsung nand chips which use 8 parallel shared data and address lines with a few control lines so it can't be that hard

nand chip : i don't think too many people have done it/attempted it given the are only available in fine surface mount packages

sd card modules : been done and tried to death people who have gotten it working are either quiet about it or don't brag about it
you're best bet is probably here


just curious how many instructions are there in your interpreter?
 

BCJKiwi

Senior Member
@ The Demon
When you say
"sd cards: to my knowledge no-one has been able to get it going reliably"
and'
"sd card modules : been done and tried to death people who have gotten it working are either quiet about it or don't brag about it
you're best bet is probably here" - where is "here"?

Did you miss the post at;
http://www.picaxeforum.co.uk/showthread.php?t=8513
 
Last edited:

demonicpicaxeguy

Senior Member
@ Tthe Demon
When you say
"sd cards: to my knowledge no-one has been able to get it going reliably"
and'
"sd card modules : been done and tried to death people who have gotten it working are either quiet about it or don't brag about it
you're best bet is probably here" - whre is "here"?

Did you miss the post at;
http://www.picaxeforum.co.uk/showthread.php?t=8513

yep missed it completely good to know somone has done it though

when i said... typed "here" i meant as in here with an sdcard module
 

hippy

Ex-Staff (retired)
I need more space so my programs can call upon media files for displays, sounds, recording audio, mass data logging, mass storage media backup and copying.
That all sounds feasible on paper but the PICAXE is considerably slower than a desktop PC with far less memory and with an interpreter on top even slower and more constrained. Reading a 10KB file would probably take 3 seconds and likely more, and that's just 1 second of audio at rather poor quality. It's worth trying it but I'd suggest start with smaller files and using I2C/SPI Eeprom/Flash to start with which can be much more easily interfaces and are cheaper to buy.
 

BCJKiwi

Senior Member
If you use a uALFAT-USB and a USB interface on the HDD then you would have a mass storage device accessed by PICAXE using FAT. Full Fat32 is supported.
With uALFAT, any number of bytes can be read as a block from any position in a file.
I have no idea if this would be useable in your situation but it would appear to cover all your requirements.
uALFAT-SD/TF are plenty fast for datalogging - not sure what sort of access speed you would need for your offline code. Also not sure if there is a significant performance hit working through USB.
Current project is running a 28X1 at 16MHz, doing a load of processing, reading sensors, RTC etc etc, manipulating the data etc, running display and logging data to an SD version of uALFAT and still getting around 15 complete program cycles per sec at i2cslow (100KHz bus). SPI is supported up to 8MHz.
Depending on the level of development you are interested in, you can buy the bare chips from GHIElectronics, you don't need to buy the made up board.
 
Last edited:

TERD

New Member
Speed isnt an issue, the ualfat would work and memory chips are ok but:

My problem isnt so much 'i need storeage space', it's more a case of wanting to understand how to read and write to an IDE device simpily so that i can access standardised media and hard drives from within my appications. It doesnt have to be picaxe.

This knowledge will add to my design process and give my applications mre capabilities.
 
Last edited:

demonicpicaxeguy

Senior Member
i'd be looking towards xd cards since the interface is the same as the nand chips or compact flash since it's somewhat close to the ide interface anyway .......................
my 0.02c
 

TERD

New Member
i know about all the other stuff available to save data lollolol, but it's kind of off subject...

Disregarding speed(dont care), complexity(dont care), file systems(not a problem), components used(not a problem), other ways of saving data(not interested) and the mass of a picaxe inner core times by he speed of light squared(for another day)...

if anyone comes up with a design, from scrath, not using modules, (or knows how to make) a basic ide(or sata) i/o circuit that would return data from or write data to an addressed cluster/byte please post any info here? :-|

Thanks men,
mrx.
 
Last edited:

Brietech

Senior Member
Interpreter code?

Hey, Would you be willing to post the code for your interpreter? I've written a simple interpreter that I was able to get working fairly well (very simple assembly-type instructions), just reading from an i2c eeprom, but I'm always interested in how other people have done it.
 

hippy

Ex-Staff (retired)
if anyone comes up with a design, from scrath, not using modules, (or knows how to make) a basic ide(or sata) i/o circuit that would return data from or write data to an addressed cluster/byte please post any info here? :-|
There are a number of IDE interface designs on the WWW for a variety of microprocessors, and the IDE ATA specification should be out there somewhere, Compact Flash in IDE mode is the second best reference.

In essence an IDE drive is just an 8/16-bit data bus, with 8 addressable registers, plus read and write lines. Fancy stuff like DMA and IRQ doesn't need to be supported and it should be fairly straight forward to read and write a specific sector on disk.

Google's your friend, and this is as good as any place to start ...

http://www.barrymichels.com/ide
 

TERD

New Member
Hey, Would you be willing to post the code for your interpreter? I've written a simple interpreter that I was able to get working fairly well (very simple assembly-type instructions), just reading from an i2c eeprom, but I'm always interested in how other people have done it.
I plan to post it when i'm finished prototyping. It's sounds mad....running an interpreter on an interpreter, you may think it's slow and what the point lolol but there is a point....

It allows you to code your picaxe with the same ease as you would program a vb.net applicaion and it's multi-threaded.

You copy and paste picaxe .bas code into the editor area of my compiler made in vb.net. It converts to .bas code to my instrustion set then downloads it to a 256Kbit eeprom. Numerous modules/chunks of code can be stored.

All the code modules stored on the 256k are kept track of in a simple file table/memory map. The code manager system catagorises code in four ways: exe,dll,cfg,txt.

when writing code...You can import an exsisting bas dll then call upon it's functions. This makes it easy to perform very complex opperations such as string operations. For example, one dll in my core system allows you to declair strings, mid(string,offset,count) it etc.

There is what i call a sub-processor bus or a threadbus. I'm using the 40x1 as a sub-processor. There can be as many 40x1's on the bus as you want the main processor is connected to a math co-processor. All are connected to a messeage queue sytem(what i call the main data bus) and an input/ouput system. Each one is strapped with my firmware and given an id.

Programs can be assigned a threadID and will run on a given processer allowing you to perform multiple tasks at once in the same process/program.

The draw back is, if things go wrong it's very hard to debug but i'm working on it.

Here's some plans i got for the system......
read CD-Rom/dvd-rom's
store data onto a harddrive
load programs onto a 512mb pc ram module.
 
Last edited:
Top