Jump to content

Recommended Posts

Posted
Armbianmonitor:

Hi

 

I want use spi in slave mode, how i can enable slave?

cat /boot/armbianEnv.txt
verbosity=1
console=serial
overlay_prefix=sun50i-h5
overlays=spi-add-cs1 spi-jedec-nor spi-spidev
param_spidev_spi_bus=0
param_spidev_max_freq=100000000
rootdev=UUID=47313251-44b3-4a77-aef5-c53397e3a685
rootfstype=ext4
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u

 

 

 

Posted

depends on your solution - but typically for h5, kernel is master on SPI...

 

https://linux-sunxi.org/SPIdev

 

You'll probably need to rebuild the kernel to enable, and you'll need to have specifics on the bus from the master.

 

best of luck, you're likely beyond the redline given current info on how folks can assist.

Posted
6 minutes ago, RuslanGennadievich said:

I have NanoPi NEO Core2, this SoC has slave capable?

Unfortunately, although the H5 hardware is capable, Linux kernel driver doesn't support slave mode.

Posted
27 minutes ago, martinayotte said:

Unfortunately, although the H5 hardware is capable, Linux kernel driver doesn't support slave mode.

Thanks, i don't knows it.

On first at this topic, sfx2000 say about rebuild kernel...

 

I readed this link and check my kernel config, so i have this options

CONFIG_SPI_SUN4I=y
CONFIG_SPI_SUN6I=y
CONFIG_SPI=y
CONFIG_SPI_MASTER=y
CONFIG_EXPERIMENTAL=y
CONFIG_SPI_SPIDEV=y

CONFIG_SPI_SLAVE=y
CONFIG_SPI_SLAVE_TIME=m
CONFIG_SPI_SLAVE_SYSTEM_CONTROL=m

it's ok.

 

But next, i dont't understund...

Yes, i have /dev/spidev1.0 and /sys/class/spi_slave

So, how i can use my /dev/spidev1.0 as slave?

I try change my dts: (convert /boot/sun50i-h5-nanopi-neo-core2.dtb to /boot/sun50i-h5-nanopi-neo-core2.dts, edit, and compile again to dtb)

In dts i added "spi-slave;"

                        spi0 {
                                pins = "PC0", "PC1", "PC2", "PC3";
                                function = "spi0";
                                linux,phandle = <0x21>;
                                phandle = <0x21>;
                                spi-slave;
                        };

                        spi1 {
                                pins = "PA15", "PA16", "PA14", "PA13";
                                function = "spi1";
                                linux,phandle = <0x23>;
                                phandle = <0x23>;
                                spi-slave;
                        };

But i can't see anything change in my system.

martinayotte, tell me please,  how i can reconfigure or rebuild linux kernel driver to support slave?

Posted
13 minutes ago, RuslanGennadievich said:

how i can reconfigure or rebuild linux kernel driver to support slave?

As I said, kernel driver for AllWinner SoC doesn't support "slave" mode.

 

8 minutes ago, RuslanGennadievich said:

My ultimate goal is to test SPI baud rate :)

What do you mean by testing baud rate ?

If you wish to measure/verify the clock, you can take a oscilloscope...

Posted
1 minute ago, martinayotte said:

As I said, kernel driver for AllWinner SoC doesn't support "slave" mode.

Maybe you know how add slave support to driver?

 

Quote

If you wish to measure/verify the clock, you can take a oscilloscope...

Yes, on oscilloscope i verify clock line on "slave soc" and see some signal, but in slave mode it's wrong

Posted
2 minutes ago, RuslanGennadievich said:

Maybe you know how add slave support to driver?

No, it is too complex task ...

 

2 minutes ago, RuslanGennadievich said:

Yes, on oscilloscope i verify clock line on "slave soc" and see some signal, but in slave mode it's wrong

I don't understand what you mean ...

Posted
On 3/18/2020 at 5:10 PM, martinayotte said:

No, it is too complex task ...

 

I don't understand what you mean ...

Ok thankyou, and last question

If i have /sys/class/spi_slave on Armbian, does this mean that the kernel has support spi slave?

Posted
33 minutes ago, RuslanGennadievich said:

If i have /sys/class/spi_slave on Armbian, does this mean that the kernel has support spi slave?

From my knowledge/understanding, it only mean that kernel has been compiled with CONFIG_SPI_SLAVE enabled, but no hardware is attached to it since neither drivers/spi/spi-sun4i.c and drivers/spi/spi-sun6i.c provide such functionalities.

 

EDIT: you have probably seen that this /sys/class/spi_slave folder is empty ...

Posted
2 hours ago, martinayotte said:

EDIT: you have probably seen that this /sys/class/spi_slave folder is empty ...

Yes, you are right. My /sys/class/spi_slave folder is empty ...
Okey, thankyou for help!

Posted
On 3/18/2020 at 7:47 AM, RuslanGennadievich said:

My ultimate goal is to test SPI baud rate :)

 

SPI on most SoC's - it's pretty much what the vendor qualifies - it's when one is in a mixed environment where things get interesting - master determines the rate based on the periphs configured.

 

There are a lot of things that can be on the SPI bus, so sit back and consider what peripherals are in use on your circuit design.

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines