Main Content

Troubleshoot Raspberry Pi in MATLAB Online

Raspberry Pi Is Not Responding

writeLED(mypi,'led0',1)
Failed to receive a response from hardware. Check network connection on Raspberry Pi hardware board.

If you fail to receive a response from the Raspberry Pi® hardware board when executing commands in MATLAB® Online™, try the following fixes:

  • Use raspilist to check the status of your Raspberry Pi. Ensure that your device appears in the output.

  • Check the network connection on your Raspberry Pi board. If you are not using a wired Ethernet connection or you do not have access to a user interface on your device, refer to Setting WiFi up via the command line.

Raspberry Pi Is Not Listed in raspilist Output

If your board does not appear in the output of raspilist, you can specify a larger timeout value. Use a name-value pair argument with raspilist to specify the maximum amount of time (in seconds) to scan for Raspberry Pi hardware boards in MATLAB Online. For example, scan for boards associated with your credentials for up to 20 seconds.

list = raspilist("Timeout",20)

MathWorks Account Credentials Have Expired

If your board does not appear in the output of raspilist, your MathWorks® account credentials may have expired. This happens automatically six months after last device setup. Two weeks before your credentials expire, your device status indicates "Authentication required". To reauthenticate your credentials, append a flag to the package setup command.

  1. If you are using a version of Raspbian with a desktop environment, open a shell to enter the installation commands. If your device boots into the command line, you can enter the installation commands there. You can also access your device via SSH or another remote access method, as described in Remote Access.

  2. To reauthenticate your MathWorks credentials, enter this command. The rest of the settings from the initial setup remain the same.

    $sudo matlab-rpi-setup --login
    Provide your MathWorks Account credentials.
    Email Address or User ID: jsmith 
    Password: ***********

  3. In your MATLAB Online session, run the raspilist function again. Your board now appears in the output list.

    raspilist
    ans =
    
      1x4 table
    
           Name        SerialNumber       PackageVersion          Status
          ______    __________________    ______________    __________________
    
          "myPi"    "00000000a9f2c18c"       "18.1.0"       "Ready to connect"

MATLAB Package on Raspberry Pi Needs to Be Updated

raspilist
ans =

  1x4 table

       Name        SerialNumber       PackageVersion          Status
      ______    __________________    ______________    __________________

      "myPi"    "00000000a9f2c18c"       "18.1.0"       "Upgrade required"
r = raspi("myPi")
Unable to connect to Raspberry Pi hardware board (myPi) because device status is 'Upgrade required'. To see list of available devices and statuses, run 'raspilist'.

If your Raspberry Pi status indicates "Upgrade required", update the MATLAB package on your Raspberry Pi board.

  1. If you are using a version of Raspbian with a desktop environment, open a shell to enter the installation commands. If your device boots into the command line, you can enter the installation commands there. You can also access your device via SSH or another remote access method, as described in Remote Access.

  2. Update the MATLAB package for Raspberry Pi by entering these commands in the Raspberry Pi shell:

    $sudo apt-get update
    $sudo apt-get install matlab-rpi

  3. Follow the steps that appear in your command shell. The rest of the procedure is the same as the instructions in Set Up Raspberry Pi Hardware Board.

Two-Step Verification Is Turned On

If you have Two-Step Verification enabled for your MathWorks Account, you must also enter a verification code when authenticating your account credentials on the Raspberry Pi hardware board. For more information about two-step verification, see Frequently Asked Questions.

  1. If you have two-step verification enabled and you enter your user ID and password when prompted during setup or reauthentication, you get an error message. A verification code is also sent automatically via email, text message, or mobile app depending on the primary method of verification you have set.

    Email Address or User ID: jsmith 
    Password: ******
    Invalid email address/user ID or password.
    Note: If you have two-step verifcation enabled, see troubleshooting documentation for authentication instructions.
  2. Enter your user ID once again. Then, in the password field, enter your password with the verification code appended to it. For example, if your password is "matlab" and your verification code is "456123", enter "matlab456123".

    Email Address or User ID: jsmith 
    Password: ************
    Account credentials successfully authenticated.

    If you have entered the correct credentials, your account is successfully authenticated.

Related Topics