BT communication problem

Here we will discuss any subject related to the Android Pocket Transceiver which is available for free download in Google Play Store
Post Reply
oh5rm
Posts: 5
Joined: Thu Jul 25, 2013 5:22 pm

BT communication problem

Post by oh5rm »

Hi,

I have an Arduino DDS-VFO. I added CAT-control emulating FT-817 and it is working OK when connected to HRD or Commander with Arduino USB cable. In this testing phase only frequency control is implemented.
I have problem when I try to use the same serial communication over BT to Android Pocket Tranceiver 0.6 or 0.6.4. The BT connect goes OK and Android recognizes the BT dongle as BT UART, and the blinking LED goes ON. But the main frequency display stays black, without any number, so Arduino is not updating Pocket tranceiver and visa versa.
I have tested the BT communication itself with Blueterm and data flows in both directions over BT.
So my question is, what is Pocket Tranceiver sending after connect is established and what it expects as return?
I have no possibility to test BT connection to HRD or Commander, because BT in my Windows PC is not working. The BT dongle which I am using with Arduino is JY-MCU

73 Jouko OH5RM oh5rm@sral.fi
User avatar
yo3ggx
Site Admin
Posts: 832
Joined: Wed Aug 15, 2012 8:30 pm
Location: Bucharest, România
Contact:

Re: BT communication problem

Post by yo3ggx »

Hi Jouko,

First I want to apologise that I've missed your e-mail. I was in a long vacation and the server crashed in between, including the forum, so no notification received for yout post till today.

Have you ckecked the baudrate for your Bluetooth module? It usually defaults at 9600.
Next you can try to play with BNSCP (Bluetooth and Network Serial Communication Protocol analyzer), another application posted by my in Play Store and send some commands directly through the BT interface.

Please be back after that with the result.

Good luck.
73 Dan YO3GGX
oh5rm
Posts: 5
Joined: Thu Jul 25, 2013 5:22 pm

Re: BT communication problem

Post by oh5rm »

Thanks Dan for the answer.

I tried already earlier your BNSCP but did not get it communicate with Arduino over BT.
It detects (MAC address OK) and connects OK to the BTUART but no communication can be seen on BNSCP display.
Are there some critical settings in BNSCP which could be wrong?

But when I use BLUE TERM then the communication between Android-Arduino is OK.
The BT device is JY-MCU and it should have 9600bd as default.

73 Jouko OH5RM
User avatar
yo3ggx
Site Admin
Posts: 832
Joined: Wed Aug 15, 2012 8:30 pm
Location: Bucharest, România
Contact:

Re: BT communication problem

Post by yo3ggx »

Hi Jouko,
oh5rm wrote:Thanks Dan for the answer.

I tried already earlier your BNSCP but did not get it communicate with Arduino over BT.
It detects (MAC address OK) and connects OK to the BTUART but no communication can be seen on BNSCP display.
Are there some critical settings in BNSCP which could be wrong?
There is no specific configuration for Bluetooth mode. You just have to be sure that the baudrate of the Bluetooh module is the same as the one of your Arduino based interface.
But when I use BLUE TERM then the communication between Android-Arduino is OK.
The BT device is JY-MCU and it should have 9600bd as default.

73 Jouko OH5RM
This is really strange. Regarding to the low level communication there must be no difference between BlueTerm and BNSCP.
I've seen here:
http://wiki.pinguino.cc/index.php/Inter ... oth_JY-MCU
that you need to send 'h'. Please be aware that BNSCP can send data entered in multiple formats (bin, dec, hex, char, etc). Did you checked that you have tried to send a command using the right format?

73 Dan YO3GGX
oh5rm
Posts: 5
Joined: Thu Jul 25, 2013 5:22 pm

Re: BT communication problem

Post by oh5rm »

Yes there should be no difference between BNSCP and Blue Term, but something there is.

I made a small test program just to print "HelloWorld" and to light some LED according to characters sent from BNSCP or Blue Term, and that is working with both programs.
So I must study what could be the reason for for this mystery.

73 Jouko OH5RM
User avatar
yo3ggx
Site Admin
Posts: 832
Joined: Wed Aug 15, 2012 8:30 pm
Location: Bucharest, România
Contact:

Re: BT communication problem

Post by yo3ggx »

oh5rm wrote: So I must study what could be the reason for for this mystery.
Hi Jouko,

Please post here your findings. I'm very interested in your conclusions.
At the end, I can implement native support for your device in my app with no need for you to emulate a specific transceiver CAT protocol (which anyway is not great at all).

73 Dan YO3GGX
oh5rm
Posts: 5
Joined: Thu Jul 25, 2013 5:22 pm

Re: BT communication problem

Post by oh5rm »

Hi Dan,

Some progress made.
The code I use in Arduino waits for commands exactly 5 bytes long and as return it also sends 5 bytes. This seems to work OK with HRD and Commander when using USB serial communication.

To get communication to Pocket Tranceiver work I now changed the code to wait commands >=5 bytes. Now the frequency display works in both directions. But there still is a problem caused by the fact that in Arduino only part of 817 emulation is implemented, mainly the commands for frequecy, mode is CW. As return to unrecognized commands Arduino sends 5 bytes of 0. This seems to cause display 0.1000 at Packet Tranceiver at times.

So my questions: Is Pocket Tranceiver sending not exactly 5 bytes as command? What would be a suitable return message for unknown commands? (Instead of 00000, which maybe causes the display 0.10000 at times)
Also the original question: what is Pocket Tranceiver sending first after connect and what it expects as return?

73 Jouko OH5RM
User avatar
yo3ggx
Site Admin
Posts: 832
Joined: Wed Aug 15, 2012 8:30 pm
Location: Bucharest, România
Contact:

Re: BT communication problem

Post by yo3ggx »

Hi Jouko,
oh5rm wrote: So my questions: Is Pocket Tranceiver sending not exactly 5 bytes as command? What would be a suitable return message for unknown commands? (Instead of 00000, which maybe causes the display 0.10000 at times)
Also the original question: what is Pocket Tranceiver sending first after connect and what it expects as return?

73 Jouko OH5RM
Pocket RXTX uses the commands described here:
http://www.ka7oei.com/ft817_meow.html

After the successfuly connection, a timer is started (100ms interval). At each tick, a counter is icremented (values from 1 to 5).
For each value of the counter a different command is innitiated (as implemeted in the current version):
1 and 3 - if PTT on, then CMD_READ_TX_METERING, if PTT-off then CMD_READ_FREQ_AND_MODE
2 and 4 - if PTT on, then CMD_READ_TX_METERING, if PTT off, then CMD_READ_RECEIVER_STATUS
5 - if radio model is FT817, then CMD_READ_EEPROM_DATA from location 0x79 and 0x7A (PWR and ANT), for other type do nothing

All commands are added to a queue. If the queue is longer than 5 commands then current command is not added.
Commands generated by the GUI controlls are asynchronous added to the same queue.
The commands from the queue are send to the radio in a separate thread, one by one, waiting for the radio answer before sending a new one.

Hope this helps.

73 Dan YO3GGX
oh5rm
Posts: 5
Joined: Thu Jul 25, 2013 5:22 pm

Re: BT communication problem

Post by oh5rm »

OK, it seems like there are commands which are not implemented ( yet or not needed) in Arduino.
These unrecognized commands are now answered by sending 5 bytes of 0.
As this message seems to upset the Pocket tranceiver display, I could easily change it to some other value.
What would be a suitable "do nothing" message?

73 Jouko OH5RM
Post Reply