TCP/IP Hell

Posted October 18, 2009 by Bernard Klinc
Categories: General

So first of all my PCs monitor died so there was some delay, now i got a new LCD to get things moving again.

But now that i tried getting some TCP/IP code working it was nothing but frustration. What i went on doing is striping the XC2 webserver exsample down to the bare TCP/IP code, but later found out its a far more complicated task as i first toght. There is a lot of code, but whats the problem is that the code is tightly glued together. So its very hard to determine whats needed and whats the webserver code i want to get rid of. I am thinking of abandoning this approach and do something else. Meaby take the raw MAC exsample and stick a tcp/ip stack on top of it or something.

Anyway this TCP/IP is not the plain sailing i expected it to be.

Advertisements

Blinky blinky!

Posted October 10, 2009 by Bernard Klinc
Categories: General

Thanks to the nice tutorials that come with the development environment , i was blinking LEDs in no time! But as this thing is not one of those beginner arduino kits or such the tutorial quickly jumps in to teaching you how to write multithreded programs that run on multiple cores. The stuff can be a bit confusing at first since you are basically learning a new language called XC.  But its pretty much the same as C,  just with a few twists in it to allow multitasking and all these unique xmos features.

100_2636It went great until i got to the Ethernet part. I just couldn’t get stuff to compile but it thourned out to be a little compatibility issue and a wrong make file problem. But once i got it sorted the thing worked beautifully. I did a lot of reading also on how to program in XC so its a little more clear now and also digged in to the guts of the IP stack o understand exactly how it works.The job im working on now is getting a nicely working TCP/IP base. I plan on simply riping the webserver example apart til i get down to the TCP/IP port level. Since from that level up i can implement almost any service (from a webserver to FTP to sending e-mails) As far as i got trough the webserver code i see that it should not be very problematic as a open source TCP/IP stack was used. The stack is quite well documented so tomorrow im expecting to have a finished TCP/IP base and start fooling around with it.

Also found a nice Ethernet debugging tool while researching how the IP stack works. Its called WireShark and its a program that can display the raw data going trough the network card while analising it. I love this software as it bypasses everything and grabs the raw data right off the ethernet card. Only problem is that my network card is usually quite busy (IM,Mail,WebRadio…) so WireShark displays a whole pile of various traffic going all over the place. Im thinking of garbing a network card thats laying around and stick it in to PCI , then instead of plunging the xmos board in the router i could plug it in to the PC directly. That way i wouldn’t see any other junk on the line and i could see stuff that is going to other IPs as well.

The development board is here!

Posted October 9, 2009 by Bernard Klinc
Categories: General

xmos boxI always get exited when cool electronics come in the mail, but this time i had a reason to get even more exited then usual as i got the XC2 board from xmos today!

First off i have to complement the nice box it comes in.Most stuff comes in a cardboard box wrapped in plastic. But they acualy put some effort in to making the box something special.

So what came inside it:
-XMOS developlent board
-XTAG to USB interface
-miniUSB cable (With a nice winding mechanism)
-5V adapter with plugs for most countrys

So i quickly garbed a spare network cable and plugged it in. The demo program on it worked like a charm hosting the demo website on my LAN. I still need to get the XTAG interface figured out and try making my first program for it.(You guessed it ! A good’ol led blinking program)

I know i wont be bored this weekend!

PCB Design getting there

Posted October 1, 2009 by Bernard Klinc
Categories: General

So i done some work on it again and got the PCB design all done. I still need to think it trough to make sure i didn’t miss anything important.

There aren’t many changes from the schematic before. Here the pins are swapped so that they are the easiest to route on the PCB and the big pile of SPI memory ICs. There are 5 together on the SPI bus for general purpose storage and 1 to serve as a buffer for playback. I don’t plan to actually put all 5. Its so if i run out of memory i can simply solder another memory IC in there. The memory chips are FRAM so i can use this memory for eater temporary working memory or long term memory since FRAM has the speed and durability of RAM while beig nonvolatile.

xmos board drw

xmos board2 3d

xmos schem2 tunimb

Schematics and 3D

Posted September 23, 2009 by Bernard Klinc
Categories: General

Okey so i have did some real design work and drawn up  a schematic for that shield and actually even decided to try out the 3D feature of my PCB design software.

The schematic is far from final yet tho, this is just the beta of it. I will check a few things with it to make sure it works like it supposed to as fixing it later can be very difficult

xmos schem tunimb

xmos 3d board

Information gathering

Posted September 18, 2009 by Bernard Klinc
Categories: General

So the beginning of designing anything is gathering some technical information on what you need to make it work. The main thing is to figure out what ICs to get for the job.Here a lot of things need to be considered from voltages they work on to communication protocols they use to make sure everything can talk to each other.

Luckily the ethernet is already taken care of on the board, so we dont have to worry about that.Next big thing is the IDE hard drive. As you know the IDE interface has a whole pile of pins, but luckily a lot are unused (gnd,obsolete,safety…). The most important group of pins are the 16 data lines that form the 16bit parallel bus along those are the flow control lines for it (read,write and such) and also a few address lines.Then there are a few extra pins like a reset,busy,interrupt etc. All this together gets to about 24 I/O pins and the board happens to have 24 I/O per core on the headers so its exactly enough pins to interface it. Okey so we have enough I/O but also the levels must work. Our I/O is 3.3V and 5V tolerant, but the IDE bus happens to use the 5V levels. Okey that sounds like a gazillion level shifters but the IDE bus works by the TTL standard so it should see a 1 when the voltage is above 2V so that means our 3.3V can generate a high level on the bus.I will still look in to that but from what i seen now there should be no problem just sticking the IDE bus directly on the I/O pins. Also the IDE Hdd needs a 12V supply along its 5V supply so a 12V power source will be used that will regulate down to 5V

While we are at mass storage lets look at the SD card now then.The card is much friendlyer to interface as it first of all only needs a low power 3.3V supply to work. Then the next beauty of the SD card is that its interfaced over the good’ol simple SPI bus on 3.3V levels, also by the SD spec it works up to 25Mhz so thats quite a impressive data rate.

Also on the topic of memory is the FRAM chip.It is a new memory technology called magnetic RAM that is quite revolutionary. It is the speed of RAM but it keeps its memory like flash, also there is unlimited write cycles.I happen to have one of these 1Mbit chips so im going to use it as memory to store various big stuff. Also one nice bonus is that the SPI bus on it works at up to 40Mhz and its a 3.3V chip so it will work with my I/O.

Moving on there is the matter of getting analog audio in and out.For that i plan to use audio DACs and ADCs that work with the standard I2S bus.That means the communication cosists of 3 clocks (master,bit,L/R) and 1 data line.The I/O should be esaly capable of making this interface run.Also a nice thing is that the digital I/O on these is usually 3.3V.

One interesting thing is the bluetooth module. Its a very cool chip from National Semi that contains a 8051 MCU (bluetooth stack) along with a 2,4Ghz radio and a antenna all inside the chip! By default the module is a virtual com port on bluetooth and the standard USART signals on the pins. It can also be told over the USART interface to do other stuff like connect to others or act as a bluetooth headset and such. Really cool chip that only needs a RX and TX line to work. Also confidentiality its all 3.3V too.

Only thing left is the LCD that I’m not sure if to really put in to it yet.However this is where the 3.3V ends as the display needs 5V to work however on the displays i have the I/O dose take 3.3V as a logical high so it is possible to interface without level shifters.

So thats about it in the end there are no 5V level shifters needed (I was scared i will need a truck load) and the IC count is pretty low in the end(around 4)  Only thing is that i don’t know if i will be able to fit it all on to a credit card sized PCB as i make my PCBs at home but i will see that when i get to PCB design.Main worry are the connectors as there is little room for them (especially the huge IDE connector)

Got a block diagram

Posted September 16, 2009 by Bernard Klinc
Categories: General

So i have put down some design ideas what to put in to the design and what core to assign it to. As you can see there are quite a few components here.

Block diagramNow the only thing that is already on the XC-2 board is the ethernet part (luckily), but all the other stuff will have to be added to make the thing work like its supposed to. The next key component is the mass storage that is going to be a IDE harddrive or/and a SD memory card. The SD card should actually be on core 3 as it handles the file system but i ran out of pins since the IDE drive needs a whoping 24 pins to interface, but since the SD card uses standard SPI i figured i would connect it then to the same SPI bus that goes to the external memory.This memory will be the new FRAM type (nonvolatile magnetic RAM) because it is very fast and will be used to store various stuff like the website it is going to host and things like that. The next thing is the audio that i will use standard audio DACs and ADCs on a I2S bus and will be connected to its own core that will hopeful decode a few audio formats. Moving on we get to a bluetooth module, that is a simple BT module from National Semi with a USART interface and is intended for a interface to mobile phones directly. The last is a simple character LCD to display some info on its current state. The LCD is not very crucial and may be scraped later as the device was not ment to be interfaced directly but rather trough ethernet/bluetooth. Another thing is that the change in supply voltage is needed because IDE drives need along the 5V also a 12V supply with some current on it too as it runs the mechanics.

For now I’m still only waiting for the development board.