问题标签 [spi]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
121 浏览

linux - bsp 的驱动程序要求。bsp 是否应该包含在 spi 上运行的设备的驱动程序?

我正在为 Linux 板开发 BSP。这些板包含一个在 SPI 上运行的设备。你能告诉我 BSP 是否应该包含该设备的驱动程序,还是我应该只在 BSP 中提供 SPI 端口驱动程序?

此外,如果某些设备具有用户模式驱动程序而不是内核模式。那么这个用户模式驱动程序会成为 BSP 的一部分吗?

0 投票
1 回答
166 浏览

linux - 董事会支持包的组成部分、要求和规定。基于 SPI 的设备

我正在为 Linux 板开发 BSP(板支持包)。该板包含一个在 SPI 上运行的设备。我会喜欢你关于天气的建议,我应该为 BSP 提供一个设备特定的驱动程序,或者一个 SPI 驱动程序就足够了。

此外,如果某些设备具有用户模式驱动程序而不是内核模式。那么这个用户模式驱动程序会成为 BSP 的一部分吗?

0 投票
1 回答
358 浏览

android - mini6410 spi编程使用android

我正在使用 android 使用 spi_s3c.c 读取 spi
这个文件及其标题: spi_s3c.h 包括一些我在公司提供的包含文件夹中找不到的标题(友好的 arm dvd)

例如 spi_s3c.h 包含这些行:

s3c-dma.h 存在于:D​​VD\android-kernel-2.6.28.20100724\linux-2.6.28.6-ansroid\arch\plat-s3c\include\ mach\s3c-dma.h

但是该路径上不存在 map.h 和 gpio.h 文件
我不想重新定位这些路径(因为几个包含的文件)
,现在我可以在哪里获得一致的包含文件夹?谢谢。

0 投票
2 回答
224 浏览

embedded - How to simulate a scheduler?

In my firmware I write to MicroSD in a background task, and I've got a lot of higher-priorities interrupts enabled, some of which can take several milliseconds.

So the writing/reading from SPI can be interrupted at any moment, and for writes that may not be such a problem (if SPI behaves anything like UART), but during reads I'm afraid that my hardware SPI FIFO's will overflow if the task just happens to be interupted while the MicroSD card is sending a datablock.

Now the obvious solution would be to decrease the time that the higher priority interrupts take, but this seems very hard, because sometimes they have to wait on other peripherals too, and too prevent that I have to rewrite a lot of code that does polling now, to an interrupt-structure, which would make the overall code much more complicated.

I think in modern OSes this is solved by letting all those tasks run synchronously at the same priority, and give them all an equal time slice. But I don't have any mechanisms for threading, or an OS, so what would be the simplest way to solve this?

0 投票
1 回答
424 浏览

arduino - Arduino Wifi Shield SPI 命令

我目前正在使用Arduino Wifi Shield。它适用于 Arduino 库,但我有一个项目需要摆脱所有 Arduino 库,只使用 AVR-libc。

因此,为了使用Wifi shield,我想知道哪里有关于arduino和shield之间的SPI总线上使用的协议的文档,这样我就不需要使用Wifi库了。

我是否被迫查看源代码,或者是否存在任何文档?

谢谢。

0 投票
0 回答
225 浏览

linux-device-driver - 在Linux中实现SPI MUX驱动

在正常情况下,SPI 设备驱动程序与 SPI 控制器通信,以便能够读取/写入真实的 SPI 设备,该设备通过 Clk、MOSI.MISO 和 CS(芯片选择)连接到 SPI 控制器。

如果 SPI 控制器没有足够的 CS 线,我们有一个通过 SPI 连接的 CPLD 设备来增加 16 条 CS 线。由于每个设备都有一个驱动程序,我想实现一个 SPI Mux,以便通过 CPLD 连接的设备可以访问。

CPLD 有两条 CS 线,一条用于选择 CPLD 设备本身,另一条用于将其路由到与其连接的其他设备。其他 CLK、MOSI、MISO 来自 SPI 控制器。作为标准,可以添加有关设备的信息 intp spi_board_info

但是连接到这些元素的驱动程序无法写入真实设备,因为 CS 必须通过另一个 SPI 设备的 CPLD 路由到预期设备。

我的难题是如何实现这样的 SPI MUX,它会在每次驱动程序想要访问通过 CPLD 连接的设备时执行 CS 的路由。以及如何将此 SPI MUX 驱动程序连接到各个驱动程序。

我试图在内核代码中找到一些帮助,但只找到了可以直接调用 SPI Master 功能的设备驱动程序。任何人都可以为此提供任何指示。

0 投票
1 回答
579 浏览

spi - 我应该使用哪些 OMAP-L138 寄存器来选择另一个 SPI 芯片?

我有 OMAP-L138 Experimenter Kit,我想与设置在 SPI 1 芯片选择 1 上的外围设备之一进行通信(SPI1 芯片选择 0 上也有闪存)。

我很困惑我应该使用哪些寄存器来选择芯片 1 ?

根据OMAP-L138 Technical Reference Manual,我应该

  • 设置 4 针模式

    spi->SPIPC0 = SOMI | 西莫 | 时钟 | SCS0; //带片选的4针模式

  • 设置 SPIPC0.SCS0FUN 的 1 位以显示 SPI_CS1 - 是 SPI 功能引脚

    SETBIT(spi->SPIPC0, 0x00000002);

  • 设置 SPIDAT1.CSNR 的 17 位(表示 SPI_CS1 引脚被驱动为高电平。)

    SPI->SPIDAT1 = 0;SETBIT(spi->SPIDAT1, 0x20000); //设置第17位(对应SPI_CS1)

  • 将 SIDEF.CSDEF 设置为 1 位(表示 SPI_CS1 引脚被驱动为高电平。)

    spi->SPIDEF = 0;SETBIT(spi->SPIDEF, 0x00000002); //在 CSDEF 字段中设置第 1 位(对应于 SPI_CS1)

  • 最后,在从 SPI1_CS1 设备读取数据之前,我应该将 SPIDAT1.CSHOLD 设置为保持有效的片选信号

    SETBIT(spi->SPIDAT1,0x10000000); //设置代表CSHOLD的第28位

这是正确的还是我错过了什么?可能我还需要对 PINMUX5(引脚复用控制 5 寄存器)做一些事情吗?谢谢!

0 投票
1 回答
659 浏览

embedded - 串行外设接口

我正在浏览一篇与 SPI 相关的文章。在多个从站的情况下,有一个名为“菊花链”的配置。

到目前为止,我对 SPI(基于维基百科)的理解是,

SPI 可以同时传输和接收一些数据。

我的问题是,

1)如果有多个从设备,是指在与多个从设备的连接中将数据传输到多个从设备,还是将数据传输到其中一个从设备?

2)根据这个链接图4,假设主机保持其SS低,直到它需要发送到3个从设备的所有数据都发送完毕,然后将引脚拉高。如果是这样,主设备最后从哪个从设备接收什么数据?

3)如本链接中给出的,在增强模式下,检查加载启用(LDEN)和WCOL是否将下一个字节移动到缓冲区中。为什么我们需要同时检查它们?WCOL 还不够吗?

4)给定,Master configures the clock - frequency less than or equal to the maximum frequency the slave device supports. Such frequencies are commonly in the range of 1–100 MHz.主设备如何找到从设备的时钟频率?

5) SPSR、SPCR 和 SPDR 寄存器是否保留在主机和从机中?

6) 假设在传输完成后设置SPIF标志。如果SPIE 也被使能,则产生中断。主从都设置了标志吗?主从都产生中断吗?

请指导我。提前致谢。

0 投票
0 回答
998 浏览

c# - Firmata over nRF24

I'm having some technical problems... I'm trying to use Firmata for arduino but over nrf24, not over Serial interface. I have tested nRF24 communication and it's fine. I have also tested Firmata over Serial and it works.

Base device is simple "serial relay". When it has data available on Serial, read it and send it over nRF24 network. If there is data available from network, read it and send it through Serial.

Node device is a bit complex. It has custom Standard Firmata where I have just added write and read override.

Diagram

Read override id handeled in loop method in this way:

Firmata processInputOverrride is little changed method of processInput where processInput reads data directly from FirmataSerial, and in this method we pass data down to method from network. This was tested and it should work fine.

Write method is overloaded in a different way. In Firmata.cpp I have added an method pointer that can be set to a custom method and used to send data using that custom method. I have then added custom method call after each of the FirmataSerial.write() call:

I have then set the overrided write method to a custom method that just writes byte to network instead of Serial.

Everything seems to be working fine, it's just that some data seems to be inverted or something. I'm using sharpduino (C#) to do some simple digital pin toggle. Here's how output looks like: (< came from BASE, > sent to BASE)

That last line came inverted. So i tough that I only need to invert received bytes. And it worked for that first command. But then something happens and communication stops again.

So what could be the problem here? It seems that communication with Firmata works but something isn't right...

-- EDIT --

I solved that issue. The problem was that I didn't see Serial.write() calls in sysex callback. Now that that is solved, I came up to another problem... All stages pass right (I guess) and then I dont get any response from Node when I request pin states

There is no response. Any ideas why would that happen? Node receive all messages correctly and code for handling pin states exist.

0 投票
1 回答
9160 浏览

arduino - Arduino - 一次管理两个 SPI 设备

我正在尝试使用相同的 MISO、MOSI 和 CLOCK 引脚同时控制两个SPI设备,但使用不同的 SS 引脚。

一个是SparkFun的Wifly shield,它使用 SPI-to-UART 芯片,另一个是MAX31855

他们独立工作,但不能一起工作。

下面列出了我正在使用的 SPI 到 UART 代码。我所做的唯一更改是在头文件中;我设置select()deselect()公开。

我试图这样使用它:

但它仍然无法运行。为了让它发挥作用,我应该尝试什么进一步的事情?