ASU-cubesat / phxsat-gsw-public

Public repository to allow people to hear from and communicate with the Phoenix CubeSat
6 stars 0 forks source link

Request for channel selection as a command line option #5

Closed N6RFM closed 4 years ago

N6RFM commented 4 years ago

HI,

Currently the code selects channel 1. It appears that the KPC-9612 used at your GS uses 0 for 1200 baud and 1 for 9600 baud.

Please allow the user to choose a different channel, e.g., 0 or 1, as a command line option. This will allow other GS software users greater flexibility with other modems, e.g., software based.

Thanks Bob N6RFM

vivekjc commented 4 years ago

Hello Bob,

As far as we understand the switching between 1200 baud and 9600 baud was done using a physical switch on the TNC.

Could you please point us to section of the code that you think sets the channel, so that we could look into it and provide the functionality required.

Regards Vivek Chacko

N6RFM commented 4 years ago

Hi Vivek,

Not exactly sure, but here are two comments I received from Direwold users -

from KA2DDO (author of the APRS client YAAC) " Looks like the hardware TNC formerly used completely ignored the TNC number in the KISS header byte (which allows up to 16 uniquely numbered TNCs to theoretically share a serial line), but DireWolf properly handles it, and is telling you that your application is asking for a non-configured sound card." so " Fix your app to request TNC#0 instead of TNC#1."

Does the header byte specify Channel 1? If so, the perhaps it could be toggled to zero?

and from WB2OSZ, the author of DireWolf

"They also hardcoded port (or channel depending on what you want to call it) to be 1. From a brief perusal, the KPC-9612 uses 0 for 1200 baud and 1 for 9600 baud. Apparently port is programmed in there somewhere... I don't see where it is being set though. Here it looks like it is always 0. https://github.com/ASU-cubesat/phxsat-gsw-host/blob/b8cdb3439f5d16504103856a1d079f6fadb92ee4/src/interfaces/csp_if_kiss.c

define TNC_DATA 0x00

driver->kiss_putc(TNC_DATA); Maybe there is another version of libcsp. I would suggest making a request to add the port (channel) as another command line option."

Sorry, that's all I have. Have looked at many of the source files, but nothing jumps out at me. If there is a way to change the header byte to specify channel 0 or TNC 0, I will be happy to try it.

Thanks,

Bob

sarahsrogers commented 4 years ago

Ah - I think I see where this can be modified. On lines 71-75 of csp_if_tnc.c (located in libcsp/src/interfaces) we do send a command to our TNC to forward data over port 1 (the high speed port) rather than port 0.

This comes before we transmit the AX.25 header and actual packet through our TNC. It appears that changing line 75 to driver->tnc_putc(0x00) may solve the issue that you are facing. Can you give this a try to see if it resolves your issue? From what I can see, this should be the only thing you have to change, but if this doesn't work for you, I'll try looking into it more.

    /* Transmit data */
    //printf("csp_tnc_tx: transmitting bytes: ");
    csp_tnc_handle_t * driver = interface->driver;
    driver->tnc_putc(FEND); //printf("%02x ", FEND); 
    driver->tnc_putc(0x10); //printf("%02x ", 0x10); // TNC_DATA needs to be 0x10
N6RFM commented 4 years ago

Hi Sarah,

It worked! Now Direwolf users can switch between desired channels. Thanks so much.

Bob

sarahsrogers commented 4 years ago

great! Thank you for testing that out for us Bob. We'll work on adding a command for this to the terminal interface so it's easier to switch between the two.

vivekjc commented 4 years ago

We will work on creating a config file that allows the user to set a SRC, and DST callsign as well as the channel. Will make a separate issue to track the progress with this