MATLAB Answers

Simulink GPS serial read from Raspberry pi problems

25 views (last 30 days)
Joop Bree
Joop Bree on 23 Jun 2020
Answered: Prasanth Sunkara on 2 Jul 2020
Hello,
Im having some problems configuring the Lora GPS hat on my Raspberry pi 3 model b+ using simulink. I have configured the raspberry pi using all the support packages from matlab.
The raspberry pi is configured and the Lora GPS does work on the raspberry pi using openshell.
When using
mypi = raspi('ip','login','password');
myserialdevice = serialdev(mypi,'/dev/ttyS0',9600,8) %ttyS0 is the configuration of the lora gps, 9600 the bautrate and 8 the bitlengt
read(myserialdevice,1000,'char') %to get the GPS information in the NMEA format or using
read(myserialdevice,1000,'uint8') %to get the data in raw numbers
The gps does spit out data in the matlab command window.
The only problem is when i try to use the serial read block within simulink, when i configure the serial read in the same way as the myserialdevice. I use this program and run it on the raspberry pi
When i monitor and run this script on the raspberry pi the displays just show zero's, even when i simplify the script with only 2 displays connected to the serial read then the displays still show only zero's.
Hopefully somebody can tell me what wrong or has incountered the same problem some time ago and found a solution.
Thanks in advance!

  0 Comments

Sign in to comment.

Answers (1)

Prasanth Sunkara
Prasanth Sunkara on 2 Jul 2020
Hello Joop,
I believe you are using "Monitor & Tune" to see the signal values while the model is running.
For monitor & tune, please ensure the required signal are logged.
Basically, right click the Serial read output signal and select "Log signal data" and run the Monitor & Tune(external mode) again.
Please let me know if this solves the issue.
Thanks,
Prasanth

  0 Comments

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by