HDRI Community
http://www.hdrlabs.com/cgi-bin/forum/YaBB.pl
Open Camera Controller >> OCC Developer Zone >> Nintendo DS USB Host Controller; Working Prototype
http://www.hdrlabs.com/cgi-bin/forum/YaBB.pl?num=1277771284

Message started by Luke Skaff on 06/29/10 at 01:28:04

Title: Nintendo DS USB Host Controller; Working Prototype
Post by Luke Skaff on 06/29/10 at 01:28:04
I figured it would be best to start a new thread for this then posting it in the USB thread.

This is my first rough prototype of a USB host controller for the GBA (slot-2) of a nintendo DS & DS lite.  You may have seen the GBA DMA interface in the USB thread.  The code was written and developed on an Atmel AVR (non-Arduino) and ported over to the DS.  It is much easier to develop code on an AVR then on the DS which you have to constantly swap SD cards on every recompile. I wrote the code to be as platform independent as possible so it can be moved to whichever device needed.  I do not think it would be too hard to add to the OCC code once done, you will just need to call a few functions to init the vinculum and to take picture, change exposure time, etc. It is still very rough and once I clean it up and get some more kinks worked out I will post it (that could take some time). I am only using a very, very small subset of commands from the PTP & MTP specification.

I am using a FTDI Vinculum USB host controller for the USB interface. A xilinx CoolRunner-II CPLD is used to convert the GBA (slot-2) DMA interface to the FTDI PFIFO.  There are only two main components uses the Xilinx CPLD and the Vinculum USB host controller, everything else is for development and debugging.

USB power is left disconnected from the USB port as it is not needed.  A connector for external power and simple linear LDO regulator can be used for the rare cases where USB power is needed, for instant a firmware update from a flash drive.

This design can also trigger a camera from a standard shutter release cable for cameras not supported by USB commands.  It is also slightly faster to command an exposure setting via USB and fire the shutter release cable then to send a command over USB to fire a shot.  This is also how the promote controller does it.

http://www.youtube.com/watch?v=N9Nz87gh2-Y
(Watch on You0Tube for HD and video annotations)
http://www.youtube.com/watch?v=N9Nz87gh2-Y
DS_USB_Host_slot-2.JPG (Attachment deleted)

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Luke Skaff on 06/29/10 at 01:28:26
<Reserved to post about the AVR controller>

Here is the development platform I am using to write and test the code on.  The development board is an Atmel STK600, a STK500 can also be used.  I am running an ATmega 644 uC 44-TQFP @ 20 Mhz.  The 44 pin uC is used to have more IO pins for debugging but a smaller IC can be used.  I hope to upgrade to an xMEGA running at 32Mhz, it is much faster and lower cost uC.

Hardware:
- ATmega644 uC, on a Atmel STK600 dev board
- The USB controller is a FTDI Vinculum VNC1L, I am using the VDIP2 board for testing
- To the right is a FTDI FT232RL USB to UART for high speed terminal debugging, I was unable to get a clean serial signal from the STK600 at speeds over 57600 baud, I am running the UART at 250Kbaud

In the video you see an 8 second exposure to show how the code keeps checking the camera events info until it sees the shot has finished.  The second part is a 7 shot HDR bracket, the code commands an exposure time, fires a shot, waits for the shot to finish and then repeats for each shot in the bracket.


Open in YouTube to see on screen annotations with short descriptions of each part
http://www.youtube.com/watch?v=aGAHeJVDePk
http://www.youtube.com/watch?v=aGAHeJVDePk
STK600_DEV_W_VDIP2.JPG (Attachment deleted)

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Blochi on 06/29/10 at 02:18:53
That's really awesome, thanks for sharing.
I'm completely impressed by how far you got.

By the way, I sent an invitation email to Martin (maker of the Arduino PTP hardware sketch), but no response yet. We'll see...

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Martin Clark on 06/29/10 at 18:59:49
saweeeht. this makes me very happy

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Achim Berg on 06/30/10 at 09:08:41
@Luke,

Great, well done, wicked awesome !!!! ;)

By the way, have you allready a connection diagram of the working prototype?

The coolrunner II has a XC2C256-7TQG144 installed. That MC ist really big for implementation on the occ. I think a little bit oversized :).
Do you think it is possible to use the XC2C32A-6VQG44 in combination with the Vinculum chip instead?

Yours Achim

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Ichabod on 06/30/10 at 14:47:41
I'm really interested in OCC, but have been intimidated by the technical challenge of building it (and the pace of development I've observed here!), and concerned about the shutter speed limitation.

Am I right in guessing that this USB interface could remove the shutter speed limitation? That might help me overcome my fear and try building it if this gets worked out.

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Luke Skaff on 06/30/10 at 15:21:21
Thanks for the comments guys!

@Achim,
Most development boards come with larger parts than needed and as you said the XC2C256 is definitely overkill for this project.  The current logic consumes 45 macrocells so the XC2C32A part unfortunately cannot be used.  I plan to use a VQFP-44 Pin XC9572XL ($2-$3 75 macrocell part) or a VGFP-44 Pin XC2C64A ($2-$3 64 macrocell part) on the final design.

I will be out of town for a week starting this weekend but after that I will do schematic capture and layout.

@Ichabod,
That is correct, with USB control you can command shots down to your camera's shutters limit. That was my main driver for doing this project; I wanted to be able to do 5+ shot brackets at faster then 1/20.

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Martin Clark on 06/30/10 at 15:34:59
it will enable the shutter speed to be used at your fastest shutter speed - technically (easier said then done - and im not saying 4-8 thousandth of a second is a good thing), but there is no reason why it cant.

i think the hard part is changing the shutter speed for the next exposure of the sequence and getting this to tie in with the camera(s) because all cameras have different FPS e.g.

i think the 1ds mk3? (or is it the 1d mk3? yes the APS-C size sensor not 35mm) does 10 per second and mine (500D) can squeeze 3.5

im thinking that the ui might have to be changed to accommodate this new factor for the speed that the shutter is going to be popping out at

all i was thinking is, a on a screen before you see bracketing ui on the occ bracketer. there could be a "what camera are you using" dialogue box

witch will utilize a Vlookup (Excell) sort of command where it will dig out the fps of the camera, and how many frames the camera can continually shoot. till it has to release its buff. so the usb wont swamp certian cameras or be too slow for others.

on this page you could also integrate the save speed of the camera.

like what CF or SD card speed you have and change the save speed times accordingly. 

i will grab the data for all the CF cards you guys have(and cameras) and collate it into a table of FPS and savespeed times.

(I will dig the data if you want)

for instance it could look like this?

       Select Camera
|----------------------| /\
|          7D            |                      
|----------------------| \/

   Select Data Storage

|----------------------------| /\
| CF- Sandisk Ex60 mbs| 
|----------------------------| \/   

so its just select camera, chance save speed (write speed because it sometimes causes issues with slower rated CF and SD cards)

it will still need to utilize the shutter cable release that the system has now for longer than 30s exposures but this means the camera will be far more EFFICIENT. and faster at shooting off your bracketing sequence

so there would be 2 cables comming out of the one OCC


rant over... was that a rant or a continuous prose...? anyway i thaught i would feed that to you guys

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Luke Skaff on 06/30/10 at 16:10:38

wrote on 06/30/10 at 15:34:59:
...
i think the hard part is changing the shutter speed for the next exposure of the sequence and getting this to tie in with the camera(s) because all cameras have different FPS e.g.
...


Martin,
This is the easy part ;) and not a problem with USB as with the shutter release cable.  This is another benefit of using USB control.

Here is how it works:
1) Command the exposure you want to the camera
2) Check the cameras response to confirm command, if no response or responded with a wait state then keep checking until confirms change or timeout.
3) Command a shutter fire
4) Keep pinging the camera until it confirms the shot is finished then repeat for the total number of shots you want in the bracket.

This is all done in code with no user specification or look up table of the camera FPS, etc.  It will fire off as fast as the camera lets it.

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Martin Clark on 06/30/10 at 17:32:55
15 minutes of writing for nothing. phhft.

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Steve Chapman on 07/06/10 at 06:32:30
But Martin, it's DIY!

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Martin Clark on 07/17/10 at 11:34:31
how are you comming along? have you encountered any problems Luke? anything you are stuck with now?

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Luke Skaff on 07/18/10 at 13:15:55
Martin,
I was out of town for over a week, this weekend I had some time to work on this some more.  I ran into a few issues working out the quirks of the canon MTP implementation.  I have a lot more things working such as 5+ shot bracketing.  I will post a video and info on the AVR development platform sometime this week.

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Martin Clark on 07/18/10 at 18:31:37
yessss, i thaught you said weekend. my mistake.

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Steve Chapman on 07/19/10 at 22:11:32
Hafta sticky this.

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Luke Skaff on 07/20/10 at 01:19:57
Updated: I added information about the AVR dev platform in the second post.

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Achim Berg on 10/12/10 at 14:07:24
Hey Luke,

do you think a combination of the VNC2-32L1B and the Atmega 328 would solve the problem getting USB on that "baby" The VNC2-32L1B is otg compatibel an would be the right choice. Is the Atmega328 strong enough to handle that? What do you think?


Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Luke Skaff on 10/14/10 at 20:35:56

Achim Berg wrote on 10/12/10 at 14:07:24:
Hey Luke,

do you think a combination of the VNC2-32L1B and the Atmega 328 would solve the problem getting USB on that "baby" The VNC2-32L1B is otg compatibel an would be the right choice. Is the Atmega328 strong enough to handle that? What do you think?

Hi Achim,
I am not sure what you mean, can you explain it in more detail?  The VNC2 does not need a microcontroller because it has a built in programmable 16-bit uC with free IDE.  So it is the best of both, it combines the features of a AVR and the features of the Vinculum I into a single chip.  A interface is still needed to convert the NDS GBA DMA interface into something that can talk with a uC like the Vinculum I, Vinculum II, AVR, etc.  I handled this with a CPLD but there is probably other ways of doing it too.

I will be posting a blog post today with the logic files and an explanation of how it works.

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Luke Skaff on 10/15/10 at 00:30:31
I spent a few minutes every day for the past two weeks writing up this blog post
http://blog.lukeskaff.com/?p=121

It covers the DMA interface between the DS and the FTDI vinculum.  Next blog post will cover the code for the PTP/MTP controller and schematic.

Cheers

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Steve Chapman on 10/16/10 at 20:14:33
Amazing work, Luke.

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Luke Skaff on 12/12/10 at 19:57:58

wrote on 10/16/10 at 20:14:33:
Amazing work, Luke.

Thanks Steve!

It is long overdue for me to post this information so I have been working on a new blog post this weekend and the schematic.  Attached is the schematic, I will post the code and schematic in a new blog post in a day or two.


GBA_USB.pdf (Attachment deleted)

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Luke Skaff on 12/13/10 at 01:16:58
Just finished new blog post, code and schematic posted.

http://blog.lukeskaff.com/?p=199

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by royd on 02/20/12 at 19:59:03
More than year have passed. Any news on further development? I mean, is there a possibility others can build a compact/portable device practical for location use?  [smiley=2vrolijk_08.gif]

Thanks

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Steve Chapman on 02/20/12 at 23:12:10
It's sorta been mooted. There are android-based hdr controllers, etc. If anything, the fact that OCC is not USB-based is it's remaining strength, it works with almost anything. I'm currently hooking up two medium format Pentax's with a modified OCC design for FX work, and have recently used it to bracket with a Leica M8 and a Leica R4 (film!) camera.

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by royd on 02/23/12 at 23:22:48
Wishful thinking on my part, to avoid using ND filter to cope with daylight situations. Not an Android user  :(

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Achim Berg on 03/09/12 at 13:09:25
some  time has passed til luke posted a usb version.

Based on a found blog ( http://www.circuitsathome.com/camera-control/arduino-based-controller-for-canon-eos-cameras) i spend some time setting up these version to the DS. Here allready the circuit plan. Maybe someone is able to reprogram the "bracket" getting that version supported by the DS.

The process developping the board is stil on going.
For testing the usb i use this board attached to th occ rev 3.3

http://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-for-arduino-pro-mini/

edit at: 03:15:2012
-> new circuit plan attached. old one had a failure. The four data lines have to be attached to the maxim chip, not the atmega.

occ_circuit_rev_4_0_001.jpg (Attachment deleted)
occ_rev_4_0_prot.jpg (Attachment deleted)

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Steve Chapman on 03/14/12 at 06:54:01
I know someone who can program the PTP code. If only he had one of your boards. :D

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Achim Berg on 03/14/12 at 10:46:02

wrote on 03/14/12 at 06:54:01:
I know someone who can program the PTP code. If only he had one of your boards. :D


Hello Steve,

that sounds good. Send me a pm with your address and i´ll send you the unit when i got them from my vendor :) and the final test has been done.

Achim

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Yogie on 03/14/12 at 11:51:30
Hey what about me?  [smiley=smiley.gif]

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Achim Berg on 03/14/12 at 12:27:55

wrote on 03/14/12 at 11:51:30:
Hey what about me?  Smiley


see you on sunday, then we talk about it :)

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Steve Chapman on 03/14/12 at 16:10:45
Awesome. Did you put the Guitar Hero lines in? I think we'll need to finally add the bidirectional comms to make full use of this (like communicating Av values, etc.) It'd be nice to use something like Luke's latching full-bus but he has a huge fpga board to do it.

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Achim Berg on 03/15/12 at 13:47:44

wrote on 03/14/12 at 16:10:45:
Did you put the Guitar Hero lines in?


yes, they were included in the circuit because the unit is based on the Rev 3.3 board.

The atmega chip only got a connection to the maxim controller and some signal lines of the atmega have been switched. The maxim itself has a firmware too

->> https://github.com/felis/USB_Host_Shield

This is how the code works:
When connection is established, camera sends back an initial packet with all its current settings along with a list of all possible values for each setting. Possible values depend on a camera model as well as lens that are mounted. For example, some cameras may have exposure compensation range from -2 to +2, others from -5 to +5; some lens have max.aperture 1.4, others – 3.5, an so on. The list of values received from the camera is placed in built-in EEPROM of Arduino microcontroller. After that, values are used in setting (called “property” in PTP lingo) change commands sent to the camera. When camera mode, such as Av, Tv, or lens is changed, camera sends initial packet again. The Arduino code tracks changes and updates the list stored in EEPROM.

Info from ->http://www.circuitsathome.com/camera-control/arduino-based-controller-for-canon-eos-cameras

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Steve Chapman on 03/15/12 at 23:11:01
I'll study the docs. I need to buy the USB host shield to follow along Oleg's (Circuitathome) path.

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Achim Berg on 03/16/12 at 09:56:38
... it took some time to understand the way the unit works. I removed from Olegs solution the input switches and the display. It could be possible to use the DS instead of them. If the DS acts as the input/output device it would be possible transferring the data very comfortable, using the occ interface, to the camera. Using the data lines of the max3421 it would be possible to read the data from the camera handed over to the occ.  It also would be possible, driven by the software (bracket new version) of the DS, getting further functions too, those Olegs solution does not support yet. I think that is the right way getting more comfort and a wide range of functions. Perhaps we get the wanted “all function super interface :)”

Title: Re: Nintendo DS USB Host Controller; Working Prototype
Post by Yogie on 05/10/12 at 12:10:41

Luke Skaff wrote on 12/13/10 at 01:16:58:
Just finished new blog post, code and schematic posted.

http://blog.lukeskaff.com/?p=199



Luke,

I read your post and downloaded the USBCameraControl_v0.01.zip and tried to bring it to get compiled at my environment. Therefore I stripped out all the AVR code as I only need the NDS part but unfortunately without success.

Achim asked me if I would be able to write an NDS interface to have a pretty GUI to control the USB host controller. I would love to do it, but I'm not a technical guy nor am I a real programmer so I would appreciate if you would have the time to help out?

Many thanks in advance!

HDRI Community » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2018. All Rights Reserved.