5.0
5.0 | 4 ratings Rate this file 29 Downloads (last 30 days) File Size: 17.8 KB File ID: #41491 Version: 1.1
image thumbnail

Raspberry Pi Driver Block SFunction

by

 

25 Apr 2013 (Updated )

Simple Digital Out SFunction example block showing how to use the WiringPi library

| Watch this File

File Information
Description

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!

Acknowledgements

Device Drivers inspired this file.

This file inspired Raspberry Pi Simulink Driver Blocks Adc Dac Pwm.

Required Products Simulink
MATLAB
MATLAB release MATLAB 8.1 (R2013a)
Other requirements Raspberry Pi targetinstaller package
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (16)
18 Jun 2015 John Whittington

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

Comment only
17 Jun 2015 Arnaud Villeneuve

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 !

Comment only
22 May 2015 VCOpll

VCOpll (view profile)

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'

Comment only
20 May 2015 Arnaud Villeneuve

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

Comment only
08 May 2015 Walter Veiga

Hi, I'm getting the same error as chfakht chfakht and Daryl. Did anyone manage to fix this ?

Tanks.

Comment only
16 Feb 2015 chfakht chfakht

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

Comment only
10 Jan 2015 Daryl

Daryl (view profile)

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'

Comment only
31 Dec 2014 long Nguyen

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

Comment only
17 Nov 2014 Biao

Biao (view profile)

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?

Comment only
22 Feb 2014 Miguel

Miguel (view profile)

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.

Comment only
06 Dec 2013 Liang Xuan

Hi Daniel, the problem solved when you replace the original wiringPi library in the raspberry with the latest version.

Comment only
06 Dec 2013 Liang Xuan  
14 Nov 2013 Daniel

Daniel (view profile)

Alexander, I keep getting a similar error. What did you do to get yours working?

Thank you,
Daniel

Comment only
22 May 2013 Alexander

Ive got it, ty.

22 May 2013 Alexander

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

29 Apr 2013 Murat Belge  
Updates
22 Aug 2014 1.1

updated links

Contact us