Blars Posted February 24, 2017 Share Posted February 24, 2017 WS2812B when run at 5v require more than 3.3v for logic high. So a logic level converter is needed for reliable operation. Link to comment Share on other sites More sharing options...
madsci1016 Posted February 24, 2017 Share Posted February 24, 2017 hi there, please, I have orange pi lite and using spi to control ws2812b. My problem is, that firs led is green (when other are off), when I set all to blue first led is blue too, when all to green first is green, when all to red first is yellow. Any idea what is causing this issue? Or any idea how to leave first LED off completely rather than being green? Thanks. UPDATE: I found out GREEN is always in up (turned on) state for first LED in strip. So according to my opinion, final last data are somehow corrupted and therefore green part of first led is in "ON" state. Would you mind sharing all the details on your software setup? I'm trying to test driving ws2812 from the SPI on a Orange Pi zero and having no luck. Generally, I can't figure out how to enable the SPI port. spidev isn't in /dev. Now I'm a noob, and have no idea what device tress are or how to edit/compile them. I'm using the ubuntu nightly image from here: https://dl.armbian.com/orangepizero/nightly/ Link to comment Share on other sites More sharing options...
zador.blood.stained Posted February 25, 2017 Share Posted February 25, 2017 If you are saying Now I'm a noob, and have no idea what device tress are or how to edit/compile them. then you should not be using nightly images and dev kernel. These images are only for developers and advanced users, regardless of their possible advantages and improvements over stable images. If you grab a stable image from the download page you can enable SPIdev by editing /boot/script.bin, there are enough tutorials and posts about this. Link to comment Share on other sites More sharing options...
zakk Posted February 27, 2017 Share Posted February 27, 2017 That is normal. The way using "cat" is making things really dynamic, and yes you could add it into rc.local, but there is an easier way since few weeks : Simply add the following in /boot/armbienEnv.txt : overlays=sun8i-h3-spi0-spidev This will make uboot load it for you on every boot. Thank you so much martinayotte ! it works now, but I got the following messages when dmesg. Is the spidev0.0 running correctly? I tested with simple c code with spi fuction and everything fine while communicated via the spidev0.0 ===================================================================================== [ 9.266925] spidev spi0.0: buggy DT: spidev listed directly in DT [ 9.266936] ------------[ cut here ]------------ [ 9.266968] WARNING: CPU: 0 PID: 307 at drivers/spi/spidev.c:760 spidev_probe+0x146/0x15c [spidev] [ 9.266970] Modules linked in: spidev(+) sun8i_ths uio_pdrv_genirq uio cpufreq_dt gpio_keys thermal_sys brcmfmac brcmutil cfg80211 rfkill fuse [ 9.267020] CPU: 0 PID: 307 Comm: systemd-udevd Not tainted 4.10.0-sun8i #3 [ 9.267023] Hardware name: Allwinner sun8i Family [ 9.267067] [<c010b6ed>] (unwind_backtrace) from [<c0108d33>] (show_stack+0xb/0xc) [ 9.267088] [<c0108d33>] (show_stack) from [<c044f239>] (dump_stack+0x71/0x80) [ 9.267106] [<c044f239>] (dump_stack) from [<c011781d>] (__warn+0xad/0xc0) [ 9.267117] [<c011781d>] (__warn) from [<c011789b>] (warn_slowpath_null+0x13/0x18) [ 9.267133] [<c011789b>] (warn_slowpath_null) from [<bf91a233>] (spidev_probe+0x146/0x15c [spidev]) [ 9.267162] [<bf91a233>] (spidev_probe [spidev]) from [<c0508f99>] (spi_drv_probe+0x51/0x70) [ 9.267176] [<c0508f99>] (spi_drv_probe) from [<c04bf81b>] (driver_probe_device+0x17b/0x1f0) [ 9.267188] [<c04bf81b>] (driver_probe_device) from [<c04bf8ed>] (__driver_attach+0x5d/0x60) [ 9.267197] [<c04bf8ed>] (__driver_attach) from [<c04be5b5>] (bus_for_each_dev+0x2d/0x4c) [ 9.267209] [<c04be5b5>] (bus_for_each_dev) from [<c04bf141>] (bus_add_driver+0x10d/0x16c) [ 9.267219] [<c04bf141>] (bus_add_driver) from [<c04bfe43>] (driver_register+0x33/0x84) [ 9.267233] [<c04bfe43>] (driver_register) from [<bf91d073>] (spidev_init+0x72/0x97 [spidev]) [ 9.267250] [<bf91d073>] (spidev_init [spidev]) from [<c01016dd>] (do_one_initcall+0x2d/0x104) [ 9.267267] [<c01016dd>] (do_one_initcall) from [<c0196355>] (do_init_module+0x45/0x14c) [ 9.267286] [<c0196355>] (do_init_module) from [<c0170f91>] (load_module+0x141d/0x16cc) [ 9.267303] [<c0170f91>] (load_module) from [<c0171375>] (SyS_finit_module+0x51/0x5c) [ 9.267321] [<c0171375>] (SyS_finit_module) from [<c0105ce1>] (ret_fast_syscall+0x1/0x4c) [ 9.267327] ---[ end trace 0eaff8ad790dbae6 ]--- ===================================================================================== Link to comment Share on other sites More sharing options...
martinayotte Posted February 27, 2017 Share Posted February 27, 2017 spidev spi0.0: buggy DT: spidev listed directly in DT Yes, this is a normal warning. 1 Link to comment Share on other sites More sharing options...
cu6apum Posted March 3, 2017 Share Posted March 3, 2017 Hi there. Newbie here! Would anyone please point me on a place in the datasheet where the maximum SPI speed for H3 is indicated? Thank you. Link to comment Share on other sites More sharing options...
zador.blood.stained Posted March 3, 2017 Share Posted March 3, 2017 1 hour ago, cu6apum said: Would anyone please point me on a place in the datasheet where the maximum SPI speed for H3 is indicated? Thank you. https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/drivers/spi/spi-sun6i.c?id=0b06d8cf4f9307887d52776d77bdbc8d6dd9d98d This applies to H3 since H3 SPI controller is very close to A31 one. Link to comment Share on other sites More sharing options...
gebn Posted March 8, 2017 Share Posted March 8, 2017 (edited) Spoiler hello all, I have compiled the latest kernel for the orange pi plus since i needed a kernel of at least 3.19rc1 due to the updated usbtv kernel module. Was just wondering if there are some steps outlined somewhere inorder to enable spidev? i dont get an spidev0 in /dev/. i have read through this board and also ran some searches but couldnt find anything of use except for patches for the OPi PC and on an older kernel i think Thanks and good day must have missed it alongst reading , still an early morning for me, will try martinayotte's arbienenv edit! Edited March 8, 2017 by gebn oops, delete if found necessary Link to comment Share on other sites More sharing options...
jbird1 Posted October 8, 2017 Share Posted October 8, 2017 So I have armbian Linux OPi 4.13.3-sunxi #3 SMP Fri Sep 22 08:48:49 PDT 2017 armv7l armv7l armv7l GNU/Linux ubuntu 16.4.3 built from the daily build tree, used 4x build default opens for standard release on 4.x. I am running Orange Pi 2 Plus, has latest FW, we ran config to turn on all the overlays for SPI, I2C, SSH, VNC etc. Config is different from armbian-config. And there is no option for setting SPI0. My existing code prior to 4.x ran just fine on it and RPi 3's, I recompiled test code, updated and upgraded, is see /dev/spidev0.0 crw--------, which looks normal. tree does not show usual spi tree. This code is very simple runs MCP3008 8 port 10 bit ADC. I am using CS = 0 which 4x new armbian-config does not work with (And command line armbian-config is different from gui shortcut). It only has CS=1. I edit the armbianEnv.conf by hand as below. In armbianEnv.conf looks like this. verbosity=1 logo=disabled console=both disp_mode=1920x1080p60 overlay_prefix=sun8i-h3 rootdev=UUID=6f779325-6f4f-42bb-a6c1-63e4f5543fbb rootfstype=ext4 overlays=spi-spidev i2c0 i2c1 i2c2 pps-gpio pwm spi-add-cs0 uart1 uart2 uart3 usbhost0 usbhost2 usbhost3 w1-gpio param_spidev_spi_bus=0 #param_spidev_spi_cs=0 param_spidev_max_freq=100000000 usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u I checked blacklist its same as before. This is the error I get now, where before code run correctly. root@OPi:/home/j/Desktop/mcp3008# ./testspi starting mcp3008test on channel 0 Reading data from: 0 writing command 1 1 0transmit failed spi data ... ioctl failed : Invalid argument What did I miss, thanks for your help appreciate it. I suspect I did something stupid. I am updating my app note on this so if we can get it working I will send you a copy to same with anyone who needs help. All the best, J buildit.sh mcp3008.cpp mcp3008Spi.h mcp3008test.cpp Link to comment Share on other sites More sharing options...
azmathmoosa Posted January 5, 2018 Share Posted January 5, 2018 I am using mainline kernel 4.11.2 and NanoPi Neo board (H3 chipset). SPIDEV works and shows up in /dev/spidev0.0. But I am having trouble communicating with an SPI device. I hooked up a logic analyzer and observed that in SPI Mode 0 (CPOL=0, CPHA=0), right before the chip select goes down (Active Low), the SCK suddenly rises and falls. This causes my spi module (an NRF24L01 chip) to not output proper register values. That module only supports SPI Mode 0. For testing purposes I am using a speed of 10KHz but 8MHz exhibits the same behaviour. When I use SPI Mode 3, (which is logical inverse of Mode 0 for SCK line) it works properly. But my module nrf24 module only supports Mode 0. I have also tried kernel 4.14.0, 4.10.0 and same issue. Can someone tell me which exact kernel version works with spidev? Link to comment Share on other sites More sharing options...
Larry Bank Posted March 16, 2018 Share Posted March 16, 2018 On 1/24/2017 at 11:26 AM, peter12 said: hi there, please, I have orange pi lite and using spi to control ws2812b. My problem is, that firs led is green (when other are off), when I set all to blue first led is blue too, when all to green first is green, when all to red first is yellow. Any idea what is causing this issue? Or any idea how to leave first LED off completely rather than being green? Thanks. UPDATE: I found out GREEN is always in up (turned on) state for first LED in strip. So according to my opinion, final last data are somehow corrupted and therefore green part of first led is in "ON" state. Did you ever find a solution to this? I'm trying to control NeoPixels from an Orange Pi Lite and I'm seeing the same issue. The first LED being green means the problem is occurring at the beginning of the data stream, not the end. P.S. I've been soldering together individual ones and I've found a few bad ones. Not sure if I fried them from too much heat or they were defective. Link to comment Share on other sites More sharing options...
peter12 Posted April 13, 2018 Share Posted April 13, 2018 On 16. 3. 2018 at 9:40 PM, Larry Bank said: Did you ever find a solution to this? I'm trying to control NeoPixels from an Orange Pi Lite and I'm seeing the same issue. The first LED being green means the problem is occurring at the beginning of the data stream, not the end. P.S. I've been soldering together individual ones and I've found a few bad ones. Not sure if I fried them from too much heat or they were defective. Yes, I did. It was long time ago but I think it was something like reset latch pulse for LED at the start was needed. Link to comment Share on other sites More sharing options...
gebn Posted April 16, 2018 Share Posted April 16, 2018 On 4/13/2018 at 5:11 PM, peter12 said: Yes, I did. It was long time ago but I think it was something like reset latch pulse for LED at the start was needed. Same here, just got me a ws2813B strip (same as ws2812 but with a backup data line) and used hyperion.ng to drive with, edit to /libsrc/leddevice/dev_spi/LedDeviceWs2812SPI.cpp where unsigned spi_ptr = 3 and compiled, driving leds with 30000000 baudrate and have no issues. Link to comment Share on other sites More sharing options...
Recommended Posts