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

PTT by RTS or CAT? #324

Open
yeti7 opened this issue May 24, 2022 · 88 comments
Open

PTT by RTS or CAT? #324

yeti7 opened this issue May 24, 2022 · 88 comments

Comments

@yeti7
Copy link

yeti7 commented May 24, 2022

Hi, I'm Denis (K0TX) - a ham behind digirig project.
The interface's sound card works with APRSDrooid, but there is also a serial COM port that allows PTT by RTS signal or CAT with the capable radios. My question is if it would be possible to modify the code to allow these additional more reliable PTT methods?

@skuep
Copy link

skuep commented Oct 3, 2022

A +1 from me as well... As far as I know, android has support at least for CDC ACM USB serial ports, but FTDI should work too!

@adamadam78
Copy link

I would just like to +1 this as well. It would be great to use aprsdroid without VOX.

@Fallenstedt
Copy link

+1 As well. If we could be pointed in the right direction I would love to help make this a reality.

@dwalthermsft
Copy link

dwalthermsft commented Nov 12, 2022

+1 Just got my digirig and can now use my old Yaesu FT-60 as an APRS device with my Samsung Galaxy. Having to key the transmit manually is goofy when the digirig is exposing a COM port for PTT. Not sure if this is helpful, but the SoundModem software on Windows simply requires the PTT port to be selected and is able to key for APRS transmissions. Not sure if this is as simple to implement on Android but maybe it is?

@sparkiesweden
Copy link

+1

1 similar comment
@barryshaffer
Copy link

+1

@charlieb
Copy link

charlieb commented Mar 6, 2023

I would be very happy to try and actually make this change if someone can point me in the right direction.

@barryshaffer
Copy link

there 13 A pretty good write up in THE Read me file in the code repository. I've done some android dev work using the standard IDE but this app was written in SCALA which I haven't dug into.

@charlieb
Copy link

charlieb commented Mar 6, 2023

@barryshaffer Can you link me the write up you're talking about. I'm probably being dense but I can't find it.

My naive guess is that we'd want to inherit from this object
https://github.com/ge0rg/aprsdroid/blob/master/src/backend/AfskUploader.scala#L66
and just wrap this one call in PTT on, PTT off. I'm sure there's a lot more housekeeping that would need to be done but in the spirit of ignorant hubris, it doesn't look that hard.

@barryshaffer
Copy link

Here’s the read me:
https://github.com/ge0rg/aprsdroid#readme

I do tend to agree with you that the solution should be fairly straightforward. However, I don’t have a scala environment set up to give it a try.

@charlieb
Copy link

charlieb commented Mar 7, 2023

I compiled and ran it with android studio out of the box. Nothing external needed for adding scala.

@ge0rg
Copy link
Owner

ge0rg commented Mar 7, 2023

Denis kindly sent me a digirig adapter that's currently on its way. From a practical point of view, @charlieb you are right, except for the housekeeping:

  1. you need to know when to use USB RTS, probably based on the vendor+device ID of the adapter or based on a setting value
  2. you need to connect via USB serial, which means you have to follow Android's USB attachment callbacks in the beginning, like done in https://github.com/ge0rg/aprsdroid/blob/master/src/backend/UsbTnc.scala#L55
  3. you need to track when the async audio output starts and stops, and trigger RTS accordingly

All in all I think this will become an ugly frankensteined combo of USB and AFSK backends, but I'll keep you updated :)

@skuep
Copy link

skuep commented Mar 7, 2023

Thanks for all the effort. I kept thinking, maybe it would be easier to ditch PTT by RTS and settle on CM108-style PTT? It would involve sending USB HID Reports. That could be way more streamlined to implement, but I guess it's not compatible to the digirig?

@charlieb
Copy link

charlieb commented Mar 7, 2023

@ge0rg are we to take it that you're going to take this ticket on yourself before us amateurs start deluging you with poorly thought out, half working, unformatted pull requests?

@ge0rg
Copy link
Owner

ge0rg commented Mar 7, 2023

@charlieb I've been ultra-busy in the last *checks calendar* years, so I'm not going to promise an ETA on this feature. After all, I'm lagging behind fixing the OSM rendering since Android 12, and then some more. If you want to give it a try, or need advice, feel free to do so and to bug me with any issues you encounter. Fastest response times will happen on the APRSdroid xmpp room [email protected] (webchat) btw.

@charlieb
Copy link

charlieb commented Mar 7, 2023

@ge0rg Was never going to ask for a timeline, that's just rude. OK, so I'll take a stab at it. With you backing me up I feel a lot more optimistic about it. Thank you!

@barryshaffer
Copy link

I compiled and ran it with android studio out of the box. Nothing external needed for adding scala.

Well dang, that just highlights my pedestrian level coding ability lol. Maybe I can just help Beta test…

@Chuckw97055
Copy link

Here is the src for a GPL licensed app that does RTS PTT for an example/ideas??
https://bitbucket.org/VK2ETA/radiomsg/downloads/
No idea if that would be remotely useful, but seeing as I'd also love to see PTT control in Aprsdroid, I'll risk it:)

@Thunter96
Copy link

Thunter96 commented Mar 14, 2023

@charlieb thanks for taking a crack at this. This is exciting as it will open up a lot of devices that don't have VOX for use with both APRSDroid and digirig. This is the one thing holding me back from purchasing the digirig mobile from @yeti7.

Edit: looks like somebody may have started this already? Not sure if it's useful or not: https://github.com/Swissman1/aprsdroid

@charlieb
Copy link

Thanks, those links may turn out to be useful. I'm still at the "this looks like something I might need, I'll copy it, change the name and see if it still builds" stage, otherwise known as flailing.
I have forked and I'll probably make a commit tonight if I can get DigiRig to show up in the menus.
https://github.com/charlieb/aprsdroid

@Chuckw97055
Copy link

If RTS is problematic, a useful hack is to output a constant tone on one audio channel for PTT control, as implemented in FLDIGI for example. A circuit is required on the hardware side but it gets you real PTT control.

@kyleh928
Copy link

@charlieb I saw your fork, grabbed the code and put it in Android Studio to try an build an APK to test out. Ran into some errors trying that (Deprecated Gradle stuff). Admittedly I am way out of my lane with this stuff but wanted to give it a shot and see if it was functional enough to test. When it is ready, maybe I can help test since I am out of my depth with the rest.

@oSPANNERo
Copy link

Soo... sorry/not sorry for necroing this but would love to see this feature in a future release. (Not a coder so can't contribute that way but I have been told I give good shoulder massages!)

@bxlentpartyon
Copy link

I wrote a POC commit to enable PTT via RTS in a forked repo here:

https://github.com/bxlentpartyon/aprsdroid/tree/usbtnc-ptt-rts

This is definitely not "good code" yet, and shouldn't be merged even if it works, but I think it does the right thing to some degree. My Digirig will get here tomorrow, so hopefully I can get this properly tested and write a real commit then.

@bxlentpartyon
Copy link

As I review stuff here, I'm seeing that the audio output is probably asynchronous (decoupled from the packet send path), so my idea might be correct in spirit, but also might not actually work reliably/at all. The 50ms padding that I added might be enough to paper over my misunderstanding, but that doesn't make it correct.

Anyway, I'll look at this more when I can actually test it. Just wanted to point out my own mistake :)

@bxlentpartyon
Copy link

I got my Digirig today and tried this out. With one more small tweak, I was able to eliminate the the behavior where the radio is keyed contintuously after the Digirig is initialized, and I'm able to see it key the radio when packets are transmitted. However, my traffic doesn't seem to be making it to the nearby digipeater.

To be clear, I'm doing this on a Baofeng, so it's super hard to say if the radio is the problem. I can say that I had APRSDroid working quite well on VOX mode with the BTECH APRS cable, but yesterday when I was playing with it, it was barely hearing any packets off the digipeater, and transmission was spotty/not working at all. FYI I do have a fairly decent homemade half-wave antenna hooked up, which the guys on the local repeater say sounds fine.

I did a bit of troubleshooting here on my own, by plugging earbuds into the audio port on the Digirig, and I'm not getting any sound when packets are transmitted. However, I don't know if this is even a valid test. I did get sound during transmission when I plugged my earbuds into the serial jack, but, again, I have no idea if that is a valid test.

Anyway, I'm pretty confident I can get this working, but I think I need a little help with troubleshooting here. @yeti7 @ge0rg is it appropriate to have that conversation here, or should I maybe post on the Digirig forum?

@bxlentpartyon
Copy link

I'll add an additional note that when I tried hooking the radio up to the serial port jack on the Digirig (using the appropriate cable) the radio did key up during transmission, but it keyed off and on rapidly during transmission. If the serial jack/cable are the ones I should be using, then there might just be another layer of issues to debug here.

@bxlentpartyon
Copy link

I did some more testing today, and I think (unsurprisingly) that something has gone funky with the radio. It was transmitting packets reliably with the AFSK/VOX setup last week, and nothing is making it out now, even when sitting right next to a local digipeater. I'm going to upgrade to a new HT and continue working there. Hopefully more to come in a week or so.

@bxlentpartyon
Copy link

I got my new radio yesterday and got to work on this. It's ended up being a bit more complicated than I initially realized, but should be totally do-able. I worked on top of @charlieb's commit to produce this branch:

https://github.com/bxlentpartyon/aprsdroid/tree/digirig

I was able to get it to transmit packets, but RX isn't working yet. Probably partially because the code and branch are both super sloppy right now. Anyway, it's working to some degree. More soon.

@penguin359
Copy link
Contributor

Briefly looking through the USB Serial library from felHR85 that is used by APRSdroid, I don't see any mention of ACM support which is the interface that the CM108 uses for AIOC. It's possible I missed it or am misunderstanding how it works, but that might explain why my earlier test of the pre-release APK published above was not able to control the RTS signal on my AIOC adapter. I took a look at the USB Serial Terminal app from the Play Store that I've confirmed does work with it and can toggle the PTT switch on my radio and it uses a different USB serial library at mik3y/usb-serial-for-android which clearly calls out CDC/ACM support in the README and driver source. Also the current library hasn't had a release for 5 years and only a small handful of unreleased changes since then. I might try swapping libraries and see if that improves support or not.

@skuep
Copy link

skuep commented Aug 3, 2024

The AIOC supports either RTS&DTR or CM108 for PTT. ACM is the USB class for a serial adapter and on its own has nothing to do with CM108 (which is HID and not ACM).

@penguin359
Copy link
Contributor

Yes, I am aware that the HID interface can be used to control the PTT on the AIOC, but so can the RTS&DTR signals and those are provided by the ACM interface. That offers two different ways to control the PTT, but there is zero support for HID in APRSdroid and there is support for RTS&DTR being added to APRSdroid, it makes more sense to go for the latter in supporting for the control interface for PTT. CM108 actually has 4 different USB interfaces that it presents, USB Audio, HID, DFU for firmware updates, and ACM for serial port control. Finally, ACM is a standard interface used by a number of other serial adapters besides the mainstream FTDI and Prolific chips so this will increase the number of devices supportable than just the CM108 which using a unique HID interface as an alternative and not supported by anything else.

@skuep
Copy link

skuep commented Aug 3, 2024

I was just trying to clear up some confusion in your earlier post:

Briefly looking through the USB Serial library from felHR85 that is used by APRSdroid, I don't see any mention of ACM support which is the interface that the CM108 uses for AIOC.

I have no experience with Android but given it is based on a Linux kernel, it shouldn't be hard to implement HID control. But that is beside the point here.

CM108 actually has 4 different USB interfaces that it presents, USB Audio, HID, DFU for firmware updates, and ACM for serial port control.

I am pretty sure that the CM108 has neither DFU not ACM. Are you confusing this with my AIOC project?

Finally, ACM is a standard interface used by a number of other serial adapters besides the mainstream FTDI and Prolific chips

I am pretty sure that FTDI serial devices have their own kernel driver and don't use the ACM kernel driver, thus I don't expect them to be supported by this. Correct me if i am wrong.

Btw, In terms of breadth of support, it would be wiser to implement CM108 style PTT via HID, because a lot of people are using this solution with the actual CMedia devices. And best part is, the AIOC would be supported as well, because it implements the same interface. (Other than the differing USB VID:PID of course).

@penguin359
Copy link
Contributor

The Linux kernel has support for HID but that doesn't mean that it's exposed in a way Android Apps can just use. I did not see anything in the Android API that would offer access to HID Raw devices, which is what would be needed here. That leaves implementing HID in userspace and using the barebones USB interfaces to control the device. While HID is pretty simple, it's not dead simple with the complexity of the HID Report parser that's needed and adds a bit of complexity over just extending RTS/DTR to one more device, in my perhaps not-so-humble opinion. :-)

As for the CM108, maybe I am confusing things. I thought the AIOC board is based on the CM108 chip. Maybe it's just implementing the interface that was created by the CM108, but in all my comments, I am referring to the AIOC board which is what I am trying to get working with this. The AIOC does implement all those interfaces I mentioned whether the CM108 does or not. If the goal is to just add AIOC support to this request, then implementing ACM seems to be the most straight-forward to me so it's just another serial port interface. I have already confirmed that I can control my radio via the AIOC using the RTS with a different USB Serial library that was developed for Android.

In my last comment, I was say to support ACM in addition to the main stream serial adapters that implement their own proprietary interfaces like FTDI and Prolific. I am well-aware that the USB-IF was slow on getting a standard out and we ended up with a bunch of common proprietary interfaces along with a vendor-neutral standard to deal with. The current USB Serial library in APRSdroid only seems to include support for these earlier, but well-established proprietary interfaces at the moment.

I have never heard of CMedia devices or CM108 prior to discovering the AIOC. But, I can imagine others implementing other devices that require ACM. There are a number of Arduino board with native USB (not FTDI) and therefore implement ACM so support for ACM, regardless of whether the AIOC uses HID or ACM, could be useful. Also, even if not for Audio+PTT control, the TNC interfaces can benefit from ACM support and be used with a full Arduino TNC.

@DGxInfinitY
Copy link

DGxInfinitY commented Aug 4, 2024

The AIOC is much different than Digirig devices. Digirig offers the Digirig Mobile with a CM108 chip alongside a Serial Chip that are combined into one USB port. It's a great tool offering soundcard and Cat/Rig control over one USB port. There is also the digirig lite wich is only a cm108 chip with reliance on GPIO 3 for ptt. I have both as well as a homebrew of the digirig lite(basically a bare PCB with a transistor connected to gpio 3 and the ptt circuit of my radio) both work well with this cli utility on Linux (https://github.com/twilly/cm108)
This is a basic c implementation of hidraw write which might prove to be a fabulous starting point on how to add this functionality to APRS Droid. This would only fix compatibility with digirig lite and not the serial rts of the digirig mobile. That would still need another solution to add support for serial rts. There is already a branch (or fork? I can't quite remember.) of APRS Droid that supports this functionality and works quite well. I am testing it on my device now.

AIOC is an STM chip the emulates the hidraw support of gpio 3 that many other software supports. This means that if your software supports cm108 sound cards for ptt than the AIOC will work identically. It's a really smart way to bake in additional support for a new hardware standard by emulating a common homebrew/commercial product with more support.

@skteagle
Copy link

skteagle commented Sep 28, 2024

II was so excited to see this as I have tried to get APRSDroid to work with my Alinco DR-735T and digirig. I was always able to RX packets on APRSDroid but never TX using AFSK. If I tried USB than it would just get stuck on PTT until I clicked off tracking. I downloaded your release and when I go to start tracking after choosing AFSK and Digirig or send position it crashes the app. Any suggestions?

@penguin359
Copy link
Contributor

@skteagle Any chance you are able to attach to your phone with ADB and get a logcat debug log while it is crashing?

@skteagle
Copy link

skteagle commented Oct 20, 2024 via email

@kd2var
Copy link

kd2var commented Nov 1, 2024

I installed the original test version of this, my tablet running android 14 won’t let me install any of the updated versions, I can transmit without any issues but I can’t get it to decode anything. Any advice?

@na7q
Copy link
Contributor

na7q commented Nov 1, 2024

Uninstall and reinstall. Does it install then?

@kd2var
Copy link

kd2var commented Dec 14, 2024

I can’t get the digirig version to work with offline map files. I have been able to do it with the standard apk on other devices but not in my tablet with the digirig version. Not sure if it is an issue with my tablet or with the build

@na7q
Copy link
Contributor

na7q commented Dec 15, 2024

If you're talking about the official version of APRSdroid, it does NOT do offline maps. It's broken. If you're referring to my build, it does do offline maps, but I have yet to implement the DigiRig commit into it.

So if you're using an extremely old version of APRSdroid, it will do offline maps, but doesn't play well with newer Android versions.

@kd2var
Copy link

kd2var commented Dec 15, 2024

If you're talking about the official version of APRSdroid, it does NOT do offline maps. It's broken. If you're referring to my build, it does do offline maps, but I have yet to implement the DigiRig commit into it.

So if you're using an extremely old version of APRSdroid, it will do offline maps, but doesn't play well with newer Android versions.

I guess the APRSdroid version I’m running on my old tablet is an older version since it’s an older tablet. Do you plan on adding the digirig functionality to your build? Is there an apk for your build?

Thanks

Scott

@na7q
Copy link
Contributor

na7q commented Dec 15, 2024

If you're talking about the official version of APRSdroid, it does NOT do offline maps. It's broken. If you're referring to my build, it does do offline maps, but I have yet to implement the DigiRig commit into it.
So if you're using an extremely old version of APRSdroid, it will do offline maps, but doesn't play well with newer Android versions.

I guess the APRSdroid version I’m running on my old tablet is an older version since it’s an older tablet. Do you plan on adding the digirig functionality to your build? Is there an apk for your build?

Thanks

Scott

Yes and yes. I'm currently making some major additions to APRSdroid. Here's my latest public release. Google Maps is not included. Use OSM! I will add DigiRig and BLE support soon. But I need some feedback on these as I don't have anything to test it against.
http://na7q.com/wp-content/uploads/2024/12/aprsdroid-release-noapi-freq-control.apk

@kd2var
Copy link

kd2var commented Dec 19, 2024

If you're talking about the official version of APRSdroid, it does NOT do offline maps. It's broken. If you're referring to my build, it does do offline maps, but I have yet to implement the DigiRig commit into it.
So if you're using an extremely old version of APRSdroid, it will do offline maps, but doesn't play well with newer Android versions.

I guess the APRSdroid version I’m running on my old tablet is an older version since it’s an older tablet. Do you plan on adding the digirig functionality to your build? Is there an apk for your build?
Thanks
Scott

Yes and yes. I'm currently making some major additions to APRSdroid. Here's my latest public release. Google Maps is not included. Use OSM! I will add DigiRig and BLE support soon. But I need some feedback on these as I don't have anything to test it against. http://na7q.com/wp-content/uploads/2024/12/aprsdroid-release-noapi-freq-control.apk

I installed the latest release, the one from today 12/18, on my phone and it seems to be working perfectly connected to my BTech uv-pro. Offline maps are working properly as well. You might want to add to offline mapping instructions to run and update and upgrade on a new install of termux. I was able to figure out the issue from the error message when your script didn’t run the first time but someone who has no experience with Linux might not be able to figure it out.

Anyway, thanks for your work on this, these are all much needed improvements to APRSdroid. I’m looking forward to you adding the digirig functionality so I can test with my tablet and my mobile rig.

Thanks again

Scott

@na7q
Copy link
Contributor

na7q commented Dec 19, 2024

I will be adding digirig support by this weekend or sooner. Possibly tomorrow. I do have a guide for offline setup. It's not great but will get most folks going.

https://na7q.com/aprsdroid-osm/

@na7q
Copy link
Contributor

na7q commented Dec 20, 2024

@Chuckw97055
Copy link

Thanks NA7Q, very cool. Tried RTS ptt on my Digirig and a generic FTDI board.. both work.

@na7q
Copy link
Contributor

na7q commented Dec 30, 2024

Thanks for the confirmation. Big update coming! Stay tuned!

@RyanHope
Copy link

RyanHope commented Jan 5, 2025

So where we at with AIOC support?

@na7q
Copy link
Contributor

na7q commented Jan 5, 2025

So where we at with AIOC support?

Non-existent for PTT. Should work otherwise in theory. Since Android supports CM108 sound cards.

@Thunter96
Copy link

Thunter96 commented Jan 5, 2025 via email

@skuep
Copy link

skuep commented Jan 5, 2025

So where we at with AIOC support?

Non-existent for PTT. Should work otherwise in theory. Since Android supports CM108 sound cards.

The AIOC supports RTS/DTR as well. I guess the question is rather if the AIOC with it's VID/PID will be detected by aprsdroid. Or does it accept any serial interface? (ttyACM in this case).

AIOC can be setup to trigger PTT when audio is in the buffer. I use an AIOC with modified firmware, but the standard firmware was updated so you should be able to set it up easier.

That is possible although not a straightforward solution and it has its own quirks (eg regarding preamble timing and such) that need to be dealt with. Would be nice if you could just connect it to the android device and it just works in aprsdroid.

@na7q
Copy link
Contributor

na7q commented Jan 5, 2025

I'll look more into it. But no guarantees from me. I don't have a device, like I don't have a DigiRig, but I have lots of CM108 devices. Of which I have used to receive with on APRSdroid. But I'm heading back to work. So I can't work on things like I have the last 2 weeks during vacation. I got a lot of crap done!

@RyanHope
Copy link

RyanHope commented Jan 5, 2025 via email

@na7q
Copy link
Contributor

na7q commented Jan 5, 2025

If PTT gets stuck open, I'd make the assumption you're using a baofeng with the stock antenna, or with a non-resonant antenna. I would also assume you have no ferrite on the USB cable? All these things will typically cause that.

Does android detect your audio card at all? It will tell you if it does, and it's usually obvious.

@RyanHope
Copy link

RyanHope commented Jan 5, 2025 via email

@na7q
Copy link
Contributor

na7q commented Jan 5, 2025

The problem with Baofengs is the RF gets into everything. You WILL need good ferrites and good antennas to prevent it completely.

Some circuitry work can be done to help prevent that problem as well.

@na7q
Copy link
Contributor

na7q commented Jan 5, 2025

I just looked up the schematic. Oofta is all I can say. They are using a BJT for the PTT. These are bad in my experience because if a tiny bit of RF hits them, they always lock up the PTT. This was why when I made TNCs, I used a MOSFET. 2n7002 surface mount type. Add a couple capacitors on the line and a resistor, and that resolved all the RF problems I ever had.

So my suggestion is that they move away from the BJT or similar transistors, as they are bad in RF environments. Just my opinion of course.

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