Error using ==> rs232gui

Create new topics, add your comment, remark, bugs...
Simon_says
Posts: 17
Joined: Mon Dec 01, 2008 9:01 pm
Contact:

Error using ==> rs232gui

Postby Simon_says » Mon Mar 23, 2009 6:52 pm

Hello Lubin:

See, I have succesfully connected and send data through rs232 gui from dsPIC to matlab before. However, I have had trouble this time to plot data from the dsPIC. I´ve got the error message below when I try to plot data. What am I doing wrong? Please help! Attached is the model I am using...

jose luis

Connecting... May take few seconds...
Port COM1 successfully open at 115200............OK
redefinition SerialCOM
??? Attempted to access s_control_pos(1); index out of bounds because numel(s_control_pos)=0.

Error in ==> C:\Documents and Settings\123\Escritorio\PICPROG CD\MATLAB BLOCKS\BLOCKS COMPRADOS\install_dsPIC_R2007a_JsOrtizSimonA\blocks\RS232_analyzBloc.p>RS232_analyzBloc at 75


Error in ==> C:\Documents and Settings\123\Escritorio\PICPROG CD\MATLAB BLOCKS\BLOCKS COMPRADOS\install_dsPIC_R2007a_JsOrtizSimonA\blocks\rs232gui.p>pushStart_Callback at 271


Error in ==> gui_mainfcn at 95
feval(varargin{:});

Error in ==> C:\Documents and Settings\123\Escritorio\PICPROG CD\MATLAB BLOCKS\BLOCKS COMPRADOS\install_dsPIC_R2007a_JsOrtizSimonA\blocks\rs232gui.p>rs232gui at 43


??? Error using ==> rs232gui('pushStart_Callback',gcbo,[],guidata(gcbo))
Attempted to access s_control_pos(1); index out of bounds because numel(s_control_pos)=0.

??? Error while evaluating uicontrol Callback
Attachments
PID20ejeYanalnivels.mdl
(36.84 KiB) Downloaded 181 times

LubinKerhuel
Site Admin - Expert
Posts: 616
Joined: Wed Mar 07, 2007 11:23 pm
Location: Marseille - France
Contact:

Re: Error using ==> rs232gui

Postby LubinKerhuel » Mon Mar 23, 2009 10:46 pm

Hi Jose Luis,

You model has an original blocks disposition. I'll probably get inspired from it.
shot_20090323223845-140.png
Jose Luis's model


Anyway, I do not see errors.
When does the error appears ? at the connexion time or when you click on start ? Let me know...
If it appears when you click on start, there may be problems with bauds. You computer's serial port may be not tolerant enough to baud errors.
The % error of the UART@115200 is 1.7%. It should be Ok in most case. Anyway, you may try using a 57600 bauds that will have an negative error (-1.3%). bauds of 38400 will also offer even less error...

The problem may come from the electronic max232 like level translator.

You may try to receive data as raw datas (button raw). But as the data will not be demultiplexed, you will get a nice mess...

I do not know if that will help so much. I have hardly no problem with this interface. My feeling is that it is quite robust now.

Lubin

Simon_says
Posts: 17
Joined: Mon Dec 01, 2008 9:01 pm
Contact:

Re: Error using ==> rs232gui

Postby Simon_says » Fri Mar 27, 2009 6:38 pm

Hello Lubin,
You see, the error appears several seconds after I press start. The UART has a succesful connection, then I press start and it seems like waiting for information. It takes 20 or 30 seconds and then the error appear. It is odd because sometimes it works and sometimes it dos not. I am testing the system with the 57600 and the 38400 baud rate. So far, so good. I´ll post if an error comes up!

Thanks a lot!

Jose Luis

Simon_says
Posts: 17
Joined: Mon Dec 01, 2008 9:01 pm
Contact:

Re: Error using ==> rs232gui

Postby Simon_says » Thu May 28, 2009 10:50 pm

Hello every one!
Hi Lubin... I am still getting the same problem when trying to log data on matlab wit the RS232gui.... this is the error I get:



Connecting... May take few seconds...
Port COM1 successfully open at 2400............OK
redefinition SerialCOM
??? Error using ==> plus
Matrix dimensions must agree.

Error in ==> C:\Documents and Settings\123\Escritorio\PICPROG CD\MATLAB BLOCKS\BLOCKS COMPRADOS\install_dsPIC_R2007a_JsOrtizSimonA\blocks\RS232_analyzBloc.p>RS232_analyzBloc at 117


Error in ==> C:\Documents and Settings\123\Escritorio\PICPROG CD\MATLAB BLOCKS\BLOCKS COMPRADOS\install_dsPIC_R2007a_JsOrtizSimonA\blocks\rs232gui.p>pushStart_Callback at 271


Error in ==> gui_mainfcn at 95
feval(varargin{:});

Error in ==> C:\Documents and Settings\123\Escritorio\PICPROG CD\MATLAB BLOCKS\BLOCKS COMPRADOS\install_dsPIC_R2007a_JsOrtizSimonA\blocks\rs232gui.p>rs232gui at 43


??? Error using ==> rs232gui('pushStart_Callback',gcbo,[],guidata(gcbo))
Error using ==> plus
Matrix dimensions must agree.

??? Error while evaluating uicontrol Callback

>>

And this is the model I am working with. It is a servomotor controller using force feedback to move a load. It is kind of big, but if you look at it, focus on the RS232 data transmission blocks. The model is running well, but can not see the graph. I have tried all the baud rates unsuccesfully. However, I have tried a different model ( a smaller one) and the communication works fine!!!! Can anyone help me?
Thanks a lot!

Jose Luis
Attachments
PID23y.mdl
(90.39 KiB) Downloaded 210 times

Simon_says
Posts: 17
Joined: Mon Dec 01, 2008 9:01 pm
Contact:

Re: Error using ==> rs232gui

Postby Simon_says » Fri May 29, 2009 8:48 pm

Hello Lubin. Thanks for the updated blockset. I have installed it and try them with the same model. After I pressed start it seemed to work fine , but after 2 or 3 seconds I got this:

Port COM1 successfully open at 1200............OK
redefinition SerialCOM
??? Error using ==> plus
Matrix dimensions must agree.

Error in ==> C:\Documents and Settings\123\Escritorio\PICPROG CD\MATLAB BLOCKS\install_dsPIC_R2007a_JsOrtizSimon Updated\blocks\RS232_analyzBloc.p>RS232_analyzBloc at 120


Error in ==> C:\Documents and Settings\123\Escritorio\PICPROG CD\MATLAB BLOCKS\install_dsPIC_R2007a_JsOrtizSimon Updated\blocks\rs232gui.p>pushStart_Callback at 271


Error in ==> gui_mainfcn at 95
feval(varargin{:});

Error in ==> C:\Documents and Settings\123\Escritorio\PICPROG CD\MATLAB BLOCKS\install_dsPIC_R2007a_JsOrtizSimon Updated\blocks\rs232gui.p>rs232gui at 43


??? Error using ==> rs232gui('pushStart_Callback',gcbo,[],guidata(gcbo))
Error using ==> plus
Matrix dimensions must agree.


Here the first data recorded until crash and get the error message. Odd isn´t it?
jose luis
Attachments
first try.JPG
first try.JPG (51.58 KiB) Viewed 4409 times

LubinKerhuel
Site Admin - Expert
Posts: 616
Joined: Wed Mar 07, 2007 11:23 pm
Location: Marseille - France
Contact:

Re: Error using ==> rs232gui

Postby LubinKerhuel » Fri May 29, 2009 11:27 pm

Hi Jose Luis,

I find the error ;-)

You are using the internal RC oscillator of the dsPIC. (FRC for Fast RC oscillator). It is very difficult to make the UART works properly with such oscillaotr as it is not precise enough (to my experience). Even if the dsPIC is supposed to run at 30MIPS (7.5MHz RC oscillator, with PLL 16, divided by 4 cycles/instructions).

I can suggest the following :
- add an external quartz or oscillator ! that is much better

If not possible, you may try to find the frequency : generate a simulink for dsPIC generating a 1ms clock signal, and measure with you scope the real signal, note T the measured time. You may now compute the real MIPS of the microcontroller :
multiply the number of Instruction per Second (in the master block) by (1ms/T)
and repport this MIPS in the MASTER block (The true generated signal must be 1ms now ! ). Then, find an UART baud rate with a small % error (as indicated in the UART config block).

Note however that even if it works for a while, as the temperature will change, the RC oscillator frequency will swift and you will have to do again the calibration process.

Lubin

Simon_says
Posts: 17
Joined: Mon Dec 01, 2008 9:01 pm
Contact:

Re: Error using ==> rs232gui

Postby Simon_says » Tue Jun 02, 2009 11:43 pm

Hi Lubin!

You were right!!!
I did use a cristal instead of internal clock. Now I can even see multiple inputs in the ADC. I am still working with 30MIPS and use a baud rate of 115200b . It really works!

I am still testing it, but so far so good!!!
Thanks for your support!!

Jose Luis


Return to “General Remark and Questions”

Who is online

Users browsing this forum: No registered users and 2 guests