Jump to content

jarmx

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by jarmx

  1. @zador.blood.stained That worked, thank you very much
  2. I am trying to get software SPI to work. But I have some difficulties to get the driver working. I have added `CONFIG_SOFT_SPI=y` to `configs/orangepi_r1_defconfig` and added the following lines to the file in `arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts` but for some reason the driver is not getting probed. Can you see why this is? (probably a stupid mistake ) soft_spi: soft-spi { compatible = "spi-gpio"; cs-gpios = <&pio 0 13 0>; gpio-sck = <&pio 0 14 0>; gpio-mosi = <&pio 0 15 0>; }; (lines added to: `arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts` after the `aliases` node) => dm tree Class index Probed Driver Name ----------------------------------------- root 0 [ + ] root_drive root_driver simple_bus 0 [ + ] generic_si |-- soc phy 0 [ + ] sun4i_usb_ | |-- phy@1c19400 usb 0 [ + ] ehci_sunxi | |-- usb@1c1a000 usb_hub 0 [ + ] usb_hub | | `-- usb_hub usb 1 [ + ] ohci_sunxi | |-- usb@1c1a400 usb 2 [ + ] ehci_sunxi | |-- usb@1c1b000 usb_hub 1 [ + ] usb_hub | | `-- usb_hub usb 3 [ + ] ehci_sunxi | |-- usb@1c1c000 usb_hub 2 [ + ] usb_hub | | `-- usb_hub usb 4 [ + ] ohci_sunxi | |-- usb@1c1c400 gpio 0 [ + ] gpio_sunxi | |-- pinctrl@1c20800 gpio 1 [ + ] gpio_sunxi | | |-- PA gpio 2 [ + ] gpio_sunxi | | |-- PB gpio 3 [ + ] gpio_sunxi | | |-- PC gpio 4 [ + ] gpio_sunxi | | |-- PD gpio 5 [ + ] gpio_sunxi | | |-- PE gpio 6 [ + ] gpio_sunxi | | |-- PF gpio 7 [ + ] gpio_sunxi | | |-- PG gpio 8 [ + ] gpio_sunxi | | |-- PH gpio 9 [ + ] gpio_sunxi | | `-- PI eth 0 [ + ] eth_sun8i_ | |-- ethernet@1c30000 serial 0 [ + ] ns16550_se | |-- serial@1c28000 gpio 10 [ + ] gpio_sunxi | `-- pinctrl@1f02c00 gpio 11 [ + ] gpio_sunxi | `-- PL spi 0 [ ] soft_spi `-- soft-spi (output from U-Boot when issuing the `dm tree` command)
  3. It it possible that the SPI driver in uboot for sun4i only works for SPI0? I see lines like 'sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_SPI0);' inside the driver. Is there any know driver that works for SPI1?
  4. I want them to turn on immediately when you power the board, booting to userspace takes around 15 seconds. I have SPI sort of working now. I can send data to the leds but they only set the data when I disconnect and reconnect the MISO wire. Seems like a issue with the line not pulling up / down. Not sure how to fix this though.
  5. I am using 4 WS2812B leds. When booted in armbian I control them using this python library: https://github.com/joosteto/ws2812-spi.
  6. Hi all, I have a OrangePi R1 and want to enable SPI in U-Boot to talk to connected leds. The leds are connected to SPI0 on the pins: 19 (MOSI), 4 (5v) and 6 (GND) . I enabled the CONFIG_SUN4I_SPI flag to enable the sunxi SPI driver. I also added the following lines to `arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts` to enable both SPI0 and SPI1. &spi0 { status = "okay"; flash@0 { compatible = "mxicy,mx25l12805d", "jedec,spi-nor"; }; }; &spi1 { status = "okay"; }; To control the leds I added a call to the following function inside the `board_init()` function inside: `/board/sunxi/board.c`. static int set_leds() { int bus = 0; int cs = 1; int mode = 0; struct spi_slave *slave; int ret = 0; printf("set_leds"); char name[30], *str; struct udevice *dev; snprintf(name, sizeof(name), "generic_%d:%d", bus, cs); str = strdup(name); if (!str) return -ENOMEM; ret = spi_get_bus_and_cs(bus, cs, 38095, mode, "spi_generic_drv",str, &dev, &slave); if (ret) return ret; ret = spi_claim_bus(slave); if (ret) goto done; uchar dout[2]; uchar din[2]; int bitlen = 16; ret = spi_xfer(slave, bitlen, dout, din, SPI_XFER_BEGIN | SPI_XFER_END); done: spi_release_bus(slave); spi_free_slave(slave); } (please note that I am not transferring the actual data needed by the leds in this sample code) When I flash the bootloader the leds wont respond (but I see the message printed in the console). I don''t have an oscilloscope so I am not able to see if the `spi_xfer` function actual sends the data. So my question is does this code look okey? Or is there something I am missing?
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines