bhunt2 / QC1.0

Design, documentation, and code for our first quadcopter
1 stars 0 forks source link

Edison not detecting USB Camera #25

Closed Kekahuna closed 8 years ago

Kekahuna commented 8 years ago

@bhunt2 @spesialstyrker @sabmah @hautruong36

Upon disconnecting and reconnecting the USB camera to the Edison and running the command,dmesg | tail the following appears:

dmesg

I then ran the command lsusb which returned:

lsusb

Ideally, dmesg should also output information about the device that is being detected and lsusb should return information about the Edison's serial buses and the devices connected to them.

To test whether or not this issue is related to the UVC camera drivers that need to be installed on the Edison, I instead swapped the USB Camera with a USB flash drive and ran the same two commands. I received the same two outputs. I did quite a bit of research to see if anyone else was having this issue and the solution seems to be that the mini breakout for the Edison must be powered via an external 12V power supply (such as a wall wart) in order for the Edison to work as the USB Host. On the Arduino expansion board (not the same arduino block that we have) this issue apparently is rectified with flipping SW1 towards the type A USB port instead of the switch being thrown towards the micro USB port.

In our case, the Edison needs at least 5V to run as USB Host. There is no barrel jack to supply 12V of power. What others have done is they connected a 12V power supply to the J21 pin on the mini breakout.

Another potential issue is that our cable may just be a standard female A to micro A usb cable and not a USB-OTG cable. The difference is, the OTG cable shorts pins 1 and 2. This grounds the ID pin on the Edison and allows the Edison to run as a USB Host.

Here's a forum post of someone else having a similar issue and some of the conclusions and details that others brought up:

https://communities.intel.com/thread/57209?tstart=0

Let me know if any of you needs any further clarification or if any of you have some kind of a solution to this issue.

bhunt2 commented 8 years ago

This is a just a review of my comments during the meeting.

You can get the appropriate power for USB hosting when you connect the Edison to the drone battery. In order to better power multiple boards (edison, flip 1.5, etc) you may need to build/buy a power distribution hub to make it easier to work with. They can be easily made in the LID and there are many open source designs out there for them.

The USB cable that you purchased can just be converted to an OTG cable if it is not one, which it probably isn't.

One more option is to use the other camera that doesn't require USB.

Kekahuna commented 8 years ago

I spoke to someone from Sparkfun who swore that the Edison can run as a host using the USB power connected to the console. I also saw a post by someone who had success running the Edison as a host while powering via the console. He was careful to point out that the cable must be OTG. I looked at the cable that we ordered and while it was advertised as OTG, the fine print states that it is simple Female A-Micro A. We decided on modifying our current cable to short pins 1 and 2. If that doesn't work, then we'll look into adding a power distribution hub.

bhunt2 commented 8 years ago

@hautruong36 @Kekahuna

Please update when you have tried out the modified cable as this will be our first choice. Then we can discuss what other options we have if this doesn't work. Cross your fingers that it does though.

Kekahuna commented 8 years ago

We've tried out the modified cable, in addition to another OTG cable, and the issue still persists. I've continued researching solutions online and unfortunately, there seems to be quite a few causes for this error. I've seen a few configurations using the base block and 5V from the console USB working so I wanted to continue investigating other solutions before building a power distribution block.

It's tough to pin down. Some people have reported needing to cold boot with no USB devices plugged in and then plugging them in afterwards to fix the issue (we've tried that and it didn't work). Others ran bash scripts to basically set several parameters related to USB programmatically and that fixed their issue. It seems like we'll have to keep trying things until we get it to work.

bhunt2 commented 8 years ago

I found this message on Edison forums: https://communities.intel.com/message/266256#266256

Take a look at it. You may have already seen this, but I haven't heard you guys discuss about powering the Edison externally for awhile. From this message it would seem like that is a good step and could easily be tested using a DC supply in the lab. Also, I am not sure how you made the OTG cable but here is an instructable for it http://www.instructables.com/id/Make-a-USB-OTG-host-cable-The-easy-way/?ALLSTEPS. I also found this project on the Edison forums that uses a USB camera with the Arduino expansion board. https://communities.intel.com/docs/DOC-23972. This is another project that makes me think that external power is needed. If need be we can get the Arduino expansion board, but I really don't think it should be necessary.

Another option is still to use the other camera. There is support for that camera in the Arduino community so I am sure you would be able port it to the Edison with minimal effort and there may already be someone who has done it. This is the forum for the camera, http://www.arducam.com/camera-modules/2mp-ov2640/.

Please let me know what you have done and your thoughts on these comments.

Kekahuna commented 8 years ago

When Hau made the OTG cable, he followed that instructables guide that you've posted. He confirmed Pins 4 and 5 are grounded and the Edison still will not run in host mode.

I've followed the first forum post that you've posted and I was initially using that as a basis for powering it with 12V but I was hopeful there was another solution since supplying 12V is not as trivial a task using the base block that we were supplied as it is using either the arduino board or the Intel mini-breakout. One of the other boards (can't remember which) has a barrel jack connection which makes a wallwart easy to hookup and the other has access to pin J21 that you can supply 12V to (not an option with our base block).

I also looked closely at this thread as he is having the same issue we're having and he's using the base block: https://communities.intel.com/thread/60134?tstart=0. Unfortunately, he never updated as to whether or not he was able to get his configuration to work. I was avoiding supplying 12V to our setup because it doesn't really make sense as the point of the base block is to power via the console port and run a USB device via the OTG port, but it seems that that may be our only option (aside from some of the boot changes that people have proposed).

Sparkfun's official block information page states, "The Base Block can power an Edison Stack through either micro USB connector. The preferred method is to power through the port labeled "Console". This leaves the OTG port available for USB devices such as web cameras, mass storage devices, or other USB-enabled devices. The power button is capable of putting the Edison in hibernation and powering off the module entirely.". Here's the link https://learn.sparkfun.com/tutorials/general-guide-to-sparkfun-blocks-for-intel-edison

If we need to supply 12V, we're lost on how to do it. Sparkfun states, "All power Blocks built by SparkFun are designed to provide 4.0-4.1V to the VSYS bus." and there isn't a way to access VSYS bus directly on the base block like there is on the other boards (if there is, we don't see it).

bhunt2 commented 8 years ago

@Kekahuna

Just to make sure, you do know that those boards are designed to be stacked. So you can use all the boards that I provided at the same time. This gives you a lot of options. Please look further into your options and give everyone a list of pros and cons and we can make the decision about how to move forward. I am positive you will see the way. Off to bed, have a great day.

bhunt2 commented 8 years ago

@sabmah @hautruong36 @Kekahuna @spesialstyrker

Everything you have posted in response to my comments should be in the documentation somewhere as I have stated before. Please put it in its appropriate place so that it isn't necessary to ask for that information here.

bhunt2 commented 8 years ago

@Kekahuna

Please let me know your thoughts about using the camera. All your code for calibration and image processing will work no matter the camera and that camera has better capabilities in my opinion. Please provide the pros and cons of all our options and then we can move forward. We should be able to make the decision about how to proceed at our meeting on Friday.

Thanks

Kekahuna commented 8 years ago

I do know that those boards are designed to be stacked one on top of the other. I do know that the GPIO block breaks out the VSYS pin and allows access to it and that would be the way that I would think to supply 12V to it but Sparkfun warns that, "The GPIO Block gives access to the VSYS and GND lines pins in an Edison Stack. While it is possible to power an Edison Stack through the GPIO Block, there are risks. You must pay careful attention to only supply 3.3-4.5V. Exceeding these ranges will damage the Stack and the Edison."

After doing some further research, I found on Intel's documentation on the Edison and the mini breakout that, "Power from the external power adapter goes to a DC-DC converter and down-converted to 5 V. The 5 V rail is diode ORed with the USB VBUS rail. This power goes to a battery recharger IC, which limits the output voltage to 4.4 V. This voltage is in the safe range for the Edison module VSYS. The VSYS power range is 3.15 to 4.5 V." Link: https://learn.sparkfun.com/tutorials/general-guide-to-sparkfun-blocks-for-intel-edison

As stated above, the only module that has access to the VSYS is the GPIO. We could supply external power directly to that, but it looks like that won't fix the issue as the VSYS voltage is the voltage after the external power is ORed.

I found another forum post by a user who was asking this question using the base block. He was able to get it working using 5V/1A from USB through the console. Link: https://communities.intel.com/thread/99328?start=0&tstart=0

I think that this forum post is most pertinent to our issue: https://communities.intel.com/message/266867#266867 Essentially, there's a "bug" where ID toggling and VBUS toggling does not work properly depending on whatever configuration you have upon booting the Edison. I'll try and mess around with various configurations (OTG plugged in on boot, not plugged in on boot, etc.) to see if that makes a difference. If not, we may have to go with buying either the intel mini-breakout or the arduino.

bhunt2 commented 8 years ago

@Kekahuna

Thanks this is great input. I can't wait to see everything you come up with. This is an interesting issue that maybe we will be able to help others figure out. As I haven't seen any comments about your thoughts on the other camera, I want to make sure you don't forget to include that in your list.

bhunt2 commented 8 years ago

@Kekahuna @hautruong36

I was looking around a bit for powering things and I found a blog that gave instructing for a variety of configurations for the Edison. One of which was using the Arduino or mini breakout for USB hosting. It states that if you power the Edison with less than 12V it will operate in device mode. Although documentation says that it is possible to use it otherwise, he says that is the way to do it. So, we will need to ensure that it gets more than 12V to have it work as host for the camera.

Here is the blog: http://tiredhacker.blogspot.jp/2015/01/the-most-important-stuff-to-know-about.html

Kekahuna commented 8 years ago

I figured I'd give a quick update on the Edison base block issue. After detailing the issue we've had with the Edison not working as a USB host with the base block and all of the research and suggestions I've followed, the responses I receive was (paraphrasing some):

Intel forums - "Are you sure OTG works with that? Have you asked sparkfun tech support?"

Sparkfun Tech support - "Hmmm. I'm not sure. Have you asked the Intel forums?"

In other words, the issue we're having is difficult for anyone to pinpoint and I'm getting bounced back and forth because no one really has a good solution. Checking a recent forum post on the Intel forums, there was a person complaining that the USB host bug is still not fixed (must be similar to the issue we're having). The response to him was that yocto 3.0 should fix the issue. After we've transferred our work over to the mini breakout, and assuming I have a minute of free time, I will try to flash the 3.0 image onto the base block and see if that fixes anything.

bhunt2 commented 8 years ago

@Kekahuna

Thanks for the update. I have seen quite a few projects that use the Edison as a host using either the mini breakout or the arduino breakout. They all seem to be doing well with using it as a USB host.

bhunt2 commented 8 years ago

@Kekahuna

Please update on this issue as soon as you have something. Tell me when you get the Edison hooked up with camera connected and ssh available. thanks

Kekahuna commented 8 years ago

I have the mini breakout Edison connected with ssh available (the ssh wiki is up to date). The camera is connected and works properly with the 9V battery. Currently, since we don't have a permanent power source yet and since a 9V battery doesn't last very long, I can only connect and actually use the camera with it while physically being within the vicinity of the Edison.

Here's a snapshot of lsusb and dmesg | tail with the mini breakout Edison:

usbdetected_newedison

The sparkfun board still does not act as a host. I'll leave it up to you as to whether or not we should close this issue.

bhunt2 commented 8 years ago

Do you have a 9v power supply from the wall? On May 2, 2016 3:49 PM, "Kekahuna" notifications@github.com wrote:

I have the mini breakout Edison connected with ssh available (the ssh wiki is up to date). The camera is connected and works properly with the 9V battery. Currently, since we don't have a permanent power source yet and since a 9V battery doesn't last very long, I can only connect and actually use the camera with it while physically being within the vicinity of the Edison.

Here's a snapshot of lsusb and dmesg | tail with the mini breakout Edison [image: opencv initialization] https://cloud.githubusercontent.com/assets/15057867/14948628/58b93b78-0ff7-11e6-829c-cac37b23d8ea.png

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/bhunt2/QC1.0/issues/25#issuecomment-216117903

Kekahuna commented 8 years ago

My results from running a simple camera detection code on the Edison is as follows:

cameratestedison

The "I can see" portion is my cout that displays if the camera is being properly detected (it would display "I am blind" if it cannot detect the camera). The errors that follow are pertaining to the way that I am freeing the camera capture. There are differences between doing so in a Windows Visual Studio environment and doing so in the Edison environment. I'll have to figure that out.

The code I used to test is the CameraTest.cpp found in my code section on github.

Kekahuna commented 8 years ago

I don't have any kind of power supply configuration from the wall that would match the two pin configuration necessary for the J21 pins on the mini breakout. I can see if any of us can rig something up.

bhunt2 commented 8 years ago

That would be great. You can take the bullet jack plug off a 9v wallwart and use that as long as it is less than 1A. The ones for arduino would match those specs. They may even have them in the ieee store.

This is great news. I am glad to hear that the Edison can see now. On May 2, 2016 5:28 PM, "Kekahuna" notifications@github.com wrote:

I don't have any kind of power supply configuration from the wall that would match the two pin configuration necessary for the J21 pins on the mini breakout. I can see if any of us can rig something up.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/bhunt2/QC1.0/issues/25#issuecomment-216138609

bhunt2 commented 8 years ago

@Kekahuna

Please update if this can now be closed. I believe it can be, just want to make sure.

Kekahuna commented 8 years ago

I'll close this issue. I am currently in a back and forth with Sparkfun tech support but their responses so far have pretty much been along the lines of "Are you sure the camera is compatible with the Edison?". They've been somewhat slow to respond so it's been a long process and I doubt it'll go anywhere. I'll update if I make any real progress though this isn't a priority at this point.