Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Netduino Mini CD-player - now with video :-)

ATAPI PCF8574 IR I2C LCD

  • Please log in to reply
10 replies to this topic

#1 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 03 May 2013 - 09:04 PM

Hi!

 

I'm working on a CD audio player using a Netduino Mini as an ATAPI disk drive controller. ATAPI means ATA Packet Interface and is an extension of old ATA (IDE) which today is more known as PATA since the introduction of SATA (Serial ATA).

 

For this, I used my LCD IR controller from this post and three more PCF8574 I2C I/O-expander ICs. It took some struggling with the IDE register based protocol which requires no less than 24 digital IOs (hence the expanders) but luckily the internet is full of useful information.

 

This is just a first test and there's much more work to be done but the thing actually works and with the remote it can do, play/pause, next, eject, etc.

 

I think this is the first ever Netduino (mini) based CD player  :D 

 

Here's a picture, I'm sorry for the tiny size - I seem to be out of quota or something, I'm only allowed to upload 3kB now  :blink: 

EDIT: A good fairy just gave me some extra quota so here's a much better picture of the setup:

Attached File  mini_cd_player.JPG   152.5KB   53 downloads

 

The thing to the left is the PSU made from an eBay DC/DC step down with a MOLEX plug on it to supply the necessary 12V and 5V (2A each since these old buggers are really power hungry). The smaller floppy connector is used to power the Netduino so that's why it's goes into the breadboard while the MOLEX sits on the back of the CD drive.

 

Update:

Here's a demo video where I connected the CD player to a small digital amplifier with analogue input:

 

 



#2 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 03 May 2013 - 09:28 PM

very nice!



#3 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 03 May 2013 - 09:55 PM

Thanks NooM!

 

It's quite funny you know, these old IDE drives are pretty hard to come by now a days - the one I'm using (in the picture) is actually more than 15 years old and cost me only 3 USD.

 

Still all these drives have both analogue and S/PDIF out the back (16bit@44.1kHz digital audio) and some even (like this one) has a built-in headphone amplifier and a pretty ok DAC too. It looks a bit odd since it's a slot-in (front fed) model but the application should work with regular ones too and of course also with those without a headphone jack or navigation buttons.

 

I'm thinking of maybe adding a DIR9001 S/PDIF decoder and then feed I2S to a good DAC or maybe directly to a d-amp.



#4 ziggurat29

ziggurat29

    Advanced Member

  • Members
  • PipPipPip
  • 244 posts

Posted 04 May 2013 - 12:10 AM

pretty awesome!  but what's the tolerance of the chocolate egg in the upper left of the pic?



#5 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 04 May 2013 - 12:36 AM

This totally makes me want to go back to buying CDs again/ Really cool, hanzibal. Chris

#6 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 04 May 2013 - 04:05 AM

Thanks guys, I'm struggling with the "CUI" but it's not one of my best abilities plus a 16x2 isn't all that great to begin with.

pretty awesome! but what's the tolerance of the chocolate egg in the upper left of the pic?

Oh, you saw that, did you now. My daughter gave that to me the other day and I forgot to eat it. Good thing you reminded me :-)

This totally makes me want to go back to buying CDs again/ Really cool, hanzibal.

I wouldn't hope to much of 15 year old computer junk though, my drive just gave in and started skipping erratically - it's probably rusty from collecting dust for the last 10 years or so. I kind of knew that would happen so I got another 3 or 4 on their way over here but I like the slot-in kind since I'm thinking it would look so much better in a wodden box. They practically give them away but not the shipping which is like 10 times as much :-) Anyway, you can actually do a few things with these. I can now adjust volume and balance and also disable the eject button. All you have to do is plough through tons of irrelevant info in the 300+ pages specs and filter out the good stuff.

#7 ziggurat29

ziggurat29

    Advanced Member

  • Members
  • PipPipPip
  • 244 posts

Posted 04 May 2013 - 01:57 PM

id be interested in seeing your atapi code if and when you care to share.



#8 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 04 May 2013 - 03:34 PM

Sure, I'll post the full source code as soon as I get it a bit more structured and reliable.

 

It's a mix from different places, some is my own code while I ported other bits from here and there - X86 assembler, Arduino and a couple of Linux drivers. You have to kind of "average" the information since nothing seems a 100% correct no matter where you look  :rolleyes:

 

Here's the original spec from back when the interface was called SFF8020i:

http://www.bswd.com/sff8020i.pdf

 

Basically, you issue SCSI command packages on top of the register based interface of IDE but not quite since some registers have different names and meaning. The ATA Packet Interface is an extension that came about to preserve vendors investments during the switch from SCSI CD drives to ATA. It's quite confusing at times since the original specs where inaccurate in some respects and thus changed over time during which vendors implemented it so some drives work differently than others.

 

This article was a great inspiration:

http://www.handsonte...dio Adapter.pdf

 

And here's some of the documents I ploughed through:

http://lateblt.tripod.com/atapi.htm

http://www.jmargolin...ject/cdrom2.htm

http://www.pjrc.com/...ide/wesley.html

http://www.ele.uri.e...and_ide/IDE.pdf

http://www.jmargolin...ct/SFF8020i.pdf

http://singlevalve.w.../atapiduino.htm

http://www.bswd.com/sff8020i.pdf

http://www.jmargolin...ect/cdtbl2a.htm

 

EDIT: And btw, I updated my original post to include a video. Somehow the drive came to senses again so I guess it was a heat thing or something going wrong after while due to mechanical wear.



#9 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 05 May 2013 - 09:17 AM

Weird, the drive has been working for hours now. I placed a few bids on a swedish eBay subsidery yesterday. Unfortunately, I won them all so now I've got 14 different drives coming in the next week...on the other hand, 3 of them was 20 cents each and none more than 6 USD so what the heck :-) The purpose is to test different drives in trying to support as many of them as possible. Could even be it works with SATA drives using a cheap adapter.

#10 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 07 May 2013 - 06:46 PM

Made some progress in that I can now control volume and balance in a reliable way. Volume adjustment can be from 0db (max) down to -51.6db which is practically dead silence. Also muting works well. Depending on drive vendor's implementation, volume control is performed digitally which is suboptimal but good enough for most of us none audiophiles. Digital control results in increasing quantization as volume decreases, it's effectively like lowering the resolution. Volume should be performed analogously but with digital control. Also, I can now display remaining track time and such just like you'd expect from a cd player :-) One problem I'm dealing with right now is that constantly retrieving play time consumes significant processing time resulting in IR remote control latency. Currently update speed is ~3Hz but I need to increase that while maintaining IR remote control responsiveness.

 

Any ideas on how to accomplish this anyone?

 

An idea could be use a 5Hz refreshrate but use system time as a "PLL" to fake 4 out of 5 updates per second.  



#11 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 11 June 2013 - 05:57 AM

Ok, so my design and software works perfectly with quite a few of the drives I've tested but not all. Usually, it either works flawlessly or not at all. All drives are recogniced as ATAPI devices but in general, newer drives does not work as apposed to older drives. Also, drives with a headphone jack (which sometimes have buttons too) tend to have a better chance of working. I'll return with a report on specific drive models later.





Also tagged with one or more of these keywords: ATAPI, PCF8574, IR, I2C, LCD

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.