我正在尝试使用QSPI总线访问Zephyr中的串行NOR闪存。CS(芯片选择)引脚始终保持高电平。选择闪存芯片时,其应为低电平有效。只是想知道QSPI CS是否在Zephyr中工作,或者我需要将CS引脚配置为GPIO并通过我的软件控制它。
谁有QSPI的CS引脚在Zephyr工作??我用的是北欧半导体公司的rNF52480。
谢谢,
JC
发布于 2021-09-12 17:42:04
我认为你需要自己配置它:
...
#include <drivers/gpio.h>
#include <drivers/spi.h>
struct spi_cs_control spi_cs = {
/* PA4 as CS pin */
.gpio_dev = DEVICE_DT_GET(DT_NODELABEL(gpioa)),
.gpio_pin = 4,
.gpio_dt_flags = GPIO_ACTIVE_LOW,
/* delay in microseconds to wait before starting the transmission and before releasing the CS line */
.delay = 10,
};
#define SPI_CS (&spi_cs)
struct spi_config spi_cfg = {
.frequency = 350000,
.operation = SPI_OP_MODE_MASTER | SPI_TRANSFER_MSB | SPI_WORD_SET(8) | SPI_LINES_QUAD | SPI_LOCK_ON,
.cs = SPI_CS,
};
void spi_init()
{
spi = device_get_binding("SPI_1");
....
}
https://stackoverflow.com/questions/68820203
复制相似问题