NB: The newest source code can now be found at github.
As you might have seen, I finally got the PS3 Controller working via Bluetooth. Before you read any further, you should read my previous post first and also see the wiki for more information. Read more…
Evaluation Type: Development Board Application you used the part in: Development/evaluation of the LPC1768 part Was everything in the box required?: Yes What were the biggest problems encountered?: Examples only provided for the Keil uVision compiler
In the previous month we have been working on our 3D display prototype board for microprocessors, so you will be able to generate and show real glasses free 3D images with your microprocessor. Read more…
NB: The newest source code can now be found at github.
As Thomas origanally posted, the FEZ Panda can actually be used as a USB-Host: Fez Panda And USB Host. I have for long time wanted to use my PS3 DualShock 3 controllers for something useful (besides playing Playstation of course), therefore I thought it would be interesting to connect it to the FEZ Panda.
As I promised in my previous post, I would show you how to get USB Host working on the FEZ Panda.
FEZ Panda - USB Host Cable
When I first glanced at the LPC2387 datasheet (the ARM on the Panda), I notice that it actually supported USB Host. Then I thought why it wasn’t possible to use USB Host on the Panda, and I quickly found out that it was because it required some hardware modifications.
USB Cable Wiring
The difference in the hardware between USB Client and USB Host is that the Host is powering the Client, and the Panda had a protection diode so no power would go “out” the USB port. Another thing to notice is that USB Host requires two 15K resistors to pull D+ and D- to ground.
FEZ Panda - USB Host cable wiring
SMD solution
So how did I do it? I didn’t want to modify the FEZ Panda board, as the USB port would then be a permanent USB Host port. Instead I thought it would be nice just to have a cable for the USB Host thing, which should include the two resistors, and a power wire for the +5V power supply.
The first image in this post is my cable, and the second image shows the connections, where there is soldered two 15K SMD 0805 resistors inside. This took a long time to make because it was so small, and SMD resistors can’t handle much force. On a longer term basis it would be better to make an adapter PCB instead.
USB Host cable Schematic
Above you can see the simple schematic of the changes that has to be made to the cable, including where to solder/connect the two 15K resistors.
Thru Hole solution
Instead of using SMD resistors I recommend you to use Thru Hole resistors, and they can handle a lot more force, and the joint will also be more reliable.
FEZ Panda - USB Host Cable
The assembly method is the same as with the SMD resistors. If you don’t have any 15K resistors in hand, we have also tested it with a 12K instead, and everything seems to be running fine with that too.
After I made the cable the last thing I had to do was to update the firmware on the FEZ Panda, as the firmware (USBizi) for the FEZ Panda, didn’t support USB Host until V4.1.5.0, though the processor did. After I uninstalled the old firmware/SDK, downloaded the new one, and installed it, I was ready to update the firmware. I just followed this simple Youtube guide:
After the firmware was updated, I connected a cable from the MODE pin to GND to enable Serial Port (COM1) debugging, as the USB port will now be used for USB Host functions.
Then I just followed the “USB Host – Mass Storage” chapter in the Beginners Guide to .NETMF.
To help you guys getting started, I used this code to test the USB Host function. The applications outputs which device is connected, and if a Mass Storage device is detected, the files- and folder tree is shown too.
// Hold a static reference in case the GC kicks in and disposes it // automatically, note that we only support one in this example! static PersistentStorage ps;
publicstaticvoid Main() {
UART.Open();
WriteSerial("Starting...");
// Subscribe to RemovableMedia events
RemovableMedia.Insert+= RemovableMedia_Insert;
RemovableMedia.Eject+= RemovableMedia_Eject;
// Subscribe to USB events
USBHostController.DeviceConnectedEvent+= DeviceConnectedEvent;
USBHostController.DeviceDisconnectedEvent+= DeviceDisconnectedEvent; // Sleep forever //Thread.Sleep(Timeout.Infinite);
switch(device.TYPE) { case USBH_DeviceType.HID:
USBDeviceType ="HID"; break; case USBH_DeviceType.Hub:
USBDeviceType ="Hub"; break; case USBH_DeviceType.Joystick:
USBDeviceType ="Joystick"; break; case USBH_DeviceType.Keyboard:
USBDeviceType ="Keyboard"; break; case USBH_DeviceType.MassStorage:
USBDeviceType ="Mass Storage"; break; case USBH_DeviceType.Mouse:
USBDeviceType ="Mouse"; break; case USBH_DeviceType.Printer:
USBDeviceType ="Printer"; break; case USBH_DeviceType.Serial_CDC: case USBH_DeviceType.Serial_FTDI: case USBH_DeviceType.Serial_Prolific: case USBH_DeviceType.Serial_Sierra_C885: case USBH_DeviceType.Serial_SiLabs:
USBDeviceType ="USB to Serial converter"; break; case USBH_DeviceType.Sierra_Installer:
USBDeviceType ="Sierra Installer"; break; case USBH_DeviceType.Unknown:
USBDeviceType ="Unknown"; break; default:
USBDeviceType ="Unknown"; break; }
staticvoid RemovableMedia_Insert(object sender, MediaEventArgs e) {
WriteSerial("Storage "" + e.Volume.RootDirectory + "" is inserted.");
WriteSerial("Getting files and folders:");
WriteSerial(""); if(e.Volume.IsFormatted) {
WriteFilesAndFolders(e.Volume.RootDirectory, e); } else {
WriteSerial("Storage is not formatted. Format on PC with FAT32/FAT16 first."); }
WriteSerial(""); }
staticstring[] files, filesSub; staticstring[] folders, foldersSub; staticvoid WriteFilesAndFolders(string path, MediaEventArgs e) {
files = Directory.GetFiles(path);
folders = Directory.GetDirectories(path);
WriteSerial("Files available on "+ path +":"); for(int i =0; i < files.Length; i++)
WriteSerial(" "+ files[i]);
WriteSerial("Folders available on "+ path +":"); for(int i =0; i < folders.Length; i++) {
WriteSerial(" "+ folders[i]);
WriteSerial("");
WriteSubFilesAndFolders(folders[i], e); } }
staticvoid WriteSubFilesAndFolders(string path, MediaEventArgs e) {
filesSub = Directory.GetFiles(path);
foldersSub = Directory.GetDirectories(path);
WriteSerial("Files available on "+ path +":"); for(int i =0; i < filesSub.Length; i++)
WriteSerial(" "+ filesSub[i]);
WriteSerial("Folders available on "+ path +":"); for(int i =0; i < foldersSub.Length; i++) {
WriteSerial(" "+ foldersSub[i]);
WriteSerial("");
WriteSubFilesAndFolders(foldersSub[i], e); } }
staticvoid WriteTestFile(string dataToWrite) { if(VolumeInfo.GetVolumes().Length<1)return; // Assume one storage device is available, // access it through NETMF string rootDirectory = VolumeInfo.GetVolumes()[0].RootDirectory;
FileStream FileHandle =new FileStream(rootDirectory +@"\hello.txt", FileMode.Create); byte[] data = Encoding.UTF8.GetBytes(dataToWrite); // write the data and close the file
FileHandle.Write(data, 0, data.Length);
FileHandle.Close(); }
staticstring ReadTestFile() { if(VolumeInfo.GetVolumes().Length<1)return"No Mass Storage found!"; // Assume one storage device is available, // access it through NETMF string rootDirectory = VolumeInfo.GetVolumes()[0].RootDirectory; if(!new FileInfo(rootDirectory +@"\hello.txt").Exists)return"File not found!";
FileStream FileHandle =new FileStream(rootDirectory +@"\hello.txt", FileMode.Open, FileAccess.Read); byte[] data =newbyte[100]; // write the data and close the file int read_count = FileHandle.Read(data, 0, data.Length);
FileHandle.Close(); //Debug.Print("The size of data we read is: " + read_count.ToString()); //Debug.Print("Data from file:"); //Debug.Print(new string(Encoding.UTF8.GetChars(data), 0, read_count)); returnnewstring(Encoding.UTF8.GetChars(data), 0, read_count); } staticvoid WriteSerial(string StringToWrite) { // convert the string to bytes byte[] buffer = Encoding.UTF8.GetBytes(StringToWrite +"\r\n"); // send the bytes on the serial port
UART.Write(buffer, 0, buffer.Length); } } }
This video is just an example of what you can use the USB-host functionality for:
Update
Kristian has succesfully connected the PS3 Controller to the FEZ Panda, for more information, take a look at his post.
The FEZ Panda is an ARM7 board, in an Arduino-form-factor, running the .NET Micro Framework. This makes it possible to develop the applications inside Visual Studio using C#. Debugging is also done thru Visual Studio and in my opinion it is very easy to get started.
The great thing about the FEZ Panda, compared to a normal Arduino is the features and the speed.
FEZ Panda features
Instead of a simple 8-bit processor, this is a 32-bit ARM processor clocked at 72MHz. This makes it a monster compared to the Arduino series! The board contains 4 COM ports, 2 SPI ports, real SD interface, a lot of PWMs, Analog inputs (ADC), Analog outputs (DAC), I2C, CAN, USB Client, USB Host – you name it.
Inside the ARM processor, the .NET Micro Framework is running, which includes a FAT filesystem stack. This makes it possible to connect FAT formatted SD card or USB memory sticks to the board.
With this board you get a lot of power and a growing community. There is a lot of examples included, and many more can be downloaded from the .NET Micro Framework projects page. GHI Electronics, who is the manufactor of this board, has other boards running .NETMF too. They have a bigger version of this FEZ Panda, but still in the Arduino-form-factor, called FEZ Domino
This board is almost twice as expensive, but in my opinion you don’t get twice as much – only a USB Host connecter and an SD card slot. You actually have far less IO’s on the FEZ Domino than on the FEZ Panda, which I think is bad. So I recommend you to try the FEZ Panda!
In my next post I will show how to use the “hidden” USB Host function on the FEZ Panda – as it isn’t stated as supported on the product page, the ARM processor support both USB Host and Client. The only thing it requires, is a little USB Cable tweaking and a firmware update of the ARM to the latest firmware from GHI Electronics.
For a couple of weeks ago some of you might have noticed that I had published a video about me destroying an electronics board.
This was done as a part of an NXP contest, where you could get a free LPCXpresso board, by showing them how you would break your 8-/16-bit habbit!
LPCXpresso Board
Today I then recieved the board and it looks pretty promising. Can’t wait to get started testing it! If you haven’t seen the video, you can watch it here:
This friday I recieved two STAMP boards as a donation from MCUZone.
LPC STAMP Board
They are both STAMP boards, which means almost every pin is spread out for easy interfacing, but there is also a JTAG port and a USB port on the board.
The first one contains NXP’s LPC1766, which is a Cortex-M3 ARM processor with 256kB FLASH, USB Device/Host/OTG, Ethernet and more.
The other one contains NXP’s LPC2368, which is an ARM7 with 512kB FLASH and almost the same periphirals as the LPC1766, except the USB Host and OTG function.
In the video below you can see the two boards, and the LPC1766 in action, blinking an LED
Many has sent me mails or PM’s about the STM32 library for Eagle, so now I’ve uploaded it here.
stm32.lbr – ST Cortex-M3 STM32F101/103 processor family in LQFP100, 64, 48 and VFQPFN36 stm32_lqfp144.lbr – STM32F101Zx and STM32F103Zx. LQFP 144 package.
I hope you guys can use them… Please keep me updated with your projects 🙂
A couple of weeks ago I recieved an SSD1963 evaluation board and a 7″ display.
The SSD1963 chip makes it possible to control a 7″ display with a regular microcontroller or microprocessor, which haven’t got enough memory and power to control it itself, as it’s a normal display with vSync and hSync and so on.
So after a couple of hours I got it running with my STM32 board and a touch screen controller.
Please take a look at the video below to see some of the things I can show/do.
Edit, 21. February 2011:
I’ve now uploaded the source code for the driver of SSD1963, using the STM32.
You can download the “library” here: SSD1963_STM32_Driver.zip
Recent Comments