Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NucleoTNC USB Does Not Work #264

Closed
mobilinkd opened this issue Jun 9, 2020 · 12 comments
Closed

NucleoTNC USB Does Not Work #264

mobilinkd opened this issue Jun 9, 2020 · 12 comments

Comments

@mobilinkd
Copy link

There is no input or output when connecting to a Mobilinkd NucleoTNC via USB.

http://www.mobilinkd.com/2019/06/24/nucleotnc/

I have found one terminal app that will work with it on Android: https://play.google.com/store/apps/details?id=de.kai_morich.serial_usb_terminal&hl=en_US

You must set the serial port driver to "CDC". (Menu, USB devices, long press on the NucleoTNC, select "Edit", then choose "CDC".) You have to set the receive line terminator as None and set the terminal output to "hex". If you do that, have the baud rate set to 38400, and connect, you will get to see the binary data dump of that packets it is decoding. So that tells me that it can be made to work. I can send hex codes to the TNC that I know will trigger a response and see it respond. I think there just needs to be some work on APRSdroid to make it work.

One key difference between APRSdroid and this terminal app is that it allows you to select the serial driver to use. APRSdroid doesn't do that. All of the terminal apps that lack that ability also do not display anything from the NucleoTNC.

FWIW, I have the same problem with the Mobilinkd TNC3 when connecting via USB. It too requires a CDC serial port driver. Not typically a problem since Bluetooth is available, but solving it for one should solve it for both.

@Brian-WA5SON
Copy link

I have the same issue trying to use APRSDroid in this use case as mobilinkd has described.

@mobilinkd
Copy link
Author

I take back the issue with the TNC3. I have confirmed that this is working. I don't recall why I thought it did not work.

I managed to get APRSdroid to build with gradle and did some poking around. I upgraded the code to use usbserial:6.1.0 to see if the issue had been fixed. It had not. I have a terminal app which used the mik3y USB serial library which works with STM32 Nucleo boards. Poking around some in the code for both libraries I think I have identified the problem in the felHR85 code. It is not using the proper control inferface for devices with multiple USB interfaces (unless the CDC device is the first interface).

felHR85/UsbSerial#7 (comment)

So to address this issue either the felHR85 library needs to be fixed or APRSdroid would need to use the mik3y library. I like the felHR85 interfaces better than the mik3y library and it seems to me that fixing the felHR85 library seems like the least amount of work.

@na7q
Copy link

na7q commented Jun 12, 2020

Any tips on how you were able to get a build going with gradle? Seems like an endless list of problems when I try to get it building.

@mobilinkd
Copy link
Author

This link: #225

And, yes, it was a bit of a battle.  The versions listed at the bottom of that issue worked for me.

I had to move google() to the top of the buildscript { repositories {...}} section. I don't recall why that was necessary.

To use the jitpack for usbserial I had to add maven { url 'https://jitpack.io' } to the allproject { repositories {... }} section.

I had to add abortOnError false in the lintOptions{} section to get it to build.

To use the usbserial-6.1.0, you need to:

  • add implementation 'com.github.felhr85:usbserial:6.1.0' to dependencies{}.
  • remove the usbserial-4.5.jar file from libs
  • call syncOpen() instead of open() in UsbTnc.scala.

This is for the gradle branch. I used Android Studio to build.

And I just noticed that it appears to have replaced

classpath 'com.android.tools.build:gradle:3.5.1'

with

classpath 'com.android.tools.build:gradle:android st'

@na7q
Copy link

na7q commented Jun 12, 2020

I will give it a go here later. What a pain in the rear it can be to get this stuff going.

I was able to merge over the mapsforge to Android Studio, and it did compile. But I get a FC on the phone. I imagine with a little bit of time we can make it easier to build.

@mobilinkd
Copy link
Author

I submitted a PR to the UsbSerial library which fixes the issue for me. The maintainer of that library has not done a release in about a year. He just posted an announcement that his time is limited and that he is actively seeking assistance maintaining the library. This suggests that the changes may not be adopted upstream any time soon.

Since the UsbSerial library is included as a jar in libs/, one option is to update that jar file with a working version and submit a PR here. @ge0rg would that be acceptable?

In the meantime, those that want to try it out can check out the NucleoTNC branch on my fork.

https://github.com/mobilinkd/aprsdroid/tree/NucleoTNC

@ge0rg
Copy link
Owner

ge0rg commented Aug 14, 2020

@mobilinkd thanks for the investigation and the work. Does com.github.felhr85:usbserial:6.1.0 already fix the issue? Then I'd try to switch from the local JAR file to the gradle dependency. Otherwise, feel free to make a PR with a newer JAR. I'm currently working (a little bit) on the google-maps-v2 branch, but it's far from ready yet.

If you make a PR that just replaces the JAR file, it should be applicable on any branch I suppose ;)

@mobilinkd
Copy link
Author

mobilinkd commented Aug 14, 2020 via email

@ge0rg
Copy link
Owner

ge0rg commented Aug 15, 2020

I've checked out and compiled your UsbSerial branch, also had to add implementation 'com.squareup.okio:okio:2.1.0' to the APRSdroid build dependencies.

It looks like it's working, but I didn't have a radio handy so I just did a dry-run with the TNC3. It reported the following in the log, which I think is a success?:

08-15 15:49:37.462 23284 24000 I CDCSerialDevice: Using CDC control interface 0
08-15 15:49:37.464 23284 24000 I CDCSerialDevice: Interface succesfully claimed

APK for testing: https://aprsdroid.org/download/builds/aprsdroid-gl-2020-08-15_usb.apk

Please test the APK and report back; I'd include it into the next build then.

ge0rg added a commit that referenced this issue Aug 15, 2020
Compilation, in UsbSerial directory:

	cd usbserial && \
	../gradlew build && \
	unzip build/outputs/aar/usbserial-debug.aar classes.jar && \
	mv classes.jar ../../aprsdroid/libs/usbserial-6.1.0.jar

Details:
#264 (comment)
@ge0rg
Copy link
Owner

ge0rg commented Aug 26, 2020

I know that I've been sitting on this for a small eternity, but I'm currently wrapping up a new release of APRSdroid, one that finally fixes maps on Android 10, and I'd like to know whether the last build does fix your USB problems.

@mobilinkd
Copy link
Author

Apologies. I missed the notification about the APK. I can confirm that this is working for me. Thank you!

@ge0rg
Copy link
Owner

ge0rg commented Aug 28, 2020

I've now published APRSdroid 1.6 to Google Play (direct APK download).

@ge0rg ge0rg closed this as completed Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants