CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Emulate PATA HDD?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
kmp84



Joined: 02 Feb 2010
Posts: 354

View user's profile Send private message

Emulate PATA HDD?
PostPosted: Thu Aug 14, 2014 1:49 pm     Reply with quote

Hi Friends!

It is possible to emulate HDD with microcontroller ?
I want to emulate PATA Hard Disk Drive with microcontroller, i.e when connect my device to IDE computer channel my pc to sее standard info, for example:


Model : ST3160813AS
Firmware : CC2J
Serial Number : 9ZP051AG
Disk Size : 160.0 GB (8.4/137.4/160.0/160.0)
Buffer Size : 8192 KB
Queue Depth : 32
# of Sectors : 312581808
Rotation Rate : 7200 RPM
Interface : Serial ATA
Major Version : ATA8-ACS
Minor Version : ATA8-ACS version 4
Transfer Mode : ---- | SATA/300
Power On Hours : 5084 часа
Power On Count : 1302 пъти
Temperature : 39 C (102 F)
Health Status : Тревога!
Features : S.M.A.R.T., AAM, 48bit LBA, NCQ
APM Level : ----
AAM Level : D0FEh [ON]
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Thu Aug 14, 2014 2:10 pm     Reply with quote

PATA is not a single standard at all -
you should google for info before you go any further

what have you done so far to help yourself?
temtronic



Joined: 01 Jul 2010
Posts: 9245
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Aug 14, 2014 3:07 pm     Reply with quote

Yes, it is possible but really how much time and effort are you willing to spend on this project?
First problem I saw in your post was the 'want to emulate PATA' yet the data you show says 'SATA'.
You'll need to locate a GREAT reference to the way a PC 'talks' to a harddrive. The actual hardware interface,signalling standards and 'protocol'. Easiest would be to 'emulate' say a small drive, say 120 Megabytes, in 8bit mode. Once you get that working reliably 100%, you'll be able to carry on.
You'll need an 18 series PIC with lots of ram and I/O, I'd probably use the 18F46K22 as I'm familiar with it and _should_ do the job.
Honestly be prepared to spend 3-4 months on the project, it is NOT for a beginner !

Now if it was the 'other way', Using a PIC to read/write to an IDE drive, that was done 2 decades ago, using the then 'new' 16F877.

hth
jay
kmp84



Joined: 02 Feb 2010
Posts: 354

View user's profile Send private message

PostPosted: Thu Aug 14, 2014 10:49 pm     Reply with quote

temtronic wrote:
Yes, it is possible but really how much time and effort are you willing to spend on this project?
First problem I saw in your post was the 'want to emulate PATA' yet the data you show says 'SATA'.
You'll need to locate a GREAT reference to the way a PC 'talks' to a harddrive. The actual hardware interface,signalling standards and 'protocol'. Easiest would be to 'emulate' say a small drive, say 120 Megabytes, in 8bit mode. Once you get that working reliably 100%, you'll be able to carry on.
You'll need an 18 series PIC with lots of ram and I/O, I'd probably use the 18F46K22 as I'm familiar with it and _should_ do the job.
Honestly be prepared to spend 3-4 months on the project, it is NOT for a beginner !

Now if it was the 'other way', Using a PIC to read/write to an IDE drive, that was done 2 decades ago, using the then 'new' 16F877.

hth
jay

Hi "temtronic" !
First thanks to your positive answer ! Always "thinking forward" Smile
Second : Yes, my example wrong, because I have SATA HDD on my PC and get from it.
Third : in my case it is enough my PC to see that you said: "a small drive, say 120 Megabytes, in 8bit mode"
Ttelmah



Joined: 11 Mar 2010
Posts: 19550

View user's profile Send private message

PostPosted: Fri Aug 15, 2014 1:36 am     Reply with quote

There is a lot to this.

First part, I have to say that if I was being 'cynical', I'd say that if you have to ask such a poorly phrased open ended question, then the answer is almost certainly 'no'.... Twisted Evil

If you are asking if it is possible to connect a PIC directly to talk to an SATA interface, then the answer is 'no'.

Also, if you are thinking about something you might be able to do as a simple prototype, then the answer is also 'no'.

Key thing is to understand that SATA2, is a very high speed interface. As such, something that requires _very_ tight PCB layouts, and timings that are far beyond a PIC to handle (by several orders of magnitude...). To interface a PIC to an SATA bus, is physically not possible, _except_ by adding a chip to actually handle the interface, which then becomes a question of 'can I talk to this interface controller with a PIC', rather than 'can I talk to the bus with a PIC'.

Key thing to answer, is what you actually want to do?.
If the answer is something like 'emulate a hard-drive with a PIC', you then have the question of what is going to actually control this drive?. If this is a Windows system, and you want therefore to use a file-system, you run into the minimum file-system size limits on Windows etc..
If you actually want to use the PIC as some form of interface 'translator' between some other device, then just how fast the data can be moved, may well become problematical. One of the faster dSPIC's with DMA, may be adequate, but this depends on your targets.
I think it's important to emphasise that this is not what the 'PIC' is good at. Just as when people try to drive large colour displays, where there are dozens (hundreds) of 'better' chips, the PIC is ideal for small interface tasks, where low price is essential, but it is not a great data mover. It's ideal for simple jobs like controlling washing machines, or controlling individual motors on robot arms etc., but it is not really the chip for building the actual 'brain' of a complex robot, or doing graphics etc..
Also, it is worth pointing out, that USB (for instance) is already there on several PIC's, and can move data faster than the PIC itself can then cope with. A device using this to talk to the PC, could be 'started' in only a very few hours, while doing the same via SATA, is likely to take many weeks to reach the same point...

So step back, and give an overview of what you actually want to 'achieve' with this.
temtronic



Joined: 01 Jul 2010
Posts: 9245
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Aug 15, 2014 5:15 am     Reply with quote

I get from his answer that he wants the PIC to 'look like' a PATA HDD not SATA. The data he displayed was what HDD he has on his PC.

Mr. T is 100% correct there is a TON of code needed to be cut and a PIC just isn't the right choice but more importantly WHY this 'project'?
I know English is not everyone's 1st language and may be hard to tell us why you want to do this.
Even with 20+ years of playing with PICs,over 50 in electronics, I have NO ambition to even start to cut code to have a 'PIC emulate a HDD'. I see no meaningful benefit of wasting thousands (yes, 1000s) of hours on this project.
While the 'concept' or 'idea' is interesting the actual code necessary is HUGE and COMPLICATED. As Mr. T said, the PIC isn't the proper micro to begin with.

I do admire your ambition but if you tell us more like why you want to do this, we can probably suggest a better project that you CAN complete in a reasonable amount of time.

hth
jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19550

View user's profile Send private message

PostPosted: Fri Aug 15, 2014 7:04 am     Reply with quote

There is confusion on the drive interface involved, but he says in one reply:

"Yes, my example wrong, because I have SATA HDD on my PC and get from it."

Given that most modern machines won't even have a 'PATA' (IDE) interface now, I think he is talking about SATA. Especially with the reference to '300', which is of course a title reserved for SATA2.

The PIC is very much not 'the tool for the job', but it is possible that it may be, closer than it appears, depending on what the 'job' actually is!... Very Happy
kmp84



Joined: 02 Feb 2010
Posts: 354

View user's profile Send private message

PostPosted: Fri Aug 15, 2014 9:15 am     Reply with quote

Hi Ttelmah, temtronic and all other !

Sorry for my slow answers !
I want to emulate PATA HDD (parallel HDD older HDD interface) to see my PC (with Windows XP) on IDE channel, HDD with specific manufacture parameter:

Model : xxxxxxxxxx
Firmware : xxxx
Serial Number : xxxxxxxx (Most Important and configurable)
Disk Size :xxx.xx
Buffer Size : xxx
...etc
Only this information nothing else other!
Something like this : http://www.vecoven.com/trs80/trs80.html
It is CLEAR all in this Topic ?
Sorry for my English! Smile
temtronic



Joined: 01 Jul 2010
Posts: 9245
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Aug 15, 2014 10:30 am     Reply with quote

Question.
Do you want the PIC to be able to read a PATA harddrive and display the information onto a PC screen using a terminal program?


PC with terminal program <----PIC<----->PATA harddrive



If so, there's an article in Circuit Cellar using a PIC 16F877 to read/write to a PATA harddrive. I'll locate the article for you..

If this is what you want, it is possible and a lot easier with a newer PIC.
This is similar to the TRS-80 <---> PATA article you mention.

hth
jay
kmp84



Joined: 02 Feb 2010
Posts: 354

View user's profile Send private message

PostPosted: Fri Aug 15, 2014 12:30 pm     Reply with quote

temtronic wrote:
Question.
Do you want the PIC to be able to read a PATA harddrive and display the information onto a PC screen using a terminal program?


PC with terminal program <----PIC<----->PATA harddrive



If so, there's an article in Circuit Cellar using a PIC 16F877 to read/write to a PATA harddrive. I'll locate the article for you..

If this is what you want, it is possible and a lot easier with a newer PIC.
This is similar to the TRS-80 <---> PATA article you mention.

hth
jay


No, I want ONLY to connect my PIC to IDE channel in PC-motherboard and PC recognize my PIC device as "real" HDD drive with manufacture parameter :
Model : xxxxxxxxxx
Firmware : xxxx
Serial Number : xxxxxxxx (Most Important and configurable for me!)
Disk Size :xxx.xx
Buffer Size : xxx
etc.

PC_IDE <------->PIC
temtronic



Joined: 01 Jul 2010
Posts: 9245
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Aug 15, 2014 2:36 pm     Reply with quote

OK I understand now! As Mr' T pointed out THAT configuration is very complex, even under DOS6.22 it would be a great challenge, using Windows it might not be possible.
If I had this project I would begin with DOS6.22 and try to get it to work..then...go to Windows.
Do you intend to store data on the drive or just want to recognize it as a 'drive'? What is the real idea behind the project? The more details the better we can suggest ideas!
This is a very,very complicated project......one I wouldn't tackle unless paid a LOT of money.

hth
jay
kmp84



Joined: 02 Feb 2010
Posts: 354

View user's profile Send private message

PostPosted: Fri Aug 15, 2014 11:03 pm     Reply with quote

temtronic wrote:
OK I understand now! As Mr' T pointed out THAT configuration is very complex, even under DOS6.22 it would be a great challenge, using Windows it might not be possible.
If I had this project I would begin with DOS6.22 and try to get it to work..then...go to Windows.
Do you intend to store data on the drive or just want to recognize it as a 'drive'? What is the real idea behind the project? The more details the better we can suggest ideas!
This is a very,very complicated project......one I wouldn't tackle unless paid a LOT of money.

hth
jay
Just want recognize it as a hdd drive to simulate hdd with specific ser.number!
Ttelmah



Joined: 11 Mar 2010
Posts: 19550

View user's profile Send private message

PostPosted: Sat Aug 16, 2014 12:27 am     Reply with quote

I have to ask.
Why?.

Seriously, this is a lot of programming. Whatever hardware is used, there is a few hundred hours of work involved here. The simplest way I can think to do it, wouldn't involve any hardware at all!. In the Microsoft Technet sources, there are example IDE drivers. It'd be far simpler than trying to do this in hardware, to modify one of these, so that you load this driver, and it tells you there is a specific drive there, even when there isn't!....

I'd suspect the poster wants to generate a spoof serial number to get round the security used in some programs/games.

Look at:

<https://www.raymond.cc/blog/changing-or-spoofing-hard-disk-hardware-serial-number-and-volume-id/>
kmp84



Joined: 02 Feb 2010
Posts: 354

View user's profile Send private message

PostPosted: Sat Aug 16, 2014 1:58 am     Reply with quote

Ttelmah wrote:
I have to ask.
Why?.

Seriously, this is a lot of programming. Whatever hardware is used, there is a few hundred hours of work involved here. The simplest way I can think to do it, wouldn't involve any hardware at all!. In the Microsoft Technet sources, there are example IDE drivers. It'd be far simpler than trying to do this in hardware, to modify one of these, so that you load this driver, and it tells you there is a specific drive there, even when there isn't!....

I'd suspect the poster wants to generate a spoof serial number to get round the security used in some programs/games.

Look at:

<https://www.raymond.cc/blog/changing-or-spoofing-hard-disk-hardware-serial-number-and-volume-id/>
Hi again , you are right and I found this link before 2 weeks but didn't successed with those software tools . I don't want to lose your time for this topic yet and thank you for help and all advices
temtronic



Joined: 01 Jul 2010
Posts: 9245
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Aug 16, 2014 5:30 am     Reply with quote

Obviously I'm out of here as there's several viable, known, working solutions to the 'project',sadly not PIC based!
I'd hate to find out just how many sites I'd be blocked from if I changed the HDD serial number.I assume the OP has a dedicated PC for his gaming.

off to the next challenge !!

jay
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group