Getting back to RIO AHRS install after a loooong time

8 years 7 months ago - 8 years 6 months ago #29530199 by RobMeades
Hi there. I'm getting back to running the RIO AHRS on my Raspberry Pi under ARCH Linux after a year's absence. HW is unchanged (Pi model B). I have entirely re-built the ARCH Linux SD card after a dodgy upgrade and have now used your reference ARCH Linux install script rather than my old one. I know everything used to work a year ago but now I don't get the nice fast-flashing green LED, just the boring slow one.

If I run picocom to talk to /dev/ttyAMA0 at 115200 then the AHRS does respond:
AI?
AI=34:16:47:17:16:22:18:14:0:0:21:16:42
So it is there on the serial port (FID=Roboteq v1.2 RIOAHRS 09/18/2013). However rioboard_test shows me zeros for all the data:
[pi@RoboOne riofiles]$ sudo ./rioboard_test
DBG: RioBoard Shared Memory ID=0; Run "ipcs -m" command to verify
DBG: RioBoard Shared Memory segment attached to process at [0xb6f33000]
INFO: RioInit() call - OK
ANAIN: A[1]=0x0, A[2]=0x0, A[3]=0x0, A[4]=0x0, A[5]=0x0, A[6]=0x0, A[7]=0x0, A[8]=0x0, A[9]=0x0, A[10]=0x0, A[11]=0x0, A[12]=0x0, A[13]=0x0
DIN: 0x0
in.TimeStamp: 0
in.flags: 0x0
RioIsPresent(): Yes
Gyro[X,Y,Z] : (0, 0, 0)
Accel[X,Y,Z]: (0, 0, 0)
Mag[X,Y,Z]  : (0, 0, 0)
Angle[X,Y,Z]: (0, 0, 0)

ttyAMA0 is definitely disabled:
[pi@RoboOne ~]$ systemctl status serial-getty@ttyAMA0.service
* serial-getty@ttyAMA0.service
   Loaded: masked (/dev/null)
   Active: inactive (dead)
The problem seems to lie with the deamon, which is not starting:
[pi@RoboOne ~]$ sudo systemctl status -l rioboard_d.service
* rioboard_d.service - RioBoard daemon
   Loaded: loaded (/etc/systemd/system/rioboard_d.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2015-02-22 13:57:25 GMT; 54s ago
  Process: 379 ExecStart=/usr/sbin/rioboard_d (code=exited, status=0/SUCCESS)
 Main PID: 380 (code=exited, status=255)

Feb 22 13:57:25 RoboOne systemd[1]: Started RioBoard daemon.
Feb 22 13:57:25 RoboOne systemd[1]: rioboard_d.service: main process exited, code=exited, status=255/n/a
Feb 22 13:57:25 RoboOne systemd[1]: Unit rioboard_d.service entered failed state.
Feb 22 13:57:25 RoboOne systemd[1]: rioboard_d.service failed.
Any idea what's up or any suggestions on debugging? One thing I noticed is that the install script tries to do things with /dev/spidev0 and there is no such device, don't know if that's relevant or not.

Rob

Please Log in or Create an account to join the conversation.

8 years 7 months ago - 8 years 7 months ago #29530200 by RobMeades
FYI, the spi driver is commented out by default in ARCH Linux [3.18.7-6-ARCH] (it being a minimalist thing), so you need to edit /boot/config.txt, uncomment it and reboot before installing rioboard. That hasn't fixed the problem though: I still get all zeroes out of rioboard_test and the rioboard_d.service still fails with status 255.

Just to show that installation is now fine, here's a terminal log:
[pi@RoboOne ~]$ sudo sh rio_board_install_Arch_Linux.sh
[sudo] password for pi:
----- Rio Board installation script for Arch Linux
----- Creating directory for Rio Board files ...
----- Downloading installation files for Rio Board ...
2015-02-22 15:23:36 URL:http://dev.roboteq.com/dev1/riofiles/RioBoardInstallFiles.zip [47639/47639] -> "RioBoardInstallFiles.zip.1" [1]
----- Changing file attributes for installation archive ...
----- Unpacking RioBoard installation files ...
Archive:  /riofiles/RioBoardInstallFiles.zip
  inflating: rioboard_d
  inflating: startup_script/rioboard_d
  inflating: rioboard.so
  inflating: libwiringPi.so.1.0
  inflating: rioboard_test
  inflating: raspio-src/makefile
  inflating: raspio-src/RioBoard.c
  inflating: raspio-src/RioBoard.h
  inflating: raspio-src/RioBoard_d.cpp
  inflating: raspio-src/RioBoard_d.h
  inflating: raspio-src/RioBoard_py.cpp
  inflating: raspio-src/rioboard_test.cpp
  inflating: librioboard.a
  inflating: rioboard_d.service
  inflating: raspio-src/rioboard_test.py
----- Setting file attributes for Rio Board files ...
----- Checking for previous version of Rio Board daemon ...
----- Removing the previous version of Rio Board daemon ...
Removed symlink /etc/systemd/system/multi-user.target.wants/rioboard_d.service.
----- Installing RioBoard daemon ...
Created symlink from /etc/systemd/system/multi-user.target.wants/rioboard_d.service to /etc/systemd/system/rioboard_d.service.
----- Installing wiringPi library
----- Fetching the recent firmware for RioBoard
2015-02-22 15:23:42 URL:http://dev.roboteq.com/dev1/riofiles/raspioF3-update.zip [66703/66703] -> "raspioF3-update.zip.1" [1]
Archive:  /riofiles/raspioF3-update.zip
  inflating: RaspioF3-v10-update-091913.bin
----- Removing installation archive ...
----- Checking if minicom is installed ...
minicom located
----- Asigning the alias riocom for minicom with pre-set parameters for RioBoard ...
----- Disabling the boot over serial port ...
Please reboot now.
Rob

Please Log in or Create an account to join the conversation.

8 years 7 months ago - 8 years 7 months ago #29530201 by RobMeades
After stopping and restarting it a few times, I now have systemctl saying that the daemon has been launched after a reboot (see below). However rioboard_test still only shows me zeros and the green LED is still at 1 Hz rather than 4 Hz. Also, as an experiment, if I try running rioboard_d as a process with:
[pi@RoboOne ~]$ sudo /riofiles/rioboard_d --run-as-process
...it doesn't actually launch a process at all:
[pi@RoboOne ~]$ ps aux | grep rio
pi         346  0.0  0.3   2600  1416 ttyUSB1  S+   16:08   0:00 grep rio
What else can I try?
[pi@RoboOne ~]$ sudo systemctl status rioboard_d.service
* rioboard_d.service - RioBoard daemon
   Loaded: loaded (/etc/systemd/system/rioboard_d.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since Thu 1970-01-01 01:00:14 BST; 45 years 1 months ago
  Process: 142 ExecStart=/usr/sbin/rioboard_d (code=exited, status=0/SUCCESS)

Jan 01 01:00:12 RoboOne systemd[1]: Starting RioBoard daemon...
Jan 01 01:00:14 RoboOne systemd[1]: Started RioBoard daemon.
Rob

Please Log in or Create an account to join the conversation.

8 years 6 months ago #29530221 by opal
Hello Rob,

As you see yourself from the code of the daemon,
if( wiringPiSPIDataRW( CHANNEL,(unsigned char*) xfer_buf, sizeof(xfer_buf)) < 0) {
   throw new CException("ERROR: Can't update data buffer over SPI");
}
wiringPiSPIDataRW() call fails.

Let's start from getting "/dev/spidev0". Please make sure it is there before starting the daemon.

By the way - good idea to test running the daemon as a process.

Regards

Please Log in or Create an account to join the conversation.

8 years 6 months ago - 8 years 6 months ago #29530222 by TechSupport
Thread topic has now been moved.
The following user(s) said Thank You: RobMeades

Please Log in or Create an account to join the conversation.

8 years 6 months ago #29530223 by RobMeades
Thanks for responding. Yes, I can confirm that the SPI driver is there now, see #29530200 above.

Please Log in or Create an account to join the conversation.

8 years 6 months ago #29530229 by opal
Hello,

Please make sure to use WiringPi.1.0. Don't use the new one.

Regards

Please Log in or Create an account to join the conversation.

8 years 6 months ago #29530237 by RobMeades
Yup:
[pi@RoboOne ~]$ ls /usr/lib/libwir*
/usr/lib/libwiringPi.so.1  /usr/lib/libwiringPi.so.1.0

Please Log in or Create an account to join the conversation.

8 years 6 months ago - 8 years 6 months ago #29530242 by mjepson
I'm having the same problem on an Raspbian Wheezy installation. But I do not have libwiringpi.so.* in my /usr/lib folder? It is in /riofiles though. Should I copy it by hand to /usr/lib?
[edit]Tried that, didn't work. Now I notice I don't have a single /dev/spidev0, but rather a /dev/spidev0.0 and a /dev/spidev0.1. Is that normal?[/edit]

Please Log in or Create an account to join the conversation.

8 years 6 months ago #29530244 by mjepson
I finally fixed it. I had to manually install libwiringPi from wiringpi.com/download-and-install/ (the latest version from git.drogon.net)
I then had to make a symbolic link:
sudo ln -s /usr/lib/libwiringPi.so /usr/lib/libwiringPi.so.1

Now it finally works!

Please Log in or Create an account to join the conversation.

Moderators: opal
Time to create page: 0.081 seconds