Hi,
I'm trying to setup dual SPI master node, but all I get is single node. I've connected oscilloscope to different pins and only SCK and MOSI have outputs. I can't get the second data pin to work whatever I try. Tried different pins, still nothing. By measuring the SCK length I found that it's transmitting it as single SPI, double time, so it is defined as single SPI, not dual. Need some help!
-------------------- defs -----------------------------
typedef struct SPI_settings_s{
spi_host_device_t host;
spi_device_handle_t spi;
int dma_chan;
spi_device_interface_config_t devcfg;
spi_bus_config_t buscfg;
}SPI_settings_t;
static SPI_settings_t SPI_settings = {
.host = SPI2_HOST,
.dma_chan = SPI_DMA_CH_AUTO,
.devcfg = {
.command_bits = 0,
.address_bits = 0,
.mode = 0, //SPI mode 0
.clock_speed_hz = APB_CLK_FREQ /800, //SPI_MASTER_FREQ_40M
.spics_io_num = 10, //CS pin
.queue_size = 1 //Not sure if needed
},
.buscfg = {
.mosi_io_num = GPIO_NUM_11,
.data1_io_num = GPIO_NUM_9,
.sclk_io_num = GPIO_NUM_12,
.max_transfer_sz = 131072,
.flags = SPICOMMON_BUSFLAG_MASTER | SPICOMMON_BUSFLAG_GPIO_PINS | SPICOMMON_BUSFLAG_SCLK | SPICOMMON_BUSFLAG_DUAL
}
};
--------------- initializing and sending ---------------------------
if(!spi_bus_initialize(SPI_settings.host, &SPI_settings.buscfg, SPI_settings.dma_chan))
if(!spi_bus_add_device(SPI_settings.host, &SPI_settings.devcfg, &SPI_settings.spi)) {
ledDMAbuffer=&ram[0xA000];
spi_transaction_t t;
memset(&t, 0, sizeof(t));
t.length = 8*0x6000; //length is in bits
t.tx_buffer = ledDMAbuffer;
// t.flags = SPI_TRANS_MODE_DIO; -- causes panic
spi_device_queue_trans(SPI_settings.spi, &t,0);// spi_bus_initialize();
}
Dual SPI Master/Slave on esp32s3
-
- Posts: 829
- Joined: Mon Jul 22, 2019 3:20 pm
Re: Dual SPI Master/Slave on esp32s3
You will be more likely to get a response to esp-idf questions in viewforum.php?f=13
Who is online
Users browsing this forum: No registered users and 49 guests