Simulink "Serial Receive" block for Arduino-GPS causes Arduino program to stop

2 views (last 30 days)
Trying to figure out why this block isn't outputting any data or status after following this example. In fact, it stops my arduino from running at all the moment I power the device that communicates through Serial1.
I have a uBlox NEO 6M, supplied with 3.3 v, connected to an Arduino Nano 33 IoT through pins 0 and 1 (Rx and Tx), baud rate for serial1 set to 9600, receiving 32 bytes of uint8 and a uint8 status as per the data sheet, running at a sample rate of 50Hz. The GPS module has LEDs on it indicating that it has locked on to satellites and is recording data.
It seems to work ok using an Arduino IDE example script I got from a NEO 6 library, so I don't suspect a hardware or connection issue. All longitude and lattitude values are reported properly. I also tried using different NANOs and NEO6Ms, as I have multiple modules of each.
As the picture in the example shows, the TX on the GPS is connected to the RX1 pin on the Arduino, and the RX pin of the GPS is connected to the TX1 on the Arduino. As soon as this connection is made, or the GPS is powered, the program executing on the Arduino halts. Of course, in external mode with everything already hooked up, simulink reports being stuck at T = 0.0000s simulation time. If I leave the GPS unplugged, it continues normally but freezes when I plug it in. All the data I get from the gyros etc simply stops reporting. I'm assuming I have something setup incorrectly in MATLAB or Simulink, but scanning through the example, I'm not sure what the issue could be.
I've tried using an external power source without the usb plugged in, the arduino still halts when the GPS is powered (by verifying with a flashing debug led), so I'm not thinking it has anything to do with usb communication. I also tried sending the GPS data to an SD card using build/deploy/run, and also using external mode over WiFi. No matter what, I can't seem to get this Serial Receive block to actually receive anything. It just stops the Arduino.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by