全志V3s只有一个spi口,
我用spi flash作为存储和启动设备,
那么这组spi还可以接其他设备吗,
比如MFRC522,nrf24L01这些nfc和数传模块吗?
离线
spi flash dts是这样的:
&spi0 {
status ="okay";mx25l25635e:mx25l25635e@0 {
compatible = "jedec,spi-nor";
reg = <0x0>;
spi-max-frequency = <50000000>;
#address-cells = <1>;
#size-cells = <1>;
};};
离线
用gpio做CS, 读写Flash之前先做操作gpio, 应该可以吧?
离线
理论上来说是没有问题的, 在dts里面添加设备, 把设备的cs引脚设置成对应的gpio, 不过没有实践过, 仅提供参考意见。
离线
参考一下这个:
https://github.com/jpbarraca/pynrf24/blob/master/spi/BB-nRF24-SPI0-00A0.dts
/*
* Virtual cape for SPI0 on connector pins P9.22 P9.21 P9.18 P9.17
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
/dts-v1/;
/plugin/;
/ {
compatible = "ti,beaglebone", "ti,beaglebone-black";
/* identification */
part-number = "BB-nRF24-SPI0";
version = "00A0";
/* state the resources this cape uses */
exclusive-use =
/* the pin header uses */
"P9.17", /* spi0_cs0 */
"P9.18", /* spi0_d1 */
"P9.21", /* spi0_d0 */
"P9.22", /* spi0_sclk */
/* the hardware ip uses */
"spi0";
fragment@0 {
target = <&am33xx_pinmux>;
__overlay__ {
/* default state has all gpios released and mode set to uart1 */
bb_spi0_pins: pinmux_bb_spi0_pins {
pinctrl-single,pins = <
0x150 0x30 /* spi0_sclk.spi0_sclk, INPUT_PULLUP | MODE0 */
0x154 0x30 /* spi0_d0.spi0_d0, INPUT_PULLUP | MODE0 */
0x158 0x10 /* spi0_d1.spi0_d1, OUTPUT_PULLUP | MODE0 */
0x15c 0x10 /* spi0_cs0.spi0_cs0, OUTPUT_PULLUP | MODE0 */
>;
};
};
};
fragment@1 {
target = <&spi0>; /* spi0 is numbered correctly */
__overlay__ {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&bb_spi0_pins>;
#address-cells = <1>;
#size-cells = <0>;
spidev: spidev@0{
#address-cells = <1>;
#size-cells = <0>;
compatible = "linux,spidev";
reg = <0>;
spi-max-frequency = <10000000>;
};
};
};
};
离线
离线
离线