It the same problem with reading the bulk input (for reading button, status, accelerometer, gyro etc.) - it can not read all the bytes - it should be possible to read 64 (again see this picture: [url]https://picasaweb.google.com/lh/photo/CxYsmjAPvYhpSE942JsEJQ?feat=directlink[/url]), but it can not. It can only read 31 bytes???
I haven’t got it working with the USB host shield yet, but I will write as soon as I got it working, and tell if it can read all the bytes sent from the PS3 Controller via the Bulk Input pibe.
What happens when you read more? It seems that you set the transfer timeout to 0. Over 16 bytes will definitely take more than 1 ms because the endpoint size is 16. Increase the timeout and see if it works.
Increasing “IntInPipe.TransferTimeout” and “BulkInPipe.TransferTimeout” did not help - it tried anything from 1 to 100
After I had a deeper look in the Arduino USB host shield code, I found out it that the library automatically detects if the length is longer than the endpoint max packet size of the interrupt input (16 byte), and just keeps reading it until the packet has been read. Take a look at this link: [url]https://github.com/felis/USB_Host_Shield_2.0/blob/master/Usb.cpp[/url] at “USB::inTransfer”
My problem is that I still can not read all 64 bytes from the bulk input. By setting the buffer array to below 31 for example:
private byte[] BulkInBuffer = new byte[30];
The following exception occurs:
#### Exception System.Exception - 0xffffffff (7) ####
#### Message:
#### GHIElectronics.NETMF.USBHost.USBH_RawDevice+Pipe::TransferPipe_Helper [IP: 0000] ####
#### GHIElectronics.NETMF.USBHost.USBH_RawDevice+Pipe::TransferData [IP: 001c] ####
#### PS3ControllerBluetooth.Bluetooth::BulkReadingThread [IP: 0027] ####
Number Of Completed Packets: 0
A first chance exception of type 'System.Exception' occurred in GHIElectronics.NETMF.USBHost.dll
By looking at the output byte number 3 and 4, it can see that my length only is 0x11 (17), this is not the same as my mac: [url]https://picasaweb.google.com/lh/photo/d1W9rcqunQHi0YOTERPtbg?feat=directlink[/url], as it should be 0x36 (54), it’s the same with byte 5 and 6 which is 0x0D (13) and the right value should be 0x32 (50).
It just seems like it it cut off anything from above the last joystick axis (right y-axis) - which is byte 19, as I can not read the analog readings starting at byte 24 (see this link: http://wiki.ps2dev.org/ps3:hardware:sixaxis - only as reference, as it is for when you are using USB). But it still throws an exception when reading less than 31 bytes???
Do you think it is a problem with the USB reference/library, the bluetooth dongle or the code itself? I do not think it is the code, as I did exactly the same as my mac…
I got it working. It was actually a stupid mistake. The reason why it did not sent out the accelerometer, gyro values etc. Was because the bluetooth dongle was only version 2.0, and you needed 2.1 for it to work So now everything is working. I will update the wiki straight away!