Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

parameters for the SPI interface

Featured Replies

Hi,

 

I just joined up so I'm an extreme newbie here. I'm running the legacy trusty version of Armbian just downloaded. The HDMI display and USB ports are working fine. The Cubieboard2 is showing up in the network.

 

I need to get the SPI interface going to talk to a microcontroller -- an STM32F303. I've enabled the particular SPI port I need in the cubieboard2.fex file (derived from the stock cubieboard2.bin file) and created the cubieboard2.bin file in /boot/bin after backing up the original. After that change, I rebooted.

 

I got the /dev/spidev0.0 to show up. What do the parameters in the spi_board section mean? Is that documented somewhere?

 

Thanks,

 

Chris

Hallowell EMC

 

 

 

 

 

  • Author

Thanks for the links, but I have seen both of those. The only parameters that seem clear are max_speed_hz and full_duplex.

 

In reading the spi.h file, is seems as though the fex subsection called spi_boardN should be call spi_slaveN, which helps to make sense of the parameters in the board section such as the chip_select. Same idea maybe for the spiN_para corresponding to spiN_master.

 

But that doesn't explain the 1 to 1 correspondence always seen between the spiN_para and the spi_boardN entries. Its as though someone want me to think they're one to one. For spi0_para, there are two chip selects, so there could be two spi_boardN sections for that one spi interface if the spi_boardN section had a correspondence to a slave. An example in the Fex Guide illustrating that would go a long way!

 

Does the bus number N correspond to the spiN_para?

 

Are comments allowed in the fex file? They're really needed.

 

To really understand what those parameters mean, do I have to read the spidev code?

 

I'll look.

 

Thanks,

 

Chris

Hallowell EMC

  • Author

New twist to the story: I'm getting a real complaint right after the nuisance message about a buggy DT, but I can't decipher the problem. The spidev module is loaded. My new CB1 system:

cubie@cubieboard:~/Projects/spidev_test$ uname -a
Linux cubieboard 4.7.0-sunxi #4 SMP Mon Jun 20 13:16:19 EDT 2016 armv7l armv7l armv7l GNU/Linux
cubie@cubieboard:~/Projects/spidev_test$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04 LTS
Release:	16.04
Codename:	xenial

The SPI complaint:

[    6.941247] spidev spi32766.0: buggy DT: spidev listed directly in DT
[    6.941267] ------------[ cut here ]------------
[    6.941291] WARNING: CPU: 0 PID: 200 at drivers/spi/spidev.c:719 spidev_probe+0x1a8/0x1c4 [spidev]
[    6.941297] Modules linked in: spidev(+) bonding
[    6.941318] CPU: 0 PID: 200 Comm: systemd-modules Not tainted 4.7.0-sunxi #4
[    6.941324] Hardware name: Allwinner sun4i/sun5i Families
[    6.941354] [<c010e750>] (unwind_backtrace) from [<c010b0c8>] (show_stack+0x10/0x14)
[    6.941370] [<c010b0c8>] (show_stack) from [<c052b12c>] (dump_stack+0x90/0xa4)
[    6.941386] [<c052b12c>] (dump_stack) from [<c0120794>] (__warn+0xe8/0x100)
[    6.941399] [<c0120794>] (__warn) from [<c0120854>] (warn_slowpath_null+0x20/0x28)
[    6.941415] [<c0120854>] (warn_slowpath_null) from [<bf0262fc>] (spidev_probe+0x1a8/0x1c4 [spidev])
[    6.941438] [<bf0262fc>] (spidev_probe [spidev]) from [<c0619e6c>] (spi_drv_probe+0x7c/0xa8)
[    6.941455] [<c0619e6c>] (spi_drv_probe) from [<c05bf4ac>] (driver_probe_device+0x218/0x2c8)
[    6.941468] [<c05bf4ac>] (driver_probe_device) from [<c05bf608>] (__driver_attach+0xac/0xb0)
[    6.941479] [<c05bf608>] (__driver_attach) from [<c05bd890>] (bus_for_each_dev+0x60/0x94)
[    6.941491] [<c05bd890>] (bus_for_each_dev) from [<c05bea98>] (bus_add_driver+0x1a0/0x218)
[    6.941504] [<c05bea98>] (bus_add_driver) from [<c05bfe2c>] (driver_register+0x78/0xf8)
[    6.941520] [<c05bfe2c>] (driver_register) from [<bf029090>] (spidev_init+0x90/0xc8 [spidev])
[    6.941537] [<bf029090>] (spidev_init [spidev]) from [<c0101820>] (do_one_initcall+0x40/0x170)
[    6.941555] [<c0101820>] (do_one_initcall) from [<c01b8814>] (do_init_module+0x60/0x1c4)
[    6.941575] [<c01b8814>] (do_init_module) from [<c0192dc8>] (load_module+0x1b30/0x1d78)
[    6.941589] [<c0192dc8>] (load_module) from [<c01931e0>] (SyS_finit_module+0x8c/0x9c)
[    6.941605] [<c01931e0>] (SyS_finit_module) from [<c0107480>] (ret_fast_syscall+0x0/0x3c)
[    6.941614] ---[ end trace 194268e1a0e2160e ]---

My SPI section in the DTB:

                spi@01c05000 {
                        compatible = "allwinner,sun4i-a10-spi";
                        reg = <0x1c05000 0x1000>;
                        interrupts = <0xa>;
                        clocks = <0x3 0x14 0x18>;
                        clock-names = "ahb", "mod";
                        dmas = <0x19 0x1 0x1b 0x19 0x1 0x1a>;
                        dma-names = "rx", "tx";
                        status = "okay";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                        pinctrl-names = "default";
                        pinctrl-0 = <0x1a 0x1b>;

                        spidev@0x00 {
                                compatible = "spidev";
                                spi-max-frequency = <0x2faf080>;
                                reg = <0x0>;
                        };
                };

The spidev_test exits with "invalid argument", but the interface does something as the CS is activated: I'm triggering on CS. Clock goes low but doesn't "clock". ????

 

Thanks!!

 

Chris

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.