Simulink Raspberry Pi - I2C Master Read error
6 views (last 30 days)
Show older comments
Dear all,
I have been trying to read data from an external sensor using the "I2C Master Read" from the "Simulink Support Package for Raspberry Pi Hardware". I am using a very simple model with one I2C read block connected to a display block.
The following error is blocking me from using the I2C block, would appreciate your help?
Thank you
### Starting build procedure for model: Test_Receiver
### Generating code and artifacts to 'Model specific' folder structure
Code Generation 1
Elapsed: 13 sec
### Generating code into build folder: C:\Users\M\D\E-U\Code\Playground\Test_Receiver_ert_rtw
### Invoking Target Language Compiler on Test_Receiver.rtw
### Using System Target File: C:\Program Files\MATLAB\R2017b\rtw\c\ert\ert.tlc
### Loading TLC function libraries
......
### Initial pass through model to cache user defined code
.
### Caching model source code
................................
### Writing header file Test_Receiver_types.h
### Writing header file Test_Receiver.h
### Writing source file Test_Receiver.c
### Writing header file Test_Receiver_private.h
### Writing header file rtwtypes.h
### Writing header file multiword_types.h
.
### Writing source file Test_Receiver_data.c
### Writing header file rtmodel.h
### Writing source file ert_main.c
### TLC code generation complete.
### Generating TLC interface API.
......
### Creating data type transition file Test_Receiver_dt.h
### Evaluating PostCodeGenCommand specified in the model
### Using toolchain: GNU GCC Raspberry Pi v1.0 | gmake (64-bit Windows)
### 'C:\Users\Moe\Desktop\e-UDIMU\Code\Playground\Test_Receiver_ert_rtw\Test_Receiver.mk' is up to date
### Building 'Test_Receiver': make -f Test_Receiver.mk all
### Build procedure for model: 'Test_Receiver' aborted due to an error.
Error executing command "touch -c /home/pi/Test_Receiver_ert_rtw/*.*;make -f Test_Receiver.mk all -C /home/pi/Test_Receiver_ert_rtw". Details:
STDERR: MW_I2C.c: In function ‘EXT_I2C_writeH’:
MW_I2C.c:141:24: error: storage size of ‘msg’ isn’t known
struct i2c_msg msg;
^~~
MW_I2C.c: In function ‘EXT_I2C_readH’:
MW_I2C.c:178:24: error: storage size of ‘msg’ isn’t known
struct i2c_msg msg;
^~~
MW_I2C.c:184:25: error: ‘I2C_M_RD’ undeclared (first use in this function)
msg.flags = I2C_M_RD;
^~~~~~~~
MW_I2C.c:184:25: note: each undeclared identifier is reported only once for each function it appears in
make: *** [MW_I2C.c.o] Error 1
STDOUT: make: Entering directory '/home/pi/Test_Receiver_ert_rtw'
gcc -c -MMD -MP -MF"MW_I2C.c.dep" -MT"MW_I2C.c.o" -O2 -DMODEL=Test_Receiver -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=Test_Receiver -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -I./ -o MW_I2C.c.o MW_I2C.c
Test_Receiver.mk:473: recipe for target 'MW_I2C.c.o' failed
make: Leaving directory '/home/pi/Test_Receiver_ert_rtw'
2 Comments
Megh Doshi
on 12 Mar 2020
I'm having the same error, but with the beaglebone blue. Were you able to resolve this?
Matej Kopecky
on 10 Sep 2021
I'm having the same error too, with the beaglebone blue. Were you able to resolve this?
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!