FullDuplexSerial: bit of a head-scratcher re: rxcheck
Mickster
Posts: 2,694
I have a very simple loop where I am transmitting data to my Android device via RS232 and a Bluetooth adapter.
Although not currently receiving data, I have provided for it and it works very well, the following is in the same loop:
The problem is that when I disconnect the bluetooth link, using the menu selection "Disconnect" on my Android device, the Propeller programs stops looping.
If I remove the above ".rxcheck", the lockup doesn't occur, the Propeller program continues to loop and when I re-establish the BT connection using the menu selection "Connect" on my Android device, the Android program resumes receiving the transmitted data from the Prop.
Clearly something is upsetting the .rxcheck routine but the comments state that:
Any ideas would be appreciated.
Regards,
Mickster
Although not currently receiving data, I have provided for it and it works very well, the following is in the same loop:
Case MC_Com.rxcheck -1: "A": "B": "C": etc., etc.
The problem is that when I disconnect the bluetooth link, using the menu selection "Disconnect" on my Android device, the Propeller programs stops looping.
If I remove the above ".rxcheck", the lockup doesn't occur, the Propeller program continues to loop and when I re-establish the BT connection using the menu selection "Connect" on my Android device, the Android program resumes receiving the transmitted data from the Prop.
Clearly something is upsetting the .rxcheck routine but the comments state that:
'' Check if byte received (never waits)
'' rxbyte returns -1 if no byte received, $00..$FF if byte
Any ideas would be appreciated.
Regards,
Mickster
Comments
Some bluetooth modules send out characters when a connection status changes (ie, a status message). Maybe these characters are interfering with your routine?
Why not insert some debug code to transmit via your prop plug to Parallax serial terminal (PST)?
You could start with adding other: to the case statement and tx out to the PST....
Is this the code for my board? I'll be happy to help if you set me up with the android app I have a couple of Bluetooth adapters.
Regards,
Coely
So the following DOES keep running, no matter what....let me include the other stuff, a bit at a time and I'll post the code that crashes.
Thanks guys.
Regards,
Mickster
P.S. I already suspected that I could be getting a random "X" character which would also kill the loop but I already ruled this out.
As you can see, if the characters A or B or C (it actually keeps going through to H) appear then "GetBendData" is called. My current testing involves receiving nothing so this routine is never called. However, when I break the bluetooth link, "GetBendData" gets called and the hangup occurs because that next repeat loop won't quit until a ";" is received.
If I REM-out all of the calls to GetBendData, I can connect and disconnect without problems but if I un-REM ANY of the GetBendData calls, the program will call it when I disconnect the BT communication.
I will experiment further.
Regards,
Mickster
Just so happens that they coincide with my Case conditions...DOH!, DOH!, DOH!
I'll get me coat :-)
Regards,
Mickster