sgjava

Members
  • Content Count

    153
  • Joined

  • Last visited

 Content Type 

Forums

Member Map

Store

Crowdfunding

Raffles

Applications

Everything posted by sgjava

  1. They manage OpenCV on github, so I think that would be great to continue there for Armbian. Jira is chock full of unnecessary complexity. We use it at work and you become a slave to the process instead of programming. This is really the only method that really works http://programming-motherfucker.com
  2. https://github.com/sgjava/userspaceio After a lot of work and testing I have produced the User Space IO project! It provides Python 3 and Java 8 bindings for Linux user space GPIO, SPI, I2C, PWM and Serial interfaces. This allows cross SBC and cross language development using a common API. I took two best of breed C APIs for Linux user space libgpiod and c-periphery and produced CFFI bindings for Python and JNA bindings for Java. Since all the bindings closely match the C API it's easy to move from language to language. The side effect of using the Java library is that it should work with many different JVM based languages. How about creating your programs in Kotlin or Scala for instance? GPIO access uses the new gpiod interface and not the deprecated sysfs interface using libgpiod v1.1 (head from git repo). GPIO, SPI, I2C and serial interfaces expose all the low level functionality. I have added some helper methods for handling repetitive functions like building I2C messages, reading words from two registers, etc. You can of course go as low level as you need to. Please use Github to post any issues, pull requests, etc. I have tested Nano Pi Duo for 32 bit and NanoPi Neo +2 for 64 bit compatibility. I'll test more SBCs as I have time. Also, I have deleted https://github.com/sgjava/libgpiod-extra since User Space IO supersedes it. Based of some of the questions I had in the past please note the following: gpiod_ctxless_event_loop_multiple can handle GPIO interrupts Miscellaneous GPIO request flags GPIOD_LINE_REQUEST_FLAG_OPEN_DRAIN, GPIOD_LINE_REQUEST_FLAG_OPEN_SOURCE, GPIOD_LINE_REQUEST_FLAG_ACTIVE_LOW Non-root access using rc.local. Demo program using hardware PWM to flash LED:
  3. sgjava

    Adafruit CircuitPython

    Yea, I understand trying to consolidate behind a single library, but I prefer using a single API and wrapping that with whatever language I want. It's a matter of perspective I guess. For beginners it may make sense to make it easy to use. @TonyMac32 The Java code performs pretty well using JNA instead of JNI.
  4. sgjava

    Adafruit CircuitPython

    https://github.com/sgjava/userspaceio supports C, C++, Python and JVM (Java, Scala, Koltin, etc.). Do we really need another Python lib besides WiringPi and RPi.GPIO? Also, I have non-root access working for pretty much everything. Another thing, from looking at the CircuitPython site it appears to only support micro controllers at this point, not a full blown SBC. For this type of stuff I'm using NodeMCU with Lua which is mature and is hard to beat from a price/performance/usability perspective.
  5. sgjava

    Use GPIO on C2 with Mainline Kernel

    @adafruit what library are you using on the C2 for GPIO/I2C/SPI, etc?
  6. sgjava

    Use GPIO on C2 with Mainline Kernel

    @Igor thanks for getting that in!
  7. sgjava

    Nanopi Duo USB CAM Error

    I've had success with NanoPi Duo v1.1 and using the OTG port. I power off the rail instead of OTG port. The thing is I use the FriendlyElec DTB as the Armbian one doesn't support the OTG port. Now I'm using a different USB camera than you, but that may give you some config ideas. Also, I'd try the official FriendlyElec image and make sure it works.
  8. sgjava

    Use GPIO on C2 with Mainline Kernel

    @TonyMac32 ESP8266 Module ESP-12E NodeMcu is what is shown in the picture. There's decent IDEs and Lua is pretty easy to pick up. Having the built in USB serial interface makes it easy to program/power.
  9. sgjava

    Use GPIO on C2 with Mainline Kernel

    @TonyMac32 Correct, check the C1 wiki https://wiki.odroid.com/odroid-c1/application_note/gpio/spi#c1 It might be a easier way to do SPI on the C2 and fall in line with how HardKernel does it. I think between this and the networking being cleaned up it will be easier to use the C2 with Armbian. I'm actually using the C2 as a server and started using NodeMCUs for some device interfacing projects. Sometimes 4 cores and 2G RAM are overkill for simpler projects like my weather station (and NodeMCU is $3.59 delivered):
  10. sgjava

    Use GPIO on C2 with Mainline Kernel

    @TonyMac32 Thanks for moving this forward. I guess with software SPI it will have limited bandwidth. Odroid C1 has you load spicc module and not mess with the device tree.
  11. It seems the networking in Armbian 5.59 is messed up. It creates a eth0 adapter (disabled) and Wired network 1 adapter. You can delete these in nmtui, but they always return. I had the same issue with NanoPi Duo using mainline Stable. I can get it to work a bit using armbian-config, removing all interfaces and configuring IP, but it gets screwed up again. I cannot trust to run 5.59 headless because I have no way to get into the SBC without hooking video back up.
  12. sgjava

    Use GPIO on C2 with Mainline Kernel

    @TonyMac32 OK, it uses pins 19 and 20 like Pi and C1. I used a loopback wire and ran a simple Python script: import spidev input = [1 ,2 ,3, 4, 5] print("input: %s" % input) spi = spidev.SpiDev() spi.open(0,0) output = spi.xfer2(input) print("output: %s" % output) python3 spitest.py input: [1, 2, 3, 4, 5] output: [1, 2, 3, 4, 5] So I'm confident gpio, i2c and spi are working. If your changes can be committed for the C2 Armbian build that would be most excellent. @nik-ii For UserSpace IO issues please use my github issues page otherwise it looks like everything works. I tested UserSpace IO with C2. Here's the SPI loopback in Python: python3 spiloopback.py --device /dev/spidev0.0 --maxSpeed 500000 255 128 and Java: java -Djna.nosys=true -Djava.library.path=/usr/local/lib -cp ../../jnaerator/jna-4.5.2.jar:../../jnaerator/jnaerator-runtime.jar:libperiphery.jar:demo.jar com.codeferm.demo.SpiLoopback /dev/spidev0.0 500000 FF, 80
  13. sgjava

    Use GPIO on C2 with Mainline Kernel

    @TonyMac32 I'll try that and see if loop back works.
  14. sgjava

    Use GPIO on C2 with Mainline Kernel

    @TonyMac32 The following works on the C2: gpiodetect gpiochip0 [aobus-banks] (15 lines) gpiochip1 [periphs-banks] (119 lines) sudo i2cdetect -l i2c-1 i2c DesignWare HDMI I2C adapter i2c-0 i2c Meson I2C adapter I2C adapter ./spidev_test -D /dev/spidev0.0 spi mode: 0 bits per word: 8 max speed: 500000 Hz (500 KHz) I need to figure out the MOSI and MISO pins since it's software, but it looks like all the major subsystems are cranking. It doesn't appear the C2 has pins for SPI? https://wiki.odroid.com/odroid-c2/hardware/expansion_connectors I did get SPI working on C1 here https://forum.odroid.com/viewtopic.php?f=116&t=26674
  15. sgjava

    Use GPIO on C2 with Mainline Kernel

    @nik-ii Take a look at https://github.com/sgjava/userspaceio/issues/2#issuecomment-427615183 I had to update the JNA lib in the Java scripts. Please follow up on github with UserSpaceIO specific issues.
  16. sgjava

    Use GPIO on C2 with Mainline Kernel

    @nik-ii I'm going to install on my C2 and see what's up.
  17. sgjava

    Use GPIO on C2 with Mainline Kernel

    @TonyMac32 OK, I get /dev/spidev0.0 now! I'll do a SPI loopback test tomorrow since I have to take it out of the server rack It's full now, but this gives you an idea:
  18. sgjava

    Use GPIO on C2 with Mainline Kernel

    @TonyMac32 So I just install the deb packages with my current release? I downloaded them and will try tomorrow.
  19. sgjava

    Use GPIO on C2 with Mainline Kernel

    @TonyMac32 No problem, I just got online at home.
  20. sgjava

    Use GPIO on C2 with Mainline Kernel

    @TonyMac32 I like option one Send me a link and I'll try tonight.
  21. sgjava

    Use GPIO on C2 with Mainline Kernel

    @TonyMac32 Will this be in the form of a nightly build, or do I need to build it?
  22. sgjava

    Use GPIO on C2 with Mainline Kernel

    @TonyMac32 I believe the C2 is software SPI. @nik-ii See Tony's reply above, but it looks like I2C and GPIO are enabled. UserSpace IO components can be used individually. In other words I can use just GPIO if it's enabled. You can try a simple flashing LED example.
  23. sgjava

    Use GPIO on C2 with Mainline Kernel

    @TonyMac32 Let me know if I can test something else like a new build.
  24. sgjava

    Use GPIO on C2 with Mainline Kernel

    @TonyMac32 I loaded that module and: lsmod | grep spi spi_meson_spifc 16384 0 spi_bitbang 16384 0 spidev 20480 0 But still no /dev/spi*
  25. sgjava

    Use GPIO on C2 with Mainline Kernel

    @nik-ii OK, I had some time to play around with my C2 which already had Armbian Stretch installed: Linux hostname 4.18.8-odroidc2 #264 SMP PREEMPT Wed Sep 19 12:35:18 CEST 2018 aarch64 GNU/Linux armbian-config has no Hardware menu, but it looks like GPIO and I2C are already enabled: ls /dev/gpio* /dev/i2c* /dev/spi* ls: cannot access '/dev/spi*': No such file or directory /dev/gpiochip0 /dev/gpiochip1 /dev/i2c-0 /dev/i2c-1 If you go to the Odroid C2 wiki you can follow the steps to enable SPI: sudo su - modprobe spidev modprobe spi_gpio modprobe: FATAL: Module spi_gpio not found in directory /lib/modules/4.18.8-odroidc2 modprobe spi_bitbang lsmod | grep spi spi_bitbang 16384 0 spidev 20480 0 ls /dev/spi* ls: cannot access '/dev/spi*': No such file or directory I'm not sure what's going on here because this works with the HardKernel OS images. I'm actually using my C2 as a Jenkins CI server, but I did play around and made sure gpio, i2c and spi worked. I believe that was a 3.x kernel though @Igor may be able to point you in a better direction to get SPI cranking. There are other drivers, but I'm not sure which one to use: ls /lib/modules/4.18.8-odroidc2/kernel/drivers/spi spi-bitbang.ko spi-butterfly.ko spidev.ko spi-lm70llp.ko spi-meson-spifc.ko