failure to connect with raspberry pi 4 with 'raspi'

33 visualizzazioni (ultimi 30 giorni)
Ran Zeimer
Ran Zeimer il 7 Dic 2025 alle 1:27
Commentato: Taylor circa 11 ore fa
when using raspi for a new connection i get an error that gpiod.h is not found.
i have followed all the suggections of copilot at no avail.

Risposte (3)

Taylor
Taylor il 8 Dic 2025 alle 16:43
Have you installed the required support package?
  1 Commento
Ran Zeimer
Ran Zeimer il 8 Dic 2025 alle 21:58
Spostato: Walter Roberson il 9 Dic 2025 alle 16:20
I have installed the support package for matlab not simulink as i dont use simulink

Accedi per commentare.


Ran Zeimer
Ran Zeimer il 9 Dic 2025 alle 0:42
is this correct that matlab-rpi is only compatible with
raspian stretch and Jessier?
  2 Commenti
Taylor
Taylor il 9 Dic 2025 alle 16:10
Try
% Run this on your Raspberry Pi, NOT MATLAB
sudo apt-get update
sudo apt-get install gpiod libgpiod-dev
This will install command line tools and install header files and libraries. Then try connecting to the Raspberry Pi again.
Walter Roberson
Walter Roberson il 9 Dic 2025 alle 16:29
  • 32-bit Buster OS
  • 32-bit and 64-bit Bullseye OS
  • 32-bit and 64-bit Bookworm OS
The support for Stretch was roughly R2021b. Jessie support started from R2016a (but ended before R2021b.)

Accedi per commentare.


Ran Zeimer
Ran Zeimer il 10 Dic 2025 alle 1:19
when i run
% Run this on your Raspberry Pi, NOT MATLAB
sudo apt-get update
sudo apt-get install gpiod libgpiod-dev
it looks like it is installed with the last version
when i call mypi=raspi(....)
I get
>> mypi=raspi('192.168.40.165','ran','2952');
### Updating Raspberry Pi I/O server...
### Connecting to board...
### Connected to 192.168.40.165...
### Creating server folder...
Error executing command "sudo make -C /opt/MATLAB/mw_server_v25.1.0
SERVER_DIR=/opt/MATLAB/mw_server_v25.1.0 -f Makefile_raspiPeriphs". Details:
STDERR: MW_SocketCAN.c: In function ‘int32_T MW_CAN_InitSocket(const char*,
int32_T, int32_T)’:
MW_SocketCAN.c:265:1: warning: no return statement in function returning
non-void [-Wreturn-type]
265 | }
| ^
MW_gpio.c: In function ‘int EXT_GPIO_init(unsigned int, uint8_T)’:
MW_gpio.c:34:20: error: ‘gpiod_chip_open_by_name’ was not declared in this
scope; did you mean ‘gpiod_chip_info_get_name’?
34 | gpioChip = gpiod_chip_open_by_name(GPIO_CHIP_NAME);
| ^~~~~~~~~~~~~~~~~~~~~~~
| gpiod_chip_info_get_name
MW_gpio.c:45:13: error: ‘gpiod_line_release’ was not declared in this scope;
did you mean ‘gpiod_line_request’?
45 | gpiod_line_release(existingGpioInfo->line);
| ^~~~~~~~~~~~~~~~~~
| gpiod_line_request
MW_gpio.c:50:31: error: ‘gpiod_chip_get_line’ was not declared in this scope;
did you mean ‘gpiod_chip_get_info’?
50 | struct gpiod_line *line = gpiod_chip_get_line(gpioChip, gpio);
| ^~~~~~~~~~~~~~~~~~~
| gpiod_chip_get_info
MW_gpio.c:56:15: error: ‘gpiod_line_request_output’ was not declared in this
scope; did you mean ‘gpiod_line_request_get_fd’?
56 | gpiod_line_request_output(line, "gpio_app", 0) :
| ^~~~~~~~~~~~~~~~~~~~~~~~~
| gpiod_line_request_get_fd
MW_gpio.c:57:15: error: ‘gpiod_line_request_input’ was not declared in this
scope; did you mean ‘gpiod_line_request_get_fd’?
57 | gpiod_line_request_input(line, "gpio_app");
| ^~~~~~~~~~~~~~~~~~~~~~~~
| gpiod_line_request_get_fd
MW_gpio.c: In function ‘int EXT_GPIO_terminate(unsigned int)’:
MW_gpio.c:81:13: error: ‘gpiod_line_release’ was not declared in this scope;
did you mean ‘gpiod_line_request’?
81 | gpiod_line_release(gpioInfos[i].line);
| ^~~~~~~~~~~~~~~~~~
| gpiod_line_request
MW_gpio.c: In function ‘int EXT_GPIO_read(unsigned int, boolean_T*)’:
MW_gpio.c:122:15: error: ‘gpiod_line_get_value’ was not declared in this
scope; did you mean ‘gpiod_line_value’?
122 | int val = gpiod_line_get_value(gpioInfo->line);
| ^~~~~~~~~~~~~~~~~~~~
| gpiod_line_value
MW_gpio.c: In function ‘int EXT_GPIO_write(unsigned int, boolean_T)’:
MW_gpio.c:135:15: error: ‘gpiod_line_set_value’ was not declared in this
scope; did you mean ‘gpiod_line_value’?
135 | int ret = gpiod_line_set_value(gpioInfo->line, value);
| ^~~~~~~~~~~~~~~~~~~~
| gpiod_line_value
make: *** [Makefile_raspiPeriphs:228: MW_gpio.c.o] Error 1
  1 Commento
Taylor
Taylor circa un'ora fa
Sounds like an libgpiod API mismatch. Start by confirming what version you have on the Raspberry Pi. Again, run the following code in SSH/terminal not MATLAB
# Shows the version provided by pkg-config (if installed)
pkg-config --modversion libgpiod || echo "pkg-config not found"
# Shows installed and candidate versions
apt-cache policy libgpiod-dev libgpiod2
# Peek at the header to see which API it exposes
grep -n "gpiod_line_request_output" /usr/include/gpiod.h || echo "v1 symbol not found"
grep -n "gpiod_line_settings_new" /usr/include/gpiod.h || echo "v2-only symbol not found"
If you see 2.x in apt-cache policy and the header lacks gpiod_line_request_output, you’re on libgpiod v2 headers. MATLAB’s server expects v1 symbols; v2 is not source-compatible with those calls. To install the v1 headers:
sudo apt-get update
# Install (or reinstall) the v1 dev and runtime packages from the current repo
# On Raspberry Pi OS Bookworm these resolve to 1.6.3
sudo apt-get install --yes --allow-downgrades libgpiod-dev libgpiod2
# (Optional) prevent an unintended upgrade to v2 later
sudo apt-mark hold libgpiod-dev libgpiod2
Then reconnect to your board with the raspi command in MATLAB.

Accedi per commentare.

Categorie

Scopri di più su Introduction to Installation and Licensing in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by