An example SFunction block for Raspberry Pi showing basic usage of the WiringPi library
The latest version of this file and others can be found at our Raspberry Pi downloads page:
http://minseg.webs.com/downloads
A complete Arduino library and curriculum is available here:
http://minseg.com/pages/downloads
coming soon:
- PWM
- Quadrature Encoder
- MPU6050
and others!
Joshua Hurst (2021). Raspberry Pi Driver Block SFunction (https://www.mathworks.com/matlabcentral/fileexchange/41491-raspberry-pi-driver-block-sfunction), MATLAB Central File Exchange. Retrieved .
Inspired by: Device Drivers
Inspired: Raspberry Pi and Arduino Serial Communication, netHAT EtherCAT Slave Block SFunction for Raspberry Pi, Raspberry Pi Simulink Driver Blocks ADC DAC PWM, Simple EtherCAT Master Block SFunction for Raspberry Pi
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Create scripts with code, output, and formatted text in a single executable document.
When i opened that file (Raspberry Pi Driver Block SFunction)and press build bottom in S-function then i connect rpi3b to matlab2017a and add wiringPi and anyfile that was required in S-Function library to RPI3b(/home/pi/wiringPi/wiringPi/)then run that simulink file(Raspberry Pi Driver Block SFunction).I have an error saying: Error executing command "touch -c /home/pi/Digital_Out_SFunction_Example_ert_rtw/*.*;make -f Digital_Out_SFunction_Example.mk all -C /home/pi/Digital_Out_SFunction_Example_ert_rtw". Details:
STDERR: sfcn_Digital_Out_wrapper.c.o: In function `pinMode': sfcn_Digital_Out_wrapper.c:(.text+0x1db0): undefined reference to `softPwmStop' sfcn_Digital_Out_wrapper.c:(.text+0x1db8): undefined reference to `softToneStop' sfcn_Digital_Out_wrapper.c:(.text+0x1eb4): undefined reference to `softPwmCreate' sfcn_Digital_Out_wrapper.c:(.text+0x1ecc): undefined reference to `softToneCreate' collect2: error: ld returned 1 exit status make: * [../Digital_Out_SFunction_Example.elf] Error 1
STDOUT: make: Entering directory '/home/pi/Digital_Out_SFunction_Example_ert_rtw' gcc -c -MMD -MP -MF"MW_gpio.c.dep" -MT"MW_gpio.c.o" -O0 -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DON_TARGET_WAIT_FOR_START=1 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DON_TARGET_WAIT_FOR_START=1 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -I./ -o MW_gpio.c.o MW_gpio.c gcc -c -MMD -MP -MF"Digital_Out_SFunction_Example.c.dep" -MT"Digital_Out_SFunction_Example.c.o" -O0 -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DON_TARGET_WAIT_FOR_START=1 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DON_TARGET_WAIT_FOR_START=1 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -I./ -o Digital_Out_SFunction_Example.c.o Digital_Out_SFunction_Example.c gcc -c -MMD -MP -MF"Digital_Out_SFunction_Example_data.c.dep" -MT"Digital_Out_SFunction_Example_data.c.o" -O0 -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DON_TARGET_WAIT_FOR_START=1 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DON_TARGET_WAIT_FOR_START=1 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -I./ -o Digital_Out_SFunction_Example_data.c.o Digital_Out_SFunction_Example_data.c gcc -c -MMD -MP -MF"ext_svr.c.dep" -MT"ext_svr.c.o" -O0 -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DON_TARGET_WAIT_FOR_START=1 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DON_TARGET_WAIT_FOR_START=1 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -I./ -o ext_svr.c.o ext_svr.c gcc -c -MMD -MP -MF"updown.c.dep" -MT"updown.c.o" -O0 -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DON_TARGET_WAIT_FOR_START=1 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DON_TARGET_WAIT_FOR_START=1 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -I./ -o updown.c.o updown.c gcc -c -MMD -MP -MF"ext_work.c.dep" -MT"ext_work.c.o" -O0 -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DON_TARGET_WAIT_FOR_START=1 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DON_TARGET_WAIT_FOR_START=1 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -I./ -o ext_work.c.o ext_work.c gcc -c -MMD -MP -MF"rtiostream_utils.c.dep" -MT"rtiostream_utils.c.o" -O0 -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DON_TARGET_WAIT_FOR_START=1 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DON_TARGET_WAIT_FOR_START=1 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -I./ -o rtiostream_utils.c.o rtiostream_utils.c gcc -c -MMD -MP -MF"sfcn_Digital_Out_wrapper.c.dep" -MT"sfcn_Digital_Out_wrapper.c.o" -O0 -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DON_TARGET_WAIT_FOR_START=1 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DON_TARGET_WAIT_FOR_START=1 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -I./ -o sfcn_Digital_Out_wrapper.c.o sfcn_Digital_Out_wrapper.c gcc -c -MMD -MP -MF"linuxinitialize.c.dep" -MT"linuxinitialize.c.o" -O0 -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DON_TARGET_WAIT_FOR_START=1 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DON_TARGET_WAIT_FOR_START=1 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -I./ -o linuxinitialize.c.o linuxinitialize.c gcc -c -MMD -MP -MF"rtiostream_interface.c.dep" -MT"rtiostream_interface.c.o" -O0 -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DON_TARGET_WAIT_FOR_START=1 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DON_TARGET_WAIT_FOR_START=1 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -I./ -o rtiostream_interface.c.o rtiostream_interface.c gcc -c -MMD -MP -MF"rtiostream_tcpip.c.dep" -MT"rtiostream_tcpip.c.o" -O0 -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DON_TARGET_WAIT_FOR_START=1 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DON_TARGET_WAIT_FOR_START=1 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -I./ -o rtiostream_tcpip.c.o rtiostream_tcpip.c gcc -c -MMD -MP -MF"ert_main.c.dep" -MT"ert_main.c.o" -O0 -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DON_TARGET_WAIT_FOR_START=1 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DON_TARGET_WAIT_FOR_START=1 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=Digital_Out_SFunction_Example -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -I./ -o ert_main.c.o ert_main.c echo "### Creating standalone executable "../Digital_Out_SFunction_Example.elf" ..." ### Creating standalone executable ../Digital_Out_SFunction_Example.elf ... gcc -lrt -lpthread -ldl -o ../Digital_Out_SFunction_Example.elf MW_gpio.c.o Digital_Out_SFunction_Example.c.o Digital_Out_SFunction_Example_data.c.o ext_svr.c.o updown.c.o ext_work.c.o rtiostream_utils.c.o sfcn_Digital_Out_wrapper.c.o linuxinitialize.c.o rtiostream_interface.c.o rtiostream_tcpip.c.o ert_main.c.o -lm -lm -lstdc++ Digital_Out_SFunction_Example.mk:351: recipe for target '../Digital_Out_SFunction_Example.elf' failed make: Leaving directory '/home/pi/Digital_Out_SFunction_Example_ert_rtw'
Nobody had solution to this problem.Help me and others if you can. thanks again.
I need to develop a S-function (target Rasperry) that use c++ headers (.h and .cpp) but the building has some problems.
someone knows how can i resolve it?
The call to realtime_make_rtw_hook, during the after_make hook generated the following error:
Error executing SSH command: make: Entering directory '/home/pi/raspberrypi_gettingstarted_rtt'
"gcc" -I"./" -O3 -D"MODEL=raspberrypi_gettingstarted" -D"NUMST=1" -D"NCSTATES=0" -D"HAVESTDIO=" -D"ON_TARGET_WAIT_FOR_START=1" -D"ONESTEPFCN=0" -D"EXT_MODE=1" -D"TERMFCN=1" -D"MAT_FILE=0" -D"MULTI_INSTANCE_CODE=0" -D"INTEGER_CODE=0" -D"MT=0" -D"CLASSIC_INTERFACE=0" -D"ALLOCATIONFCN=0" -D"TID01EQ=0" -D"_USE_TARGET_UDP_=" -D"_RUNONTARGETHARDWARE_BUILD_=" -D"EXIT_FAILURE=1" -D"EXTMODE_DISABLETESTING=" -c ./linuxUDP.c ./ext_svr.c ./ext_work.c ./rtiostream_interface.c ./updown.c ./rtiostream_tcpip.c ./rtiostream_utils.c ./GY87_wrapper.c ./ert_main.c ./raspberrypi_gettingstarted.c ./raspberrypi_gettingstarted_data.c
In file included from /home/pi/MPU6050_CCODE/I2Cdev.cpp:55:0,
from ./GY87_wrapper.c:22:
/home/pi/MPU6050_CCODE/I2Cdev.h:52:1: error: unknown type name ÔÇÿclassÔÇÖ
/home/pi/MPU6050_CCODE/I2Cdev.h:52:14: error: expected ÔÇÿ=ÔÇÖ, ÔÇÿ,ÔÇÖ, ÔÇÿ;ÔÇÖ, ÔÇÿasmÔÇÖ or ÔÇÿ__attribute__ÔÇÖ before ÔÇÿ{ÔÇÖ token
In file included from ./GY87_wrapper.c:22:0:
/home/pi/MPU6050_CCODE/I2Cdev.cpp:59:7: error: expected ÔÇÿ=ÔÇÖ, ÔÇÿ,ÔÇÖ, ÔÇÿ;ÔÇÖ, ÔÇÿasmÔÇÖ or ÔÇÿ__attribute__ÔÇÖ before ÔÇÿ:ÔÇÖ token
In file included from ./GY87_wrapper.c:22:0:
2015a=>wiringpi (serial port) work. 2015b failed. Recommend using 2015a until issue 01934398 is resolved.
Using R2015b -
Connecting an LED to the Toggle Digital Output Pin SFunction block, did anyone get the LED to change state (on/off) while running in External Mode? When I ran in External Mode and toggled the switch, the LED would not light up/turn off.
But the GPIO Write block worked fine - I could change the value in the constant block and see the LED respond.
I have the same problem as stated by VCOpll before. The solution with "xmakefilesetup" does not work for me because the feature is not longer available in R2015.
Thanks for the comment Arnaud, glad it helped you. I've uploaded my version of the driver blocks with better documentation here: http://uk.mathworks.com/matlabcentral/fileexchange/51232-raspberry-pi-simulink-driver-blocks-adc-dac-pwm
I could not find the solution by myself but someone did using xmakefilesetup :
http://engineer.john-whittington.co.uk/2015/06/simulink-raspberry-pi-driver-blocks/
I could also build an s-function using BCM2835 lib and another to communicate with Phidgets sensors (bridges) on Rpi.
Many thanks to John !
Has anyone figured this out?
I am getting the same error.
The call to realtime_make_rtw_hook, during the after_make hook generated the following error:
Error executing SSH command: make: Entering directory '/home/pi/projects/scratch_220515_rtt'
"gcc" -I"./" -O3 -D"MODEL=scratch_220515" -D"NUMST=1" -D"NCSTATES=0" -D"HAVESTDIO=" -D"ON_TARGET_WAIT_FOR_START=1" -D"ONESTEPFCN=0" -D"EXT_MODE=1" -D"TERMFCN=1" -D"MAT_FILE=0" -D"MULTI_INSTANCE_CODE=0" -D"INTEGER_CODE=0" -D"MT=0" -D"CLASSIC_INTERFACE=0" -D"ALLOCATIONFCN=0" -D"TID01EQ=0" -D"_USE_TARGET_UDP_=" -D"_RUNONTARGETHARDWARE_BUILD_=" -D"EXIT_FAILURE=1" -D"EXTMODE_DISABLETESTING=" -c ./MW_gpio.c ./MW_pinmux.c ./linuxUDP.c ./ext_svr.c ./ext_work.c ./rtiostream_interface.c ./updown.c ./rtiostream_tcpip.c ./rtiostream_utils.c ./SPI_scratch_wrapper.c ./ert_main.c ./scratch_220515.c
"gcc" ./MW_gpio.o ./MW_pinmux.o ./linuxUDP.o ./ext_svr.o ./ext_work.o ./rtiostream_interface.o ./updown.o ./rtiostream_tcpip.o ./rtiostream_utils.o ./SPI_scratch_wrapper.o ./ert_main.o ./scratch_220515.o -lm -ldl -lpthread -lrt -o ./MW/scratch_220515
./SPI_scratch_wrapper.o: In function `pinMode.constprop.13':
SPI_scratch_wrapper.c:(.text+0xeac): undefined reference to `softPwmStop'
SPI_scratch_wrapper.c:(.text+0xeb4): undefined reference to `softToneStop'
./SPI_scratch_wrapper.o: In function `pinMode':
SPI_scratch_wrapper.c:(.text+0x14ac): undefined reference to `softPwmStop'
SPI_scratch_wrapper.c:(.text+0x14b4): undefined reference to `softToneStop'
SPI_scratch_wrapper.c:(.text+0x1680): undefined reference to `softPwmCreate'
SPI_scratch_wrapper.c:(.text+0x168c): undefined reference to `softToneCreate'
./SPI_scratch_wrapper.o: In function `SPI_scratch_Update_wrapper':
SPI_scratch_wrapper.c:(.text+0x3184): undefined reference to `mcp3008Setup'
collect2: ld returned 1 exit status
_scratch_220515.mk:122: recipe for target 'MW/scratch_220515' failed
make: *** [MW/scratch_220515] Error 1
make: Leaving directory '/home/pi/projects/scratch_220515_rtt'
The build process will terminate as a result.
Error executing SSH command: make: Entering directory '/home/pi/projects/scratch_220515_rtt'
"gcc" -I"./" -O3 -D"MODEL=scratch_220515" -D"NUMST=1" -D"NCSTATES=0" -D"HAVESTDIO=" -D"ON_TARGET_WAIT_FOR_START=1" -D"ONESTEPFCN=0" -D"EXT_MODE=1" -D"TERMFCN=1" -D"MAT_FILE=0" -D"MULTI_INSTANCE_CODE=0" -D"INTEGER_CODE=0" -D"MT=0" -D"CLASSIC_INTERFACE=0" -D"ALLOCATIONFCN=0" -D"TID01EQ=0" -D"_USE_TARGET_UDP_=" -D"_RUNONTARGETHARDWARE_BUILD_=" -D"EXIT_FAILURE=1" -D"EXTMODE_DISABLETESTING=" -c ./MW_gpio.c ./MW_pinmux.c ./linuxUDP.c ./ext_svr.c ./ext_work.c ./rtiostream_interface.c ./updown.c ./rtiostream_tcpip.c ./rtiostream_utils.c ./SPI_scratch_wrapper.c ./ert_main.c ./scratch_220515.c
"gcc" ./MW_gpio.o ./MW_pinmux.o ./linuxUDP.o ./ext_svr.o ./ext_work.o ./rtiostream_interface.o ./updown.o ./rtiostream_tcpip.o ./rtiostream_utils.o ./SPI_scratch_wrapper.o ./ert_main.o ./scratch_220515.o -lm -ldl -lpthread -lrt -o ./MW/scratch_220515
./SPI_scratch_wrapper.o: In function `pinMode.constprop.13':
SPI_scratch_wrapper.c:(.text+0xeac): undefined reference to `softPwmStop'
SPI_scratch_wrapper.c:(.text+0xeb4): undefined reference to `softToneStop'
./SPI_scratch_wrapper.o: In function `pinMode':
SPI_scratch_wrapper.c:(.text+0x14ac): undefined reference to `softPwmStop'
SPI_scratch_wrapper.c:(.text+0x14b4): undefined reference to `softToneStop'
SPI_scratch_wrapper.c:(.text+0x1680): undefined reference to `softPwmCreate'
SPI_scratch_wrapper.c:(.text+0x168c): undefined reference to `softToneCreate'
./SPI_scratch_wrapper.o: In function `SPI_scratch_Update_wrapper':
SPI_scratch_wrapper.c:(.text+0x3184): undefined reference to `mcp3008Setup'
collect2: ld returned 1 exit status
_scratch_220515.mk:122: recipe for target 'MW/scratch_220515' failed
make: *** [MW/scratch_220515] Error 1
make: Leaving directory '/home/pi/projects/scratch_220515_rtt'
Hi, exactly the same message as Walter and Chfakht chfakht :
The call to realtime_make_rtw_hook, during the after_make hook generated the following error:
Error executing SSH command: make: Entering directory '/home/pi/Essai_SPI_rtt'
"gcc" -I"./" -O3 -D"MODEL=Essai_SPI" -D"NUMST=1" -D"NCSTATES=0" -D"HAVESTDIO=" -D"ON_TARGET_WAIT_FOR_START=1" -D"ONESTEPFCN=0" -D"EXT_MODE=1" -D"TERMFCN=1" - etc...
Please could someone help us ?
I could see that there are many files downloaded into the RPI but nothing on the /MW directory where the executable should be.
By the way I'm using R2013a and a RPI B+
Thanks in advance
Hi, I'm getting the same error as chfakht chfakht and Daryl. Did anyone manage to fix this ?
Tanks.
Hello ,
i have this error when trying to upload an example to the raspberry pi model b+
The call to realtime_make_rtw_hook, during the after_make hook generated the following error:
Error executing SSH command: make: Entering directory '/home/pi/MinSegMega_Demo_V2_rtt'
"gcc" -I"./" -O3 -D"MODEL=MinSegMega_Demo_V2" -D"NUMST=1" -D"NCSTATES=0" -D"HAVESTDIO=" -D"ON_TARGET_WAIT_FOR_START=1" -D"ONESTEPFCN=0" -D"EXT_MODE=1" -D"TERMFCN=1" -D"MAT_FILE=0" -D"MULTI_INSTANCE_CODE=0" -D"INTEGER_CODE=0" -D"MT=0" -D"CLASSIC_INTERFACE=0" -D"TID01EQ=0" -D"_USE_TARGET_UDP_=" -D"_RUNONTARGETHARDWARE_BUILD_=" -D"EXIT_FAILURE=1" -D"EXTMODE_DISABLETESTING=" -c ./linuxUDP.c ./MinSegMega_Demo_V2.c ./ert_main.c ./ext_svr.c ./ext_work.c ./rtiostream_interface.c ./updown.c ./rtiostream_tcpip.c ./rtiostream_utils.c
"gcc" ./linuxUDP.o ./MinSegMega_Demo_V2.o ./ert_main.o ./ext_svr.o ./ext_work.o ./rtiostream_interface.o ./updown.o ./rtiostream_tcpip.o ./rtiostream_utils.o -lm -ldl -lpthread -lrt -o ./MW/MinSegMega_Demo_V2
./MinSegMega_Demo_V2.o: In function `MinSegMega_Demo_V2_output':
MinSegMega_Demo_V2.c:(.text+0x4c): undefined reference to `sf_HMC5883L_MPU6050_Outputs_wrapper'
./MinSegMega_Demo_V2.o: In function `MinSegMega_Demo_V2_update':
MinSegMega_Demo_V2.c:(.text+0xa8): undefined reference to `sf_HMC5883L_MPU6050_Update_wrapper'
collect2: ld returned 1 exit status
_MinSegMega_Demo_V2.mk:161: recipe for target 'MW/MinSegMega_Demo_V2' failed
make: *** [MW/MinSegMega_Demo_V2] Error 1
make: Leaving directory '/home/pi/MinSegMega_Demo_V2_rtt'
The build process will terminate as a result.
Caused by:
Error executing SSH command: make: Entering directory '/home/pi/MinSegMega_Demo_V2_rtt'
"gcc" -I"./" -O3 -D"MODEL=MinSegMega_Demo_V2" -D"NUMST=1" -D"NCSTATES=0" -D"HAVESTDIO=" -D"ON_TARGET_WAIT_FOR_START=1" -D"ONESTEPFCN=0" -D"EXT_MODE=1" -D"TERMFCN=1" -D"MAT_FILE=0" -D"MULTI_INSTANCE_CODE=0" -D"INTEGER_CODE=0" -D"MT=0" -D"CLASSIC_INTERFACE=0" -D"TID01EQ=0" -D"_USE_TARGET_UDP_=" -D"_RUNONTARGETHARDWARE_BUILD_=" -D"EXIT_FAILURE=1" -D"EXTMODE_DISABLETESTING=" -c ./linuxUDP.c ./MinSegMega_Demo_V2.c ./ert_main.c ./ext_svr.c ./ext_work.c ./rtiostream_interface.c ./updown.c ./rtiostream_tcpip.c ./rtiostream_utils.c
"gcc" ./linuxUDP.o ./MinSegMega_Demo_V2.o ./ert_main.o ./ext_svr.o ./ext_work.o ./rtiostream_interface.o ./updown.o ./rtiostream_tcpip.o ./rtiostream_utils.o -lm -ldl -lpthread -lrt -o ./MW/MinSegMega_Demo_V2
./MinSegMega_Demo_V2.o: In function `MinSegMega_Demo_V2_output':
MinSegMega_Demo_V2.c:(.text+0x4c): undefined reference to `sf_HMC5883L_MPU6050_Outputs_wrapper'
./MinSegMega_Demo_V2.o: In function `MinSegMega_Demo_V2_update':
MinSegMega_Demo_V2.c:(.text+0xa8): undefined reference to `sf_HMC5883L_MPU6050_Update_wrapper'
collect2: ld returned 1 exit status
_MinSegMega_Demo_V2.mk:161: recipe for target 'MW/MinSegMega_Demo_V2' failed
make: *** [MW/MinSegMega_Demo_V2] Error 1
make: Leaving directory '/home/pi/MinSegMega_Demo_V2_rtt'
thanks
Hi!
I have a problem when trying to run a sfunction which uses the wiringPi examples.
I can build the sfunction. After building i try to run the simulation on the external target. I then get a message with undefined references.
I noticed that the message also states:
"gcc" -I"./" -I"C:/Users/Daryl/SkyDrive/School/00_Matlab/Diy/raspberry_pi/home/pi/wiringPi/wiringPi"
Should this not be a direcory on the raspberry pi instead of a folfer on my windows computer?
Thanks in advance if one of you can help me!!
The complete error message is as follows:
The build process will terminate as a result.
Error executing SSH command: make: Entering directory '/home/pi/Digital_Out_SFunction_Example_rtt'
"gcc" -I"./" -I"C:/Users/Daryl/SkyDrive/School/00_Matlab/Diy/raspberry_pi/home/pi/wiringPi/wiringPi" -O3 -D"MODEL=Digital_Out_SFunction_Example" -D"NUMST=1" -D"NCSTATES=0" -D"HAVESTDIO=" -D"ON_TARGET_WAIT_FOR_START=1" -D"ONESTEPFCN=0" -D"EXT_MODE=1" -D"TERMFCN=1" -D"MAT_FILE=0" -D"MULTI_INSTANCE_CODE=0" -D"INTEGER_CODE=0" -D"MT=0" -D"CLASSIC_INTERFACE=0" -D"ALLOCATIONFCN=0" -D"TID01EQ=0" -D"_USE_TARGET_UDP_=" -D"_RUNONTARGETHARDWARE_BUILD_=" -D"EXIT_FAILURE=1" -D"EXTMODE_DISABLETESTING=" -c ./MW_gpio.c ./MW_pinMux.c ./linuxUDP.c ./ext_svr.c ./ext_work.c ./rtiostream_interface.c ./updown.c ./rtiostream_tcpip.c ./rtiostream_utils.c ./Digital_Out_SFunction_Example.c ./Digital_Out_SFunction_Example_data.c ./ert_main.c ./sfcn_Digital_Out_wrapper.c
"gcc" ./MW_gpio.o ./MW_pinMux.o ./linuxUDP.o ./ext_svr.o ./ext_work.o ./rtiostream_interface.o ./updown.o ./rtiostream_tcpip.o ./rtiostream_utils.o ./Digital_Out_SFunction_Example.o ./Digital_Out_SFunction_Example_data.o ./ert_main.o ./sfcn_Digital_Out_wrapper.o -lm -ldl -lpthread -lrt -o ./MW/Digital_Out_SFunction_Example
./sfcn_Digital_Out_wrapper.o: In function `pinMode':
sfcn_Digital_Out_wrapper.c:(.text+0xfd0): undefined reference to `softPwmStop'
sfcn_Digital_Out_wrapper.c:(.text+0xfd8): undefined reference to `softToneStop'
sfcn_Digital_Out_wrapper.c:(.text+0x12c0): undefined reference to `softPwmCreate'
sfcn_Digital_Out_wrapper.c:(.text+0x12cc): undefined reference to `softToneCreate'
collect2: ld returned 1 exit status
_Digital_Out_SFunction_Example.mk:122: recipe for target 'MW/Digital_Out_SFunction_Example' failed
make: *** [MW/Digital_Out_SFunction_Example] Error 1
make: Leaving directory '/home/pi/Digital_Out_SFunction_Example_rtt'
This link may be helpful.
https://groups.google.com/forum/#!msg/beagleboard/fC-Bg_-Ia34/cvTeQvJ2MAwJ
Maybe problem because the compiler not link to matlab
Hi, I have similar errors with Alexander. I have already installed latest wiringPi lib. So how do you deploy it and make it running well at raspberry pi?
Hi I have the following problem.
All to Tools -> Run on Target Hardware -> RUN
I get:
Error in S-function 'Digital_Out_SFunction_Example / Toggle Pin Digital Output With SFunction': S-Function 'sfcn_Digital_Out' does not exist
They know how to fix it, possess the xls file and I can not install it on my Raspberry Pi. Thank you.
Hi Daniel, the problem solved when you replace the original wiringPi library in the raspberry with the latest version.
Alexander, I keep getting a similar error. What did you do to get yours working?
Thank you,
Daniel
Ive got it, ty.
hey, ive took this one by one and:
The call to realtime_make_rtw_hook, during the after_make hook generated the following error:
Error executing SSH command: make: Entering directory `/home/pi/Digital_Out_SFunction_Example_rtt'
"gcc" -I"./" -O3 -D"MODEL=Digital_Out_SFunction_Example" -D"NUMST=1" -D"NCSTATES=0" -D"HAVESTDIO=" -D"ONESTEPFCN=0" -D"TERMFCN=1" -D"MAT_FILE=0" -D"MULTI_INSTANCE_CODE=0" -D"INTEGER_CODE=0" -D"MT=0" -D"CLASSIC_INTERFACE=0" -D"TID01EQ=0" -D"_USE_TARGET_UDP_=" -D"_RUNONTARGETHARDWARE_BUILD_=" -c ./MW_gpio.c ./MW_pinMux.c ./linuxUDP.c ./Digital_Out_SFunction_Example.c ./Digital_Out_SFunction_Example_data.c ./ert_main.c ./sfcn_Digital_Out_wrapper.c
./sfcn_Digital_Out_wrapper.c:38:50: fatal error: /home/pi/wiringPi/wiringPi/gertboard.h: No such file or directory
compilation terminated.
make: *** [MW_gpio.o] Error 1
make: Leaving directory `/home/pi/Digital_Out_SFunction_Example_rtt'
The build process will terminate as a result.
Caused by:
Error executing SSH command: make: Entering directory `/home/pi/Digital_Out_SFunction_Example_rtt'
"gcc" -I"./" -O3 -D"MODEL=Digital_Out_SFunction_Example" -D"NUMST=1" -D"NCSTATES=0" -D"HAVESTDIO=" -D"ONESTEPFCN=0" -D"TERMFCN=1" -D"MAT_FILE=0" -D"MULTI_INSTANCE_CODE=0" -D"INTEGER_CODE=0" -D"MT=0" -D"CLASSIC_INTERFACE=0" -D"TID01EQ=0" -D"_USE_TARGET_UDP_=" -D"_RUNONTARGETHARDWARE_BUILD_=" -c ./MW_gpio.c ./MW_pinMux.c ./linuxUDP.c ./Digital_Out_SFunction_Example.c ./Digital_Out_SFunction_Example_data.c ./ert_main.c ./sfcn_Digital_Out_wrapper.c
./sfcn_Digital_Out_wrapper.c:38:50: fatal error: /home/pi/wiringPi/wiringPi/gertboard.h: No such file or directory
compilation terminated.
make: *** [MW_gpio.o] Error 1
make: Leaving directory `/home/pi/Digital_Out_SFunction_Example_rtt'
Some hints?
Regards,
Alex