Using the USB host can a NETMF device connect and communicate with Android hardware? It is my expectation to flash a modified version of the Android OS to the tablet however, I’m not sure what kind of usb client device I should be emulating. I’m assuming USB serial, but the last time I connected a USB serial device to NETMF (a physical usb to serial adapter) it didn’t work.
Which one really wants to be the host and which one really wants to be the client? Whats your data throughput expectation?
From memory I had a USB-host cable on an early Samsung Galaxy Tab device running Android and had it connected to a Cerberus just using a serial app on the tablet to communicate to my app…
Are you thinking of emulating whatever is necessary for something like “download mode”? (f.e. HTC’s RUU installer?) Or, are you just planning to use the board as mass storage and have a custom recovery flash the ROM from it? In general, I’d be extremely surprised if there was some sort of generic works-for-every-Android way to do it, and I would expect that whatever the proprietary protocol is for any given manufacturer would be a closely-guarded secret.
@ Brett - NETMF will be the host. This will allow me to debug the NETMF device while connected to the tablet. Simply serial would be preferable; that way I don’t have to do any extra work to modify the android operating system.
@ godefroi - I’m hoping that there is a standard, which doesn’t require a huge effort to implement.
I need on my machine a touch screen, wifi and perhaps bluetooth. I’ve found that a screen module + driver electronics cost about as much as a tablet. And now with Windows 10 running on small tablets on the cheap, I figure that if it can work for Android it might work for windows. I’ll have to purchase a few devices before I can figure this out, but at least I’m not searching in vain.
Good luck with your endeavor. Personally, I think you’ll be biting too much off, but I am not going to try to stop you.; for NETMF to be the host, the tablet needs to look like something that the NETMF device understands. That’s not likely to include true debug capabilities, and I can’t see any OS actually giving that capability out of the box.
I’d start by digging into the AOSP code and the ADB code. If something could be done, that’s where you’d learn it. My guess, you’re embarking on a multi-man-year project.
Not true with Android as it supports debugging via the USB port but there lies the issue for MrJohnSmith. He has to work out how to do debugging and interconnect at the same time on the same USB port.
@ mrjohnsmith, check this out as it allows you serial device access at the same time as running an ADB connection for debugging your Android app. It’s open source.
He also has the issue of writing in JAVA (Dalvik) on Android and C# on the NETMF side. There are come C# for Android but you then lose the low level capability you have with JAVA and JNI. It gets messy.
Personally there are low cost LCD modules now that could be used with the NETMF offerings from GHI. It’s all down to what design capabilities you have in house and the size of your project.
Ok now I’m beginning to follow the debugging conversation. I don’t necessarily need to debug the Android App while connected to the NETMF device. Sigh, a multi-man year project uh? Was planning on using the Xarmin stuff to develop the app in C#, thereby keeping the code base in the same language; hopefully I won’t need to go very low.
I’m not sure any of us understand what it is you’re trying to do. Are you:
[ol]Trying to build a NETMF app that can flash a ROM to an Android device?
Trying to build an Android app that can debug a NETMF app?
Trying to pass data between an Android app and a NETMF app?[/ol]
Depending on what you’re trying to do, these things vary between simple (the last one) to multi-man-year (first and second one).
If it’s the first one, then you need to dig into the ADB and AOSP source. If what you’re trying to do is even possible, that’s where you’ll find out. If it’s the second one, then you need to dig into the NETMF source. It’s almost certainly possible, but it’s not going to be easy. If it’s the third one, then it’s pretty straightforward. You’re going to be using USB CDC.
So how do you plan to debug and test it? You already know how painful it is to work with the likes of Arduino and its lack of debugging capabilities and as you are a NETMF fan, you know how great debugging can be to track down issues.
[quote=“Mr. John Smith”]
Was planning on using the Xarmin stuff to develop the app in C#, thereby keeping the code base in the same language; hopefully I won’t need to go very low.[/quote]
You said that some of the LCD options were expensive. Xaramin is not free and $999 per YEAR is a lot of money unless you plan to sell loads of your tablet based system. I know there is a free tier version so maybe your Android side will be simple enough to meet the memory requirements but it has restrictions? Without knowing your application it hard to see which is the best way to go.
What about using Bluetooth as the communications link? That would avoid the need to have a physical connection and you would then have full debug capability.
@ godefroi - The app just needs to communicate with the NETMF device to give it commands to start the robot moving, and to receive status updates on the progress of the build.
@ Dave McLaughlin - I thought about using bluetooth; but if I’m using radios then I might as well use WIFI, and connect to the person’s network instead. Part of the reason why I wanted to use an Android tablet, is to piggy back off the tablet’s WIFI to get the NETMF device connected to the internet (it’s not the whole point, but it’s part of it).
Cost, Cost, Cost, Cost. The robot’s selling price is locked in at $3,000 USD putting in $200 worth of NETMF to control it doesn’t sit well with me, because my would be competitors will drop a RPI on theirs and make me look outdated. I don’t want to have to justify why I choose NETMF over technology B every time I try to sell a robot.
You can open a serial port over the Android USB using libraries found here : [url]http://felhr85.net/2014/11/11/usbserial-a-serial-port-driver-library-for-android-v2-0/[/url]
A recent update : [url]http://felhr85.net/2015/01/09/a-dirty-and-quick-example-of-serial-port-communication-in-android/[/url]
The library supports FTDI, Silicon Labs and prolific chipsets, so you can plug one of those into the Android USB and get TTL UART serial in/out.
There appears to be some support for CDC as well.
The author appears to use this to communicate between Android and Arduino, but it should work similarly for netmf.
Full disclosure : I’ve never tried this lib - I just came across it while researching a similar need.
the one thing that still strikes me that you have briefly mentioned but not explained is the fact that doing this “gives netmf device access to the network”. Assuming a serial connection between the netmf device and android device, you have to either encapsulate the network traffic or have an app that knows how to request the necessary data and transfers it back over serial. It’s not like you can just bring that up and use native networking on the netmf device to access wider resources.
I agree with @ Brett - all I offered up there is a way to initiate a simple serial dialog with the Android device … just pushing bytes between the devices.
@ Brett - Yes, I know I can’t use native NETMF networking over this android hybrid, I will be using the app as a network proxy for NETMF.
@ mcalsyn - So USB CDC is different from TTL UART? Well look at that. I thought all usb serials were made equal.
@ Mr. John Smith - The difference is that the FTDI-like adapters do a hardware conversion from USB to TTL UART. CDC is a pure USB pathway from end to end, but the client end has to know how to accept a CDC connection. GHI USB can originate CDC connections, but I am not sure that they can receive CDC connections and treat them as serial.
EDIT: I’m not sure NETMF devices can do CDC on their host as well. I remember trying to connect a USB to Serial device before and Gus said it was possible.
@ Mr. John Smith - Well, does connecting the USB end of an FTDI to the Android and the UART end of that same FTDI device to UART pins on the netmf device not work? It looks like that Android code I sent will drive the FTDI, and we already know that netmf handles UARTs as COM ports well enough.
EDIT: This is a more technical and more complete description of the setup : [url]http://www.allaboutcircuits.com/projects/communicate-with-your-arduino-through-android/[/url]
@ mcalsyn - Intresting…