Page 1 of 1

GUI in Matlab2010a with virtual Com port problem

Posted: Wed Apr 21, 2010 9:25 pm
by Ender

I'm using a Bluetooth bridge for monitoring for 2 years now.
With other Matlab version there was no issue to start the connection; but with Matlab2010 impossible to have a correct answer by using the 'Connexion' button in the GUI.

When I use my own Labview GUI the 'Com' port is linked and the monitoring still works fine.
Sure I don't have problem with the classic wired RS232, in Matlab2010 too.
I test with different Bluetooth devices on different computer.
So maybe, the latency or the something is different in this new Matlab version and it doesn't work anymore with the virtual serial port.

Are you still using the GUI with wireless link, like before on your flying projects?
Is it a Bluetooth link ?
Could you test the GUI with matlab2010 and a virtual com port ?

This is not hurry for me, it's just to advice other user using virtual serial Com port before to update Matlab.


Re: GUI in Matlab2010a with virtual Com port problem

Posted: Thu Apr 22, 2010 12:56 am
by LubinKerhuel
I did not test yet bluetooth virtual COM port with matlab 2010a.
Are you using a mablab 32 or 64 bits ?

I think that matlab serial connections rely on java. Thus, you may try updating java version (see matlab help to change matlab java)

Anyway, from my former experiment (planes and robots with bootloader), bluetooth virtual COM port using software bluetooth stack is working, but is sometime tricky.

To obtain a more comfortable bluetooth connection, you may use on the PC side an hardware bluetooth2serial adapter, (like free2move) and if no serial ports are available on the PC, using a ftdi serial2usb adapter.
Thus, you need 1 bluetooth and one serial adapter on the PC side like FTDI adapter.
This is more expensive than a bluetooth donble, but will avoid using a software bluetooth stack.

What parts are you using (just for information)


Re: GUI in Matlab2010a with virtual Com port problem

Posted: Thu Apr 22, 2010 11:41 pm
by Ender
I'm using a Free2move F2M03GLA SPP on the Dspic, and different computers and Bluetooth modules; include USB modules or free2move F2M03GLA HCI, for 4 years now on different microcontroller and for 2 years with the DSPsic and your GUI.

Yes, because the RS232 works fine, I'm sure your idea to use a USB to RS232 + RS232 to Bluetooth works, but It's not comfortable. I'll use my Labview GUI for right now, thanks.

I didn't know Matlab use Java for it, It was a good idea so I updated java 6 from update 17 to 20, and I still get the same messages, it can't open the port :

Code: Select all

[size=85][color=#FF0040]Connecting... May take few seconds...
??? Error using ==> serial.fopen at 72
Cannot connect to the COM10 port. Possible reasons are another
application is connected to the port or the port does not exist.

Error in ==> C:\Users\Thierry\Documents\MATLAB\XXX_Dspic\blocks\rs232gui.p>pushConnexion_Callback at 122

Error in ==> gui_mainfcn at 96

Error in ==> C:\Users\Thierry\Documents\MATLAB\XXX_Dspic\blocks\rs232gui.p>rs232gui at 43

??? Error while evaluating uicontrol Callback

>> [/color][/size]
Another think, Matlab 2010a, is more case sensitive for the character then the precedent version. I had to change some of my code like from "False" to "false" for Boolean type, because the uppercase made a issue.
And I got some warning about this too, I thing one was about the GUI but I can't cause it again, example :
Warning: Could not find an exact (case-sensitive) match for 'ExecBatch'.
C:\Users\Thierry\Documents\MATLAB\XXX_Dspic\dspic\execBatch.p is a case-insensitive match and will be
used instead.
You can improve the performance of your code by using exact
name matches and we therefore recommend that you update your
usage accordingly. Alternatively, you can disable this warning using
This warning will become an error in future releases.

Re: GUI in Matlab2010a with virtual Com port problem

Posted: Fri Apr 23, 2010 12:07 am
by LubinKerhuel
There is a trick with matlab to make matlab use another java version:
See: this mathworks page

Anyway, I doubt that using another java version will solve the problem.

Are you decoding frames from the Tx_Output_Multiplexed_For_Matlab-Labview block with Labview?

I did Labview decoding blocks a about 5 years ago. It was working pretty well, the Labview interface is much better to view real time data. I can provide theses Labview model if it can help.
Anyway, protocol used by the Tx_Output_Multiplexed_For_Matlab-Labview block is described (in french) on this website (not updated anymore).

Re: GUI in Matlab2010a with virtual Com port problem

Posted: Fri Apr 23, 2010 4:01 pm
by Ender
Yes, I’m using the Tx_Output_Multiplexed_For_Matlab-Labview block with Labview. I never try the other block to send data with the UART. This code is 2 years old when I start with your tool, I thought the protocol was too basic, my idea was too write another one with checksum and time mark , or to try to win few bits in the transmission because the free2move Bluetooth is limited at 300Kb/s and I was interested to use just 2.5 bytes, to send 1 Uint16 rather than 3 bytes. But I have worked on something else and I never improve this code. I preferred to use your GUI.

Yes, I’m interested by your Labview code to compare your syncronisation code with mine please.

I used two ways , nothing was perfect:
The synchronization on the 05 header was done just one time when I start, when I try to re-synchronize on the fly, the code was not efficient enough. The code was looking for redundancy at the header mark and if it was doing while the display was update, it got latency and lost bytes because the display had to work with too munch dots.
I have tried another way too, by writing the data directly in a files or memory. With a little shift to display then after decimating the value to get a fast display with less accuracy. This work well and I added functions to save/read and to export the data in mat file. But I got a problem of memory busy in Labview when I try to record too much time by this way. (I was interested to record 20min :wink: ) I didn’t find the way to release enough memory even though I write the file on the hard drive by segment and try to keep just small table in memory.

Re: GUI in Matlab2010a with virtual Com port problem

Posted: Mon Apr 26, 2010 1:34 am
by LubinKerhuel
I uploaded my "old" labview schema on the wiki :
bottom of page : ... ab-Labview

Tell me if you can't open it. I did it using an old labview (like 6 or 6.5). Old labview models are sometimes difficult to convert to newer labview version.
I may find more recent copy of it.
(I have no currently labview installed there)


Re: GUI in Matlab2010a with virtual Com port problem

Posted: Wed Apr 28, 2010 2:51 am
by Ender
I'm using Labview 8.5 (so 2007 or 2008 release I think) and it didn't display advices or anything when it was opening, everything seem fine.

Re: GUI in Matlab2010a with virtual Com port problem

Posted: Tue Oct 26, 2010 11:18 pm
by Vladimir
I have a problem with Tx-MatLab Block, I can't read the port, in the MatLab command window appears this error:

??? Attempted to access s_control_pos(1); index
out of bounds because numel(s_control_pos)=0.
Error in ==> C:\Documents and Settings\Vladi\My
at 78
Error in ==> C:\Documents and Settings\Vladi\My
at 271
Error in ==> gui_mainfcn at 96
Error in ==> C:\Documents and Settings\Vladi\My
Documents\MATLAB\blocks\rs232gui.p>rs232gui at 43
??? Error while evaluating uicontrol Callback