Mar 2, 2019 - 8:30 PM

  • Any chance of creating packages for the hardware? Like ones to add to standard Ubuntu install?
    Quite frankly the original images are a mess.. Regular Ubuntu/lubuntu installs are much better and user friendly even if they don't have all the hardware addons..

  • I haven't bothered to create any packages myself, but I did work out a process to get all of the custom libraries and services for the GPIO and I2C Python and Node.js samples copied over and running on a fresh install of Lubuntu 18.04 LTS. I've got a tar.gz of all that is needed so it's a matter of extracting that to a fresh install and then installing the required applications, getting the DKMS modules installed and configured as services to run at boot, etc... I'll work-up a document for it and post the archive file if anyone is interested. It's not that involved honestly, just a little tedious. But... you'll have a good working knowledge of what is doing what on the AtomicPi after you run through it.

  • I would like to get the tar.gz file from you and whatever you have for the document if you are able to send it to me. Thank you for taking the time to put it together.

  • I should be able to put the document together over the weekend and will post a link here to the doc and archive file when it's ready.

  • For anyone that is interested in getting the example apps running on a fresh install of Lubuntu 18.04 LTS (shouldn't be much of an issue using it on other distros that are Debian-based as well.) I've bundled all of the items that I've found that were specific to running the sample apps on the original AtomicPi Lubuntu install and placed them in an archive file here:

    and a list of steps to implement the archive components:

    There are quite a few other things that are unique to the AtomicPi Lubuntu image as opposed to a plain Lubuntu install, but I only focused on those items that appeared to be necessary to get the Python and Node.js sample apps working. It is not intended to take a plain Lubuntu 18.04 LTS install and transform it into an exact copy of what comes installed on a stock AtomicPi.

    I haven't had a chance to see what, if anything, has changed with regards to the Python and Node.js samples or the gpio, i2c, spi DKMS modules between the original KS AtomicPi image and the updated images that were recently released on the DLI site. I'll update the docs/files linked to above as I can based on any changes that I happen to find, however.

    If anyone finds issues, errors, typos or improvements to the above let me know and I'll make any necessary updates.

    This post was edited Mar 10, 2019 03:48AM
  • Thank you again for your help. I am not able to progress beyond:

    cd /usr/src/i2c-gpio-custom-0.1.1/
    sudo dkms add i2c-gpio-custom/0.1.1

    It cannot find the module source directory. I am in the /usr/src/i2c...0.1.1/ directory while running the sudo dkms add command.

    This post was edited Mar 12, 2019 08:18AM
  • Hi Rebecca,

    A few questions... can you confirm that the following files are present in /usr/src/i2c-gpio-custom-0.1.1/

    dkms.conf, i2c-gpio-custom.c, Makefile

    Also, please post the output of: uname -a

    Lastly (for now), what is the directory listing of /usr/src on your AtomicPi? We need to ensure the correct Linux kernel header files are present there as well.

  • Hi,

    All three files exist in that directory.

    uname -a results:

    Linux atomicpi-MF-001 4.18.0-16-generic #17~18.04.1-Ubuntu SMP Tue Feb 12 13:35:51 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

    The directory listing is different because I had to do a fresh install and wipe everything on my second pi. None of the images worked and one partition (half of the space) was not usable.

    The directory is atomicpi@atomicpi-MF-001:~/usr/src/i2c-gpio-custom-0.1.1$

  • For the directory listing I was referring to all subdirectories listed under /usr/src and not just the one for the i2c-gpio-custom DKMS module. Based on the output of uname -a , though, you should have a directory called /usr/src/linux-headers-4.18.0-16-generic and one called /usr/src/linux-headers-4.18.0-16 (without the -generic)

    Can you verify those linux-headers directories mentioned above exist as well?

    Also, if you point me to the link to download the image/installer that you used to install Ubuntu I could give that a try in the next few days to see if I can reproduce the issue on the exact version you are using if this doesn't turn out to be just a missing header files issue.

    Edit: I just noticed, however, based on the output you show (command prompt above) that it appears you are actually inside your home directory and not at the root of the filesystem (due to the ~/usr/...) That will certainly cause the process I outlined to have issues since it is based on everything being done from / and not ~/ so the dkms process will not find the directory as evidenced by the error you are getting, since it is looking for / and not ~/

    If you issue: pwd from the directory you are in above you will be in: ~/home/atomicpi/usr/src/i2c-gpio-custom-0.1.1

    It should be: /usr/src/i2c-gpio-custom-0.1.1

    This post was edited Mar 12, 2019 12:01PM
  • My apologies. Once I changed to the real root directory, I was able to get to the sudo dkms install spi-gpio-custom/0.1 line before receiving an error:

    atomicpi@atomicpi-MF-001:/usr/src/spi-gpio-custom-0.1$ sudo dkms install spi-gpio-custom/0.1

    Kernel preparation unnecessary for this kernel. Skipping...

    Building module:
    cleaning build area....
    make -j4 KERNELRELEASE=4.18.0-16-generic all KVERSION=4.18.0-16-generic....(bad exit status: 2)
    ERROR (dkms apport): binary package for spi-gpio-custom: 0.1 not found
    Error! Bad return status for module build on kernel: 4.18.0-16-generic (x86_64)
    Consult /var/lib/dkms/spi-gpio-custom/0.1/build/make.log for more information.

    I have six /usr/src/linux-headers directories (three generic and three without generic)


    I downloaded the linux software from the Ubuntu website but I did not save the link. I had tried all three images provided by the Digital Loggers group and the only one that worked at all was the Debian version and it was unstable.

    I apologize for being obtuse - as mentioned before, I have not used Linux or Ubuntu/LUbuntu until now. This has been a learning experience, albeit a slow one.

  • Can you post the content of: /var/lib/dkms/spi-gpio-custom/0.1/build/make.log here?

    As a side note, my build log was located in a different path that included the kernel version, so that is a bit of a clue. Mine was here: /var/lib/dkms/spi-gpio-custom/0.1/4.15.0-46-generic/x86_64/log

    It may be that we need to modify the Makefile or dkms.conf for the kernel version you are running. Otherwise I can just post the compiled module for you install to get things going. However, you can actually skip the spi-gpio-custom steps for now as I do not believe the examples use that module. Or course if you want to work with the SPI interface you'll need it.

  • The only directories I have under /var/lib/dkms/spi-gpio-custom/0.1 are build and source.

    atomicpi@atomicpi-MF-001:/var/lib/dkms/spi-gpio-custom/0.1$ ls
    build source

    When I try to locate 4.15.0-46-generic, nothing is found.

  • I have taken enough of your time. I will try to finish playing around with this APi and then switch back to the other to play around with the sample files, etc.

    Thank you for helping and taking the time to share the files and instructions.

  • You wouldn't likely find /var/lib/dkms/spi-gpio-custom/0.1/4.15.0-46-generic/ on your install since you are not running that version of the kernel (I am, however) If such a path existed on your API it would be /var/lib/dkms/spi-gpio-custom/0.1/4.18.0-16-generic (the kernel you are running). The fact that it doesn't exist is probably a indication of the underlying issue, however.

    No problem. Happy to help. The problems you are seeing could very well be related to the newer kernel you are running on that particular API as compared to the version that I tested against.

  • I had no problem, as far as I can tell, with the install of the packages; I'm trying them on a clean install of Ubuntu MATE.

    However, when I run the test programs for the bno055, either python or node js, they fail. The error messages tell me failed to set address when running node js, and if running the python program no such file or directory /dev/i2c-50.

    I'm assuming this is due to me not trying this on the stock Lubuntu install, but rather on an install of Ubuntu MATE instead.

    The LED test programs run fine.

  • What version of Ubuntu MATE did you install? 18.04 LTS or 18.10 LTS? If you let me know that and what kernel version you are running (in case you've installed any updates) I'll try it on mine and see if I can determine what might be causing this.

    Also, try running the following to manually load the i2c kernel module and let me know if you get any errors:
    sudo modprobe i2c-gpio-custom bus0=50,476,480

    If you run the above modprobe command and receive no errors have a look and see if the /dev/i2c-50 character device now exits.

    The output of: ls -ld /dev/i2c-50
    should look like: crw-rw---- 1 root i2c 89, 50 Mar 12 19:59 /dev/i2c-50

    If the modprobe command runs without errors and the /dev/i2c-50 character file exits then the bn055 examples 'should' work.

    If you are receiving the error about the file /dev/i2c-50 not being present then there is an issue with the i2c-gpio-custom.service either not starting at all or erroring-out when trying to start. The service basically runs the modprobe command above to insert the kernel module when you run: sudo systemctl start i2c-gpio-custom
    and then modprobe -r when you run: sudo systemctl stop i2c-gpio-custom

    You can also try manually running the systemctl start/stop commands and then use: dmesg to display the kernel message buffer right after attempting to start/stop the i2c-gpio-custom service and get an idea of what might be going on. If the driver is loading you will see a message entry at the bottom of your dmesg output similar to:

    [265641.299237] PKCS#7 signature not signed with a trusted key
    [265641.299821] Custom GPIO-based I2C driver version 0.1.1
    [265641.300289] i2c-gpio i2c-gpio.50: using lines 476 (SDA) and 480 (SCL)

    Let me know how the above goes and if there are still errors I'll try installing the same Ubuntu version (and kernel version) on mine and see if I can determine what the issue is and a workaround for it.

    This post was edited Mar 15, 2019 10:52PM
  • Bear with me as my Linux skills are still very much novice level.

    Running Ubuntu 18.04.2 LTS, Kernel 4.15.0-46-genericx86_64.

    Trying to load the i2c module manually fails, tells me its not found in /lib/modules/4.15.0-46-generic (when I did the install processes, did not get any errors that I recall, though again, if something didn't happen as it should have, my skill-level with linux may not have caught it).

    Going to step thru the setup process in the doc again, and see if I notice any red flags this time.

  • So i went and re-did the dkms process to add/build/install the i2c module. No issues, no failures, and then when i did the sudo modprobe command, no failures.

    I then also confirmed the character device exists.

    And..the test program ran fine.

    Going to reboot and ensure nothing goes amiss when I do that.

    And...success! So it must have been something I messed up in the process the first time, and either didnt catch the error, or nothing was displayed indicating an error.

    Radu..thank you for all your help on this forum..your support is above and beyond, and its truly appreciated!

  • That's awesome news Don! Very glad to hear that it worked. Happy to help and share what I can. I'll be sure to post any updates I have for this or other projects I work on as well. Don't hesitate to post any other things you find that are interesting or questions you have. If someone can't answer it right away then I'm sure we can all figure it out together.

  • Good morning radu7.

    I am back to APi number 2.

    I still cannot get beyond the sudo dkms install spi-gpio-custom/0.1 step.

    The contents of the make.log file is:

    DKMS make.log for spi-gpio-custom-0.1 for kernel 4.18.0-16-generic (x86_64)
    Sun Mar 17 08:25:05 EDT 2019
    make -C /lib/modules/4.18.0-16-generic/build M=/var/lib/dkms/spi-gpio-custom/0.1/build modules
    make[1]: Entering directory '/usr/src/linux-headers-4.18.0-16-generic'
    Makefile:970: Cannot use CONFIG_STACK_VALIDATION=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel
    CC [M] /var/lib/dkms/spi-gpio-custom/0.1/build/spi-gpio-custom.o
    /var/lib/dkms/spi-gpio-custom/0.1/build/spi-gpio-custom.c: In function ‘spi_gpio_custom_add_one’:
    /var/lib/dkms/spi-gpio-custom/0.1/build/spi-gpio-custom.c:239:7: error: ‘struct spi_gpio_platform_data’ has no member named ‘sck’
    pdata.sck = params[BUS_PARAM_SCK];
    /var/lib/dkms/spi-gpio-custom/0.1/build/spi-gpio-custom.c:240:7: error: ‘struct spi_gpio_platform_data’ has no member named ‘mosi’
    pdata.mosi = gpio_is_valid(params[BUS_PARAM_MOSI])
    /var/lib/dkms/spi-gpio-custom/0.1/build/spi-gpio-custom.c:242:5: error: ‘SPI_GPIO_NO_MOSI’ undeclared (first use in this function); did you mean ‘IRQ_GC_NO_MASK’?
    /var/lib/dkms/spi-gpio-custom/0.1/build/spi-gpio-custom.c:242:5: note: each undeclared identifier is reported only once for each function it appears in
    /var/lib/dkms/spi-gpio-custom/0.1/build/spi-gpio-custom.c:243:7: error: ‘struct spi_gpio_platform_data’ has no member named ‘miso’
    pdata.miso = gpio_is_valid(params[BUS_PARAM_MISO])
    /var/lib/dkms/spi-gpio-custom/0.1/build/spi-gpio-custom.c:245:5: error: ‘SPI_GPIO_NO_MISO’ undeclared (first use in this function); did you mean ‘SPI_GPIO_NO_MOSI’?
    /var/lib/dkms/spi-gpio-custom/0.1/build/spi-gpio-custom.c:277:6: error: ‘SPI_GPIO_NO_CHIPSELECT’ undeclared (first use in this function); did you mean ‘SPI_GPIO_NO_MISO’?
    scripts/ recipe for target '/var/lib/dkms/spi-gpio-custom/0.1/build/spi-gpio-custom.o' failed
    make[2]: *** [/var/lib/dkms/spi-gpio-custom/0.1/build/spi-gpio-custom.o] Error 1
    Makefile:1534: recipe for target 'module/var/lib/dkms/spi-gpio-custom/0.1/build' failed
    make[1]: *** [module/var/lib/dkms/spi-gpio-custom/0.1/build] Error 2
    make[1]: Leaving directory '/usr/src/linux-headers-4.18.0-16-generic'
    Makefile:5: recipe for target 'all' failed
    make: *** [all] Error 2