Peer into the mind of Dan as he tries to build an MP3 Player for his PDA and searches for the next thing in his life be it an electrical engineering job or graduate school.
So I had my first falafel earlier today. One of my friends introduced me to it as a late night snack when we were at Second cup last Friday. Falafel is sort of like this wrap that's got this non-meat filling inside it with lettuce and tomatoes wrapped with pita bread. It tasted pretty good. I'm not exactly used to the whole late night snack thing... well, I can usually go for a "coffee" or something with another friend-but my "coffee" is really a hot-chocolate or something with less caffeine. I never took up "coffee"-it just doesn't seem to suit me. I'm probably closer to the Asian herbal tea drinker at night. In the morning-its getup and go! Anyways back to the falafel, we were talking about Harry Potter and well its impact. Personally I think that if you regard it as a story, a very well crafted story for kids then its great. Let them read it as long as they realize that its just a story. You read it for entertainment. Some people believe that its promoting the occult and yes I can see how that might be. I think it depends on how you raise your kid. If you teach them the difference between fantasy and reality they'll usually turn out fine. If people keep on protesting that it promotes witchcraft and other satanic rituals well I think you're just giving the story more power, and more credit than it deserves. It is just a fun story. Let the flaming begin :)
I'm still working on the code segment to initialize and send information out of the USB port on the Palm PDA. I'm beginning to understand the documentation but it seems like there's still a lot of ground to cover. For example, even initializing the port isn't as simple as initializing a serial port. According to the documentation depending on the function that you're planning on using the USB port for it can initialize differently. However I haven't read enough to find out how to change it. No one has posted anything yet or replied to my e-mails.
I drew up some cool concepts for a case. I'm thinking of making it extendable so that normally it'll be closed with the buttons on the inside and then you can pop it open. Once it pops open you have access to the play/pause, volume controls, and whatever other buttons you need on the hardware end. Originally I was going to wire a hold line through the cap so when it closed the device would be set in 'hold mode'; however, thinking back on it-it doesn't really need a hold button when the buttons are closed off. Diagrams are probably in order ;P I'll try and post a few.
Maybe my posts are getting too long, it seems like blogger always spits back an error message. Oh well!
Well I found the b-connector for the USB cable. Turns out that Digikey has them. Unfortunately with digikey you need to place a minimum order-like $25 or something like that. Guess how much each connector is? about a $1.00 at most. Maybe if I give the number to arrow they might be able to get some.
Replying to e-mail is sometimes easy and sometimes not so easy. I have on and off weeks. They seem to come in weeks anyways. Like this week seems to be an on week. I can think up replies on the spot and write back. With e-mail there's a tendency for me to review and revise an e-mail to death before sending it out. I'm always wondering if I can write it better (not that I'm a writer-I just like to keep on making things better). I guess that might be the perfectionist part in me. I usually like to think there's a right moment to say something or do the right thing. Sometimes the timing has a long wait. This is different from Instant Messaging. Instant messaging is closer to conversation and things seem to flow naturally. E-mail gives you more time to craft and select the appropriate words. However, having more time gives you more chances to procrastinate and end up not sending e-mail at all-I apologize.
In my ongoing search for samples of USB code-I have found very little. I'm trying to thoroughly read the Palm's Programmer Companion and Reference API. They contain information regarding the serial manager, but no concrete examples. It might have to be a guess/compile/test thing which I'm not sure I'm comfortable with. That's been a major thought for me. The hardware is coming, I'm understanding more about the YAMP project and its source code. I downloaded the avr-gcc and will be installing it soon. Oh yeah, before I forget here's the link for the PDB converter. Its host site is called Netmite, they develop all sorts of applications. Of interesting note is the Palm Audio player they have. You can play .wav files through the tiny little speaker (or buzzer) installed on your palm. They use the same method (I'm assuming) of uploading .wav files. The difference is that they actually decode the .wav files on the palm itself whereas this project will send it to a decoder chip. I don't see any source code, but then the only thing of interest would be the fact that it goes through the database section by section instead of record by record.
I took apart our family's old cell phone. I was curious to learn more about the LCD screen. It was pretty easy to remove. I'm not exactly sure why I wanted to see it so badly or what I hoped to gain. I think I'm going to actually order my mp3 and usb decoder chips next week. That'll give me at least another full week to examine the source code some more. I'm thinking of skimming off all the ATA and LCD parts, set it to play directly off a USB stream and hopefully that'll be all Ineed from that end.
One final note, I gotta figure out how to get better at playing Scrabble. Maybe I'm just not looking at the letters correctly or thinking the right way. No real life or death situation-I just want to get better, that's all... slightly boring post I know, but that was today :) Happy Thanksgiving to the people in U.S. (we beat you to it-nyeh!:)
So its been a few days, a lot and yet not much has happened on the project. Well first of all the exciting news: I finally found the program I was looking for to load mp3s onto the PDA. I'm not sure if you know this or not but with the Palm OS (ver 4.1) you can only two things onto the PDA's memory, a program (.PRC) also known as a a Palm Resource File, or a database (.pdb) used by the program. It doesn't make any sense to load a separate program for each mp3 you want to play. Maybe that might work in the initial test phases but the space allotted to store programs on the Palm architecture isn't meant for high volume anyways. I finally found a java program that converts any file into a pdb file. I've always had in mind that I could probably just send the palm database to the mp3 decoder, and trick the palm into thinking it was just some ordinary (yet large) database. I'll post the link here tomorrow.
I'm examining more source codes from different projects. Half of them are for the AVR and hardware related issues. The "C"-source code is pretty easy to read, I have to admit that and the source code for the YAMP3/USB project is fairly well commented. I'm realizing that the YAMPP3 handles USB streaming as well. I saw this on the YAMP forum webpage. If you set it [YAMP] in the right mode and send it an mp3 file into the USB port it'll shunt the file to the decoder. I'm hoping to capitalize on this and base a lot of the hardware on it. Fortunately I can skip all the harddrive stuff and for now, skip all the lcd screen stuff as well. I think the song title will be displayed on the PDA itself. No need to waste extra power. Although it would be cool, but just not a necessity for the initial.
On to the not-so-good news. I'm having lots of trouble finding any documentation or examples of using the USB port for the Palm OS. There were only a few lines mentionned and it wasn't very clear about how I can change the Serial Manager's functions (the API in charge of communicating) to use the USB. I mean they have examples on the web on how to send and receive data on the serial port-but I think the USB port is slightly different. I've posted questions on some of the forums I go on but so far no one has replied. I even e-mailled Hacker-san (Mr. Yamada) a question but haven't heard anything yet.
In other USB related news, I haven't been able to locate a B-connector. This is the socket you plug your USB cable into. I sort of need it to keep on going. I'm going to check the JELU web shop and see if they sell it... doh, more devices to be mailed overseas. I talked to one a service support person at www.themindfactory.com, a Canadian IC designer or something like that and they apparently use the VS1001K as well. I was hoping they could ship me a chip or two (maybe more in the future) but apparently they only ship entire designs. I realize that eventually IF (and this is a big IF) I finish this device and IF people around me who have similar PDA's like it I'll have to get more chips and sockets (wherever those are). It would be nice to have a supplier in Edmonton. I'll see what Arrow can do for me. Digikey doesn't seem to be much help right now... they might be for the USB chip later on but not right now. The search goes on...
Yeah, I read webcomics. People put so much effort and energy into drawing, and thinking of them how could you possibly not? There's all the major and popular ones that any internet shmoe can probably tell you, but that shouldn't discount every other comic you. Take Lil World of Meekerz its written/drawn by a Chinese girl named Mika. If you like the reading and seeing chibi stuff you should definitely check it out.
I found on Palmopensource.com a palm program (complete with source code) that uses the serial port to send and receive files. This isn't too far away from what I actually need to program for my mp3 player. The only difference is that it'll just be sending the data streams out (for now), and it'll be through the USB port instead of the serial port. Accoding to some of the references on the Palm website, its just a matter of changing a few lines of code to switch between USB and serial.
I've pretty much come to the conclusion that I'll have to use the USB. After lots and lots of googling I found a few more specs on a similar (*cough Sony) attachment for the PDA (*cough cough PEGA-S300). I found out that the highest quality it can stream is 128kbps. Which isn't bad, I believe that's around the limit of streaming data via USB 1.1. This confirms one of my worst fears-I'll have to figure out exactly how to read the streaming data via the USB on the hardware side. Which is also a relief, I don't have to worry about IF I need the FTDI USB chip, I KNOW I need some sort of USB chip.... doh.
Finally, it looks like programming may not be all that much work... once I understand it all :)
So, in my efforts to do my "green" part I tried to use a solar powered battery charger to give power to my AVR programmer. I thought the light I used to normally work under would be enough to provide the required 4+ volts. Unfortunately, at best, this solar charger could only give me 1.59V. I thought maybe I could use more lights-more lights means more power right? But then, by the time I turn on all the lights, I realized that I'm probably wasting much more energy trying to power the charger than I am saving in the first place! So the important thing is that I think I'm done building the programmer. All I need now is a constant power source. I got my crystal all hooked up and everything. I'll probably just rip some battery pack off an old toy and use that :)
On another note, the Edmonton Eskimos lost to the Montréal Alouettes today in the CFL finals (Grey Cup). It was such a close game, well points wise. The game could have easily gone either way, there were a lot of missed chances. I can only imagine the pressure and all the 'what-ifs' going through their heads. What if I had only done this or not that. Life can be like that you go from one situation to another thinking 'what if I had done this' or 'what if I had decided that'. Which can be good-I think its a way for me to learn from what happened and improve myself. Everything happens for one reason or another so that you might learn. However, one of the problems that come out from doing what ifs is wallowing in regret. To regret not doing something is ok, but to live each moment in regret-mourning over what happened. That's no way to live. If you keep on going that way, you'll lose confidence in yourself, you begin to doubt whether you'll make future mistakes. Well DUH! everyone makes mistakes. We're far from perfect, its what we learn from the situations that God gives us, that will make us be more like Him. That's my 2 cents or for you US folks 1.2 cents :P
I'm still worried about the transfer rates. I'm hoping that if I can get the whole setup to work via a serial port on the computer then I won't need to use the USB chip. However, at the same time, I don't want to realize the serial way isn't fast enough and then have to order, and wait for a USB chip to come in. Decisions, decisions.... there has to be a way of finding out.
A few other notes, I was discussing with my brother about the features I want the AVR to control. We came up with a reasonable list, volume up, volume down, power, pause/play, a hold switch, and a bass boost (or some frequency boost). The last three are final stage, as they aren't necessary for the device to actually work. The Pause/Play can be directly controlled via the PDA (its just there for convenience-to pause the stream). The Hold Switch should be a switch (which is different from a hold button because that buttons can be accidentally pushed), because switches (especially inlaid switches) are less prone to accidents. Unfortunately I haven't been able to figure out where to find an 'inlaid-type' switch. The Bass boost, that's just for fun-to test my DSP skills. :)
Didn't actually do too much today in terms of physically building the player or hardware. It was more of a thought exercise. I do this quite a lot, ponder on what, and how to do things-not so much the 'why' or 'why not' simply because well that's the way I want to.
In looking at the code from the YAMPP project, doing 'it' in C is pretty attractive. I have all the coding to initialize the VS1001K all done for me in "c". All I have to do (haha) is just add on my own code. Seems simple no?
On the other hand, I could also probably write (not saying that I'm great or anything) but since the model code is done for me, I could possibly write it in Assembly and skip the whole C thing. C versus Assembly, well, the c code gets compiled into an assembly source, but you get the picture. Anyways C versus Assembly, C has the advantage of setting up functions, and modularlizing the code. Assembly is a very direct, very straight and obvious code. "C" is higher level, Assembly is as low as you probably could get next to doing machine code. "C" can do functions, Assembly... well, not easily. You can push stuff onto the stack, jump to some code, then pop off the variables. That might be a lot of work. "C" I'd have to learn a new syntax-the avr gcc isn't quite C. Basically you mainly use it to create functions and handle the flow better.
My conclusions? Sure, what the heck, I'll give the c a shot. I also found out today that according to the datasheet I need a 4 to 6.0V source for the AVR. versus the 3V I had originally in mind. See, the chip I got was a AT90S8515 8PC which apparently means that the VCC must range from 4 to 6 instead of 2.7 to 6. Dry no? Dry oui!