raspberrypi - Raspbian - FATAL: Module spi-dev not found - raspberry-pi

In setting up my new raspberry pi (CanaKit Raspberry Pi B+ Ultimate), I am getting failures in loading spi-dev. No other errors occur during boot.
Looking for assistance in resolving this error. Is there a simple update to install the module?
[info] Loading kernel module snd-bcm2835.
[info] Loading kernel module spi-dev.
FATAL: Module spi-dev not found.

Firmware 3.18.x breaks I2C, SPI, audio, lirc, 1-wire (e.g. /dev/i2c-1, No such file or directory)
The latest firmware implements device tree support. That will have broken things like I2C, SPI, and 1-wire bus.
For fuller details see http://www.raspberrypi.org/forums/viewtopic.php?p=675658#p675658
Summary:
Add one or more of the following to your /boot/config.txt and reboot.
For I2C
Add
dtparam=i2c1=on (or dtparam=i2c0=on on old models)
And For SPI
Add to end of conf file
dtparam=spi=on
At
/boot/config.txt
paste at end
device_tree_param=i2c0=on,i2c1=on,spi=on
or like this
dtparam=i2c0=on,i2c1=on,spi=on
then all is fine again
greetings from IRC
Dr_Frankenstein

I've solved this problem with installing wiringPi, than activated SPI with:
gpio load spi
Hope that helps.

Related

Codesys Control RTE V3 - Network Adapter configuration for Ethercat real time bus

I am quite new to the Codesys platform and I am experiencing some problems when trying to use the RTE on a Windows IPC as a target device.
I am using an IPC (Windows 7 Embedded) with the following runtime version -> CODESYS Control RTE V3 v3.5.17.0
I run the Codesys Environment in my laptop (Also version v3.5.17.0) and I connect to the IPC runtime without problems, by choosing the right target PLC device (CODESYS Control RTE V3 x64).
I add an "Ethercat Master SoftMotion" device to my project and assign the correspoding IEC task (Bus Cycle Task) in which the stack will run, and select the NIC to be used by the stack without major problems. Just as described in the documentation -> https://help.codesys.com/webapp/_ecat_tutorial;product=core_EtherCAT_Configuration_Editor;version=4.1.0.0
When I Log In and Download the project so that I could start scanning the network to find the different Ethercat Slaves, I get the following messages:
[FATAL ERROR] Unresolved reference: 'SYSETHERNETADAPTERCLOSE'
[FATAL ERROR] Unresolved reference: 'GETNUMBEROFADAPTERS'
[FATAL ERROR] Unresolved reference: 'GETADAPTERINFO'
[FATAL ERROR] Unresolved reference: 'SYSETHERNETADAPTEROPEN'
[FATAL ERROR] Unresolved reference: 'SYSETHERNETETHFRAMESEND'
[FATAL ERROR] Unresolved reference: 'SYSETHERNETETHFRAMERECEIVE'
[FATAL ERROR] Unresolved reference: 'SYSETHERNETFRAMERELEASE'
[FATAL ERROR] Unresolved reference: 'GETIPETHFRAME'
[FATAL ERROR] Unresolved reference: 'SYSETHERNETIPFRAMESEND'
[FATAL ERROR] Unresolved reference: 'SYSETHERNETIPFRAMERECEIVE'
I also get I dialogue box stating:
"Error during download:
10 unserolved reference(s), 0 signature mismatch(es), 0 version mismatch(es) found
The device version on the hardware seems to be different from the device version used in the project. Try to up-/downgrade the device in the project to match the actual version of the hardware.
Please take a look in the messages view for further details".
This error message seems misleading because this is a new project on a new installed environment where both Codesys Development and the runtime both have exactly the same version and the project is therefore created for the right version of the runtime.
I had a look at the manual and I have to select the proper driver -> https://help.codesys.com/webapp/_cds_rtev3_startup_cifx_hil;product=core_codesys_control;version=3.5.17.0
At this point is when I find the problems:
According to the documentation I need to add the CmpHilscherCIFX component in the Component Manager Tab of the PLC Configuration which I did and then restarted the IPC.
Later on, the bootloader and correct firmware must be chosen by modifying the "CODESYSControl.cfg" file. This is a step I also do as you can see in the attachments, I simply add the Ethercat select the Ethercat firmware file according to "_cifX firmware.txt" which I found in "C:\Program Files\CODESYS\CODESYS Control RTE3\HilscherCIFX\Firmware":
[CmpHilscherCIFX]
TraceLevel=0xFFFFFFFF
InterruptMode=0
DMAMode=1
Device.0.BootloaderFilePath=$Firmware$\HilscherCIFX\Firmware\NETX100-BSL.bin
Device.0.Channel.0.FirmwareFile=$Firmware$\HilscherCIFX\Firmware\cifxecm.nxf
[SysFile]
|PlcLogicPrefix=1
PlaceholderFilePath=C:\Program Files\CODESYS\CODESYS Control RTE3, $Firmware$
After applying these changes, I restarted the IPC again. However, I was still getting this Unresolved reference errors, I noticed that there wasn´t any Ethercat firmware file (cifxecm.nxf) in "C:\Program Files\CODESYS\CODESYS Control RTE3\HilscherCIFX\Firmware":
The chosen NIC to run the Ethercat stack on the IPC is an Intel I211, so in theory the Chipset is supported.
How is this possible? I am not sure this is the cause of my problems, but it definitely seems something strange. Also the documentation does not seem to be up to date with the version I am using of the runtime, which I believe is onw of the latest.
I hope someone has some suggestion and if you need further clarification, I will provide more details.
It seems I was following the wrong part of the documentation, since I am not using a HilscherCIFX card.
The solution is explained in the section Available Dynamic Components.
Basically I had to:
Revert the changes I applied, those explained in my previous post.
Make sure secureboot is disabled in the BIOS settings, (this can be done during the installation of the RTE runtime).
I had to install the right Codesys Driver for the Intel I211 NIC which is "CmpEt1000Drv" as described in the documentation. The driver is in "C:\Program Files\CODESYS\CODESYS Control RTE3\Cmpet1000MPD". Personally, uninstalling the previous driver from the NIC I wanted to use for Ethercat from the Windows Device manager and installing the new one from there was enough for me.
Add the CmpEt1000Drv component to the component list (Component Manager tab) of RTE System Configuration.
Stop and then Restart the RTE environment.

Deploy Shiny application with older version of particular package

This may be a stupid question, but I'm unable to solve the following issue:
I'm working on a Shiny-app and need an older version of lavaan to obtain the same results as a few weeks ago. I used the following code to install the older version locally: install_version("lavaan",version = "0.5-23.1097"), and I loaded this old version using library(lavaan) into my server.R file. I also added all possible dependencies to my list in the server.R file so that everything works fine locally.
However, when I try to deploy my application, I obtain the following at the end of my task log:
[2018-08-16T17:00:24.569989191+0000] Installing R package: quadprog (1.5-5)
* installing to library �/opt/R/3.4.0/lib/R/library�
* installing *binary* package �quadprog� ...
* DONE (quadprog)
[2018-08-16T17:00:24.749745586+0000] Building R package: lavaan (0.5-23.1097)
/mnt/packages/build /mnt
* installing to library �/opt/R/3.4.0/lib/R/library�
* installing *source* package �lavaan� ...
** package �lavaan� successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/opt/R/3.4.0/lib/R/library/quadprog/libs/quadprog.so':
libRblas.so: cannot open shared object file: No such file or directory
ERROR: lazy loading failed for package �lavaan�
* removing �/opt/R/3.4.0/lib/R/library/lavaan�
Apparently, it is able to find the old lavaan version and unpack it, but as soon as it performs this lazy loading action, it breaks down.
Does anybody know where I could eliminate this lazy loading or perhaps where to find this quadprog.so or libRblas.so file? I assume that something more essential is going on, but I can't figure it out. Below, you can find my sessionInfo() output.
R version 3.4.0 (2017-04-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=Dutch_Belgium.1252 LC_CTYPE=Dutch_Belgium.1252 LC_MONETARY=Dutch_Belgium.1252 LC_NUMERIC=C
[5] LC_TIME=Dutch_Belgium.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lavaan_0.5-23.1097 quadprog_1.5-5 MASS_7.3-47 numDeriv_2016.8-1 htmlwidgets_1.0 jsonlite_1.5 htmltools_0.3.6
[8] yaml_2.2.0 tibble_1.4.2 DT_0.2 ggplot2_2.2.1 rmarkdown_1.8 stringi_1.1.7 foreign_0.8-67
[15] magrittr_1.5 rsconnect_0.8.5 shinyjs_0.9.1 shinythemes_1.1.1 shiny_1.1.0 devtools_1.13.6
loaded via a namespace (and not attached):
[1] Rcpp_0.12.18 git2r_0.18.0 pillar_1.3.0 compiler_3.4.0 later_0.7.3 plyr_1.8.4 bitops_1.0-6 tools_3.4.0
[9] digest_0.6.12 memoise_1.1.0 evaluate_0.10.1 gtable_0.2.0 rlang_0.2.1 rstudioapi_0.6 curl_3.1 pbivnorm_0.6.0
[17] httr_1.2.1 withr_1.0.2 stringr_1.2.0 knitr_1.17 stats4_3.4.0 rprojroot_1.2 grid_3.4.0 R6_2.2.2
[25] RJSONIO_1.3-0 backports_1.1.0 scales_0.4.1 promises_1.0.1 mnormt_1.5-5 mime_0.5 xtable_1.8-2 colorspace_1.3-2
[33] httpuv_1.4.5 miniUI_0.1.1 RCurl_1.95-4.8 lazyeval_0.2.0 munsell_0.4.3 crayon_1.3.4
Many thanks in advance!!
Kind regards
Apparently, my issue had nothing to do with managing package versions.
The solution can be found on this link, thanks to Joshua Spiewak.
The gist is that the package quadprog was improperly compiled, although it was successfully installed. Flushing the package from the cache for R 3.4.0 solved the issue.
Thank you all for helping out!
Try using packrat to manage you package versions. This is how I run shiny apps with different versions of packages and it makes them deployable to connect servers in a way that maintains the correct package.

core-image-minimal has bluetooth

I am trying to build core-image-minimal receipe for iMx7 (Yocto project), the image gets successfully built but it has bluetooth, caam and lot of other stuff. How can I remove these from including in the minimal-image?
core-image-minimal should only have things required for just booting nothing else, somehow other packages are getting added. I didnt add anything in my local.config file.
MACHINE = "imx7dsabresd"
bluetooth and wifi are enabled here:
imx7dsabresd.conf
You can add the following to your local.conf to remove bluetooth:
MACHINE_FEATURES_remove = "bluetooth"
CAAM is enabled in the kernel config here:
defconfig
To change the kernel configuration you can either provide a new defconfig or use a configuration fragment. The following steps describe how to create a config fragment.
Run the following command and deselect the bluetooth related config options:
bitbake -c menuconfig virtual/kernel
Run the following command to generate fragment.cfg in ${WORKDIR}
bitbake -c diffconfig virtual/kernel
At this point if you do not have your own layer, create one by following this guide:
Creating Your Own Layer
Create the directory for the .bbappend and the configuration fragment:
mkdir -p ${PATH_TO_YOUR_LAYER}/recipes-kernel/linux/linux-fslc-imx/linux-fslc-imx/
Move fragment.cfg from ${WORKDIR} to ${PATH_TO_YOUR_LAYER}/recipes-kernel/linux/linux-fslc-imx/linux-fslc-imx/
Create a ${PATH_TO_YOUR_LAYER}/recipes-kernel/linux/linux-fslc-imx_%.bbappend (assuming linux-fslc-imx is the correct kernel recipe for this board) and place the following in it:
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://fragment.cfg"
Additionally, you may find the Creating Configuration Fragments section of the manual helpful.
For more information about bbappends see:
mega-manual
You do not mention which machine you are building for, but I suspect it has bluetooth enabled in the MACHINE_FEATURES. I also didn't look at the bb file for core-image-minimal closely, so could be something else.

Building a yocto image for RPi3

Recently I started with yocto-project to build images for raspberry-pi.
I cloned poky and meta-raspberrypi under a directory named as yocto_project on my ubuntu host. Initiated the build using source oe-init-build-env rpi-build.
The first image I created the rpi-basic-image which was a successful attempt.
Upon booting RPi with the image I got a CLI based interface, but the problem is few commands are missing. Came to know by-default all the packages didn't get combine with image, we need to add it manually for example systemd.
If I run bitbake-layers show-recipes I get long list of all the recipes available for RPi. So I added the text IMAGE_INSTALL_append = " systemd" after reading some documents online to append systemd. After this when I bitbake rpi-basic-image got error as ERROR: Nothing RPOVIDES 'systemd' (but /path_to/rpi-basic-image.bb RDEPENDS on or otherwise requires it)
ERROR: systemd was skipped: 'systemd' not in DISTRO_FEATURES
ERROR: Required build target 'rpi-basic-image' has no buildable providers
Don't have clue, why I get this error. How to resolve it. Also do I have to manually add those packages/recipes using build/local.conf to get all the commands.
Need a good explanation/guidance .
From Selecting an Initialization Manager - Yocto Development Manual:
DISTRO_FEATURES_append = " systemd"
VIRTUAL-RUNTIME_init_manager = "systemd"
You can set those variables in your local.conf.

Eclipse remote debugging arm-linux library

I am running:
Eclipse 3.8.1 (Build id: deb build).
On Ubuntu 16.04 LTS in a VM and UbuntuMATE 16.04 LTS on target Raspberry Pi 3.
gdb-multiarch(architecture set to arm in .gdbinit) locally andgdbserver` on the target.
Cross compilation and remote deployment is successful. However, there appears to be some library issue when I run on the remote target. Output from gdb-multiarch below (superfluous text removed):
GNU gdb (Ubuntu 7.11-0ubuntu1) 7.11 Copyright (C) 2016 Free Software
Foundation, Inc. License GPLv3+: GNU GPL version 3 or later
http://gnu.org/licenses/gpl.html This GDB was configured as
"x86_64-linux-gnu".
Program stopped. 0x76fd7a40 in ?? () from
/home/fred/raspberrypi/rootfs/lib/arm-linux-gnueabihf/ld-2.23.so
Execution stops at main. However, it doesn't appear to stop due to a breakpoint. The stop appears to be the result of some library issue possibly and unresolved symbol (or something more serious) resulting in the ??.
I have set sysroot in the .gdbinit file to indicate where the shared libraries can be found. The StepIn, StepOut icons are hi-lighted in Eclipse, and I can read ARM registers if I press pause and see which core is being used to run the process (with process ID)!
After further resume & pause operations a segmentation fault occurs:
Program stopped. 0x76fe2e92 in ?? () from
/home/fred/raspberrypi/rootfs/lib/arm-linux-gnueabihf/ld-2.23.so
Program received signal SIGSEGV, Segmentation fault. 0x76fd905e in ??
() from
/home/fred/raspberrypi/rootfs/lib/arm-linux-gnueabihf/ld-2.23.so
Program terminated with signal SIGSEGV, Segmentation fault. The
program no longer exists.
Any ideas? (I am very much new to Linux as it probably shows.)
Thanks for the questions which have resulted in further exploration below:
In Eclipse I started GDB by selecting Debug Configuration and then choosing the remote configuration that I had set up.
The code is very simple, consisting of a stream operator to output some text and then a loop, however it is never reached. I think I have just managed to reproduce the issue from the command line. Incidentally I started the target going first. (Again superfluous text was removed for clarity.)
gdb-multiarch Hello_Raspberry_Pi
Reading symbols from Hello_Raspberry_Pi...done.
The target architecture is assumed to be arm
(gdb) target remote ubuntumate-pi
(gdb) target remote 192.168.0.12:2345
Remote debugging using 192.168.0.12:2345
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initialisers
and track explicitly loaded dynamic code.
0x76fd7a40 in ?? ()
(gdb) set architecture arm
The target architecture is assumed to be arm
(gdb) set sysroot /home/fred/raspberrypi/rootfs/lib/arm-linux-gnueabihf
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initialisers
and track explicitly loaded dynamic code.
(gdb)
The target side behaved as would be expected:
fred#UbuntuMATE-Pi:~/Hello_Raspberry_Pi$ gdbserver 192.168.0.7:2345 Hello_Raspberry_Pi
Process Hello_Raspberry_Pi created; pid = 17363
Listening on port 2345
Remote debugging from host 192.168.0.7
So perhaps Unable to find dynamic linker breakpoint function. is a big clue?
It would appear that I had defined Shared Libraries incorrectly. When I deleted this setting something closer to expected behaviour occurred. As shown below, however I there is still a warning that I would like to remove:
For help, type "help".
Type "apropos word" to search for commands related to "word".
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initialisers
and track explicitly loaded dynamic code.
0x76fd7a40 in ?? ()
Breakpoint 2, main () at ../src/Hello_Raspberry_Pi.cpp:18
18 cout << "I'm in the While loop and the value of variable i is: " << i << endl;
Breakpoint 1, main () at ../src/Hello_Raspberry_Pi.cpp:20
20 usleep(1000000); //wait for 1 seconds
So now Eclipse does breakpoint at main and permit stepping - finally!
I also faced problems similar to this, getting segmentation fault from ld.so. Did the following steps to fix it.
Install libc6-dbg package in both sysroot and target.
create a folder /lib/.debug in both sysroot and target.
copy /usr/lib/debug/lib/arm-linux-gnueabihf/ld-2.23.so to /lib/.debug in both sysroot and target.