disableCAN - Disable CAN interface - MATLAB (original) (raw)
Disable CAN interface
Since R2021b
Syntax
Description
disableCAN([raspiObj](#mw%5F4683246a-463a-42ab-bae0-06f93424fddd))
disables thecan0
interface for MCP2515 CAN controller. To enable CAN, useenableCAN.
disableCAN([raspiObj](#mw%5F4683246a-463a-42ab-bae0-06f93424fddd),[deviceName](#mw%5F31225f79-b57f-4293-9593-342424c42694))
disables the can0
interface for a device. To enable CAN, useenableCAN.
disableCAN([raspiObj](#mw%5F4683246a-463a-42ab-bae0-06f93424fddd),[deviceName](#mw%5F31225f79-b57f-4293-9593-342424c42694),[interfaceName](#mw%5Feff856d3-e779-431c-8472-c39c08c7f91f))
disables a CAN interface for MCP2515 CAN controller. To enable CAN, use enableCAN.
Examples
Disable CAN Object
To disable a CAN object, create a Raspberry PiĀ® object. AvailableCANInterfaces
is empty before the CAN object is enabled.
raspiObj = raspi("192.168.1.101","pi","raspberry")
raspiObj =
raspi with properties:
DeviceAddress: '192.168.1.101'
Port: 18734
BoardName: 'Raspberry Pi 3 Model B+'
AvailableLEDs: {'led0'}
AvailableDigitalPins: [4,5,6,10,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]
AvailableSPIChannels: {'CE1'}
AvailableI2CBuses: {'i2c-0','i2c-1'}
AvailableWebcams: {}
I2CBusSpeed: 100000
AvailableCANInterfaces: {"can0"}
Supported peripherals
Disable the CAN interface.
Reboot the Raspberry Pi to apply the changes.
system(raspiObj, 'sudo reboot')
Connection to SSH server at 192.168.1.101
is closed. Clear the hardware communication object and re-create it to establish connection.
clear raspiObj
raspiObj = raspi("192.168.1.101","pi","raspberry")
raspiObj =
raspi with properties:
DeviceAddress: '192.168.1.101'
Port: 18734
BoardName: 'Raspberry Pi 3 Model B+'
AvailableLEDs: {'led0'}
AvailableDigitalPins: [4,5,6,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]
AvailableSPIChannels: {'CE0','CE1'}
AvailableI2CBuses: {'i2c-0','i2c-1'}
AvailableWebcams: {}
I2CBusSpeed: 100000
AvailableCANInterfaces: {}
Supported peripherals
Input Arguments
Connection to a Raspberry Pi hardware board, specified as a raspi object.
Data Types: object
The default CAN controller available is MCP2515
.
Example: MCP2515
Data Types: string
CAN interface, specified as either can0
orcan1
.
Example: can0
Data Types: string
Note
Disabling can0
interface will disable can1
and can0
.
Version History
Introduced in R2021b