Problem with rs232gui
Problem with rs232gui
Hello,
I have a problem with the rs232gui that I'm trying to solve for a long time.
I'm using a dspic30f4011, but i also tested it with dspic33fj256.
when I'm trying to start the rs232gui, it stops immediately and show error in the command window.
This is the model that I'm testing: (I've tried a lot of models, including sending a constant number)
This is the Error that i get: I'm using Matlab 2010b and blockset v3.7
What could be the problem?
Thanks,
Alpert
I have a problem with the rs232gui that I'm trying to solve for a long time.
I'm using a dspic30f4011, but i also tested it with dspic33fj256.
when I'm trying to start the rs232gui, it stops immediately and show error in the command window.
This is the model that I'm testing: (I've tried a lot of models, including sending a constant number)
This is the Error that i get: I'm using Matlab 2010b and blockset v3.7
What could be the problem?
Thanks,
Alpert
-
- Site Admin - Expert
- Posts: 616
- Joined: Wed Mar 07, 2007 11:23 pm
- Location: Bayonne- France
- Contact:
Re: Problem with rs232gui
Alpert, you might try to press the Raw data button in the rs232gui interface.
No decoding will be done, you should get 1 control byte, and 1 value 1 control byte, 1 value etc....
Check that control byte is constant value, and that value is moving correctly (as it is an uint8, it does not need "reconstruction".)
You might check that your quartz is a 2.5MHz precisely.
Try removing I2C preipheral for testing UART only (IC2 will create problems if the I2C composant does not respond as it will freeze the software until timout take over the control)
The, try using a higher bandwidth (here, bandwidth is slow, but the UART is fully load as you try to send 2 char within one time step (1 control byte, 1 uint8 value) ) and the baud rate is too slow to send two byes within 1ms.
Try to get a baud rate for the UART with the lower % error possible (use PLL or change your quartz if necessary).
Note that the protocol used works better when sending several values, and when values are moving (as it makes control byte easier to find out the stream).
Lubin
No decoding will be done, you should get 1 control byte, and 1 value 1 control byte, 1 value etc....
Check that control byte is constant value, and that value is moving correctly (as it is an uint8, it does not need "reconstruction".)
You might check that your quartz is a 2.5MHz precisely.
Try removing I2C preipheral for testing UART only (IC2 will create problems if the I2C composant does not respond as it will freeze the software until timout take over the control)
The, try using a higher bandwidth (here, bandwidth is slow, but the UART is fully load as you try to send 2 char within one time step (1 control byte, 1 uint8 value) ) and the baud rate is too slow to send two byes within 1ms.
Try to get a baud rate for the UART with the lower % error possible (use PLL or change your quartz if necessary).
Note that the protocol used works better when sending several values, and when values are moving (as it makes control byte easier to find out the stream).
Lubin
Re: Problem with rs232gui
Hello Lubin,
Thanks for your answer, and by the way, grate job with the blockset!
I have done a lot of experiments, and eventually I've discovered the problem.
I have done those steps:
1) I made a simple program (using your Simulink Blockset) that sand a constant number via the "Tx Output" block (not the gui), and I've set the "UART Configuration" to send at 115200 bps.
2) I connected my DSPic33 UART to my laptop and i watched the incoming data with "Realterm", and i changed the baud rate until i got on the screen the same number that i have send. The baud rate was 30,000.
3) I've made a new program. this time i've sent the data using the "TX Output Multiplexed for Matlab / Labview" block. again, I've set the "UART Configuration" to send at 115200 bps. then, i opened the rs232gui and i set it to recieve the data at 30,000. It worked!!!.
What could cause the different between the desirable baud rate and the actual baud rate? Why does it send at 30000bps when i set it to 115200?
I am attaching a simulink model that sample IMU sensors and send them using the "Tx Output". I'll appreciate if you look at it and see if i've done something wrong.
Thanks,
Alpert.
Thanks for your answer, and by the way, grate job with the blockset!
I have done a lot of experiments, and eventually I've discovered the problem.
I have done those steps:
1) I made a simple program (using your Simulink Blockset) that sand a constant number via the "Tx Output" block (not the gui), and I've set the "UART Configuration" to send at 115200 bps.
2) I connected my DSPic33 UART to my laptop and i watched the incoming data with "Realterm", and i changed the baud rate until i got on the screen the same number that i have send. The baud rate was 30,000.
3) I've made a new program. this time i've sent the data using the "TX Output Multiplexed for Matlab / Labview" block. again, I've set the "UART Configuration" to send at 115200 bps. then, i opened the rs232gui and i set it to recieve the data at 30,000. It worked!!!.
What could cause the different between the desirable baud rate and the actual baud rate? Why does it send at 30000bps when i set it to 115200?
I am attaching a simulink model that sample IMU sensors and send them using the "Tx Output". I'll appreciate if you look at it and see if i've done something wrong.
Thanks,
Alpert.
- Attachments
-
- ex8.mdl
- (74.09 KiB) Downloaded 1594 times
-
- Site Admin - Expert
- Posts: 616
- Joined: Wed Mar 07, 2007 11:23 pm
- Location: Bayonne- France
- Contact:
Re: Problem with rs232gui
Alpert,
With your quartz and no PLL, you get a 1.73% error on the UART baud rate.
This usually works but might be the problem(depending on your computer's hardware).
Try to activete PLL and find a processor speed that would lower the UART baud rate error (below 1% should be Ok !).
"2) I connected my DSPic33 UART to my laptop and i watched the incoming data with "Realterm", and i changed the baud rate until i got on the screen the same number that i have send. The baud rate was 30,000."
This is weird, but this is not a strong proof as if you're lucky enough, the UART will sample the signal and retrive the pattern corresponding to your constant. Please send an incrementing value and check you get abcdefg.... 12345... ABCD... on realterm. This is much better for testing.
Let me know if your finding is the same then.
Are you testing the Sparkfun UDB4 board ?
Lubin
With your quartz and no PLL, you get a 1.73% error on the UART baud rate.
This usually works but might be the problem(depending on your computer's hardware).
Try to activete PLL and find a processor speed that would lower the UART baud rate error (below 1% should be Ok !).
"2) I connected my DSPic33 UART to my laptop and i watched the incoming data with "Realterm", and i changed the baud rate until i got on the screen the same number that i have send. The baud rate was 30,000."
This is weird, but this is not a strong proof as if you're lucky enough, the UART will sample the signal and retrive the pattern corresponding to your constant. Please send an incrementing value and check you get abcdefg.... 12345... ABCD... on realterm. This is much better for testing.
Let me know if your finding is the same then.
Are you testing the Sparkfun UDB4 board ?
Lubin
Re: Problem with rs232gui
Hi Lubin,
Thank you for your answer. I'll do some testing tomorrow morning.
I'm using now the sparkfun UDB4, but I have the same problem with the "Gluon Pilot" board.
Alpert.
Thank you for your answer. I'll do some testing tomorrow morning.
I'm using now the sparkfun UDB4, but I have the same problem with the "Gluon Pilot" board.
Alpert.
-
- Site Admin - Expert
- Posts: 616
- Joined: Wed Mar 07, 2007 11:23 pm
- Location: Bayonne- France
- Contact:
Re: Problem with rs232gui
I am willing to test this board.
First task for me is to embed a bootloader that would be quite practical.
I am planning to use the ds30 loader... then, using the clock switching option from the blockset, you could use the board very efficiently...
Lubin
First task for me is to embed a bootloader that would be quite practical.
I am planning to use the ds30 loader... then, using the clock switching option from the blockset, you could use the board very efficiently...
Lubin
Re: Problem with rs232gui
Hello,
Bootloader for the UDB4 can be very useful !
I'm not familiar with the clock switching block. I'm not sure that i have it.
Until now I have check the Gyros and the Accelerometers on that board and the works fine. I have a problem withe the I2C, but i still not sure what cause that problem. i need to inspect it.
Bootloader for the UDB4 can be very useful !
I'm not familiar with the clock switching block. I'm not sure that i have it.
Until now I have check the Gyros and the Accelerometers on that board and the works fine. I have a problem withe the I2C, but i still not sure what cause that problem. i need to inspect it.
-
- Site Admin - Expert
- Posts: 616
- Joined: Wed Mar 07, 2007 11:23 pm
- Location: Bayonne- France
- Contact:
Re: Problem with rs232gui
Hello Lior,
I get one board. I am willing to use it for personal project but I am quite overloaded right now.
You have clock switch options (something like) in the Master block.
this board has a 8MhZ quartz, not a 7.5 MhZ ?
I2C is always difficult to set-up!
Lubin
I get one board. I am willing to use it for personal project but I am quite overloaded right now.
You have clock switch options (something like) in the Master block.
this board has a 8MhZ quartz, not a 7.5 MhZ ?
I2C is always difficult to set-up!
Lubin
Re: Problem with rs232gui
Hello,
I have done another test like you suggested. I've activated the PLL and I change the baud rate on the "UART Configuration" block, until i got in "Realterm" the same word that i've send from the simulink.
I've found that i need to set the block to 202700bps if i want it to send in 115200bps.
Here is the model: here is what i got in Realterm:
Its really weird..
I have done another test like you suggested. I've activated the PLL and I change the baud rate on the "UART Configuration" block, until i got in "Realterm" the same word that i've send from the simulink.
I've found that i need to set the block to 202700bps if i want it to send in 115200bps.
Here is the model: here is what i got in Realterm:
Its really weird..
-
- Site Admin - Expert
- Posts: 616
- Joined: Wed Mar 07, 2007 11:23 pm
- Location: Bayonne- France
- Contact:
Re: Problem with rs232gui
In Master block, is there any reason why the quartz is set to 14Mhz this time ?
It should be 8Mhz !
Try to make one led blinking at 1Hz.
If it's not blinking at 1Hz, you have a problem with the oscillator configuration (thus UART cant be set at the appropriate baud rate)
Lubin
It should be 8Mhz !
Try to make one led blinking at 1Hz.
If it's not blinking at 1Hz, you have a problem with the oscillator configuration (thus UART cant be set at the appropriate baud rate)
Lubin
-
- Site Admin - Expert
- Posts: 616
- Joined: Wed Mar 07, 2007 11:23 pm
- Location: Bayonne- France
- Contact:
Re: Problem with rs232gui
Lior,
I did very first test with UDB4 board.
the attach model send Rate gyro and Accelerometers values through UART correctly using appropriate PLL value. This is just for testing (plotting sensor in pseudo-real time). Note that baud rate used do not allow logging all 6 axis at 1kHz.
Lubin
I did very first test with UDB4 board.
the attach model send Rate gyro and Accelerometers values through UART correctly using appropriate PLL value. This is just for testing (plotting sensor in pseudo-real time). Note that baud rate used do not allow logging all 6 axis at 1kHz.
Lubin
Re: Problem with rs232gui
Hello Lubin,
You were absolutely right about the clock. Yesterday I've done the test that you suggested with the 1Hz led, and i realized that my configuration of the clock were wrong. After i fixed that everything worked fine.
Thank you very much! You have done really grate job with your block set!
I hope not to write anymore at this part of the forum (Bug report).
Lior
You were absolutely right about the clock. Yesterday I've done the test that you suggested with the 1Hz led, and i realized that my configuration of the clock were wrong. After i fixed that everything worked fine.
Thank you very much! You have done really grate job with your block set!
I hope not to write anymore at this part of the forum (Bug report).
Lior
-
- Site Admin - Expert
- Posts: 616
- Joined: Wed Mar 07, 2007 11:23 pm
- Location: Bayonne- France
- Contact:
Re: Problem with rs232gui
I attached here the binary to use the bootloader ds30 (from Mikael Gustafsson) with the UDB4 board:
==> Load this .hex into the board using classical programmer
==> then, use the ds30 GUI interface to upload new .hex. (Bootloader will be maintained on the board)
Bootloader binary is configured to use the UART2 (accessible on the board) at 115200.
Clock switching is enable (i.e. Simulink model to be loaded with the Bootloader might use any clock provided Clock Switching Enable is on in Master Block.)
Also attached is an update of the previous simulink model for UDB4 tailored for easy used with bootloader (no need to reboot the board : first attempt to program the board will stop the embedded software. Secodn attempt will effectively program it.):
Lubin
==> Load this .hex into the board using classical programmer
==> then, use the ds30 GUI interface to upload new .hex. (Bootloader will be maintained on the board)
Bootloader binary is configured to use the UART2 (accessible on the board) at 115200.
Clock switching is enable (i.e. Simulink model to be loaded with the Bootloader might use any clock provided Clock Switching Enable is on in Master Block.)
Also attached is an update of the previous simulink model for UDB4 tailored for easy used with bootloader (no need to reboot the board : first attempt to program the board will stop the embedded software. Secodn attempt will effectively program it.):
Lubin
Who is online
Users browsing this forum: No registered users and 5 guests