mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
spi_master:fix error when use spi_bus_add_device
more than 3 device
update gpio_sig at `spics_out` array in each spi_periph.c of chips later than s2 then `spi_bus_add_device` can correctly distribute gpio_signals for cs_signal Closes https://github.com/espressif/esp-idf/issues/8876
This commit is contained in:
parent
eea8629fa1
commit
3cc3455ca6
@ -527,6 +527,10 @@ config SOC_SPI_DMA_CHAN_NUM
|
||||
int
|
||||
default 2
|
||||
|
||||
config SOC_SPI_MAX_CS_NUM
|
||||
int
|
||||
default 3
|
||||
|
||||
config SOC_SPI_MAXIMUM_BUFFER_SIZE
|
||||
int
|
||||
default 64
|
||||
|
@ -266,6 +266,7 @@
|
||||
#define SOC_SPI_DMA_CHAN_NUM 2
|
||||
|
||||
#define SOC_SPI_PERIPH_CS_NUM(i) 3
|
||||
#define SOC_SPI_MAX_CS_NUM 3
|
||||
|
||||
#define SOC_SPI_MAXIMUM_BUFFER_SIZE 64
|
||||
#define SOC_SPI_MAX_PRE_DIVIDER 8192
|
||||
|
@ -323,6 +323,10 @@ config SOC_SPI_PERIPH_NUM
|
||||
int
|
||||
default 2
|
||||
|
||||
config SOC_SPI_MAX_CS_NUM
|
||||
int
|
||||
default 6
|
||||
|
||||
config SOC_SPI_MAXIMUM_BUFFER_SIZE
|
||||
int
|
||||
default 64
|
||||
|
@ -174,6 +174,7 @@
|
||||
/*-------------------------- SPI CAPS ----------------------------------------*/
|
||||
#define SOC_SPI_PERIPH_NUM 2
|
||||
#define SOC_SPI_PERIPH_CS_NUM(i) 6
|
||||
#define SOC_SPI_MAX_CS_NUM 6
|
||||
|
||||
#define SOC_SPI_MAXIMUM_BUFFER_SIZE 64
|
||||
|
||||
|
@ -46,7 +46,7 @@ const spi_signal_conn_t spi_periph_signal[SOC_SPI_PERIPH_NUM] = {
|
||||
.spiq_in = FSPIQ_IN_IDX,
|
||||
.spiwp_in = FSPIWP_IN_IDX,
|
||||
.spihd_in = FSPIHD_IN_IDX,
|
||||
.spics_out = {FSPICS0_OUT_IDX, FSPICS1_OUT_IDX, FSPICS2_OUT_IDX},
|
||||
.spics_out = {FSPICS0_OUT_IDX, FSPICS1_OUT_IDX, FSPICS2_OUT_IDX, FSPICS3_OUT_IDX, FSPICS4_OUT_IDX, FSPICS5_OUT_IDX},
|
||||
.spics_in = FSPICS0_IN_IDX,
|
||||
.spiclk_iomux_pin = SPI2_IOMUX_PIN_NUM_CLK,
|
||||
.spid_iomux_pin = SPI2_IOMUX_PIN_NUM_MOSI,
|
||||
|
@ -531,6 +531,10 @@ config SOC_SPI_PERIPH_NUM
|
||||
int
|
||||
default 2
|
||||
|
||||
config SOC_SPI_MAX_CS_NUM
|
||||
int
|
||||
default 6
|
||||
|
||||
config SOC_SPI_MAXIMUM_BUFFER_SIZE
|
||||
int
|
||||
default 64
|
||||
|
@ -258,6 +258,7 @@
|
||||
/*-------------------------- SPI CAPS ----------------------------------------*/
|
||||
#define SOC_SPI_PERIPH_NUM 2
|
||||
#define SOC_SPI_PERIPH_CS_NUM(i) 6
|
||||
#define SOC_SPI_MAX_CS_NUM 6
|
||||
|
||||
#define SOC_SPI_MAXIMUM_BUFFER_SIZE 64
|
||||
|
||||
|
@ -1,16 +1,8 @@
|
||||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "soc/spi_periph.h"
|
||||
#include "stddef.h"
|
||||
@ -54,7 +46,7 @@ const spi_signal_conn_t spi_periph_signal[SOC_SPI_PERIPH_NUM] = {
|
||||
.spiq_in = FSPIQ_IN_IDX,
|
||||
.spiwp_in = FSPIWP_IN_IDX,
|
||||
.spihd_in = FSPIHD_IN_IDX,
|
||||
.spics_out = {FSPICS0_OUT_IDX, FSPICS1_OUT_IDX, FSPICS2_OUT_IDX},
|
||||
.spics_out = {FSPICS0_OUT_IDX, FSPICS1_OUT_IDX, FSPICS2_OUT_IDX, FSPICS3_OUT_IDX, FSPICS4_OUT_IDX, FSPICS5_OUT_IDX},
|
||||
.spics_in = FSPICS0_IN_IDX,
|
||||
.spiclk_iomux_pin = SPI2_IOMUX_PIN_NUM_CLK,
|
||||
.spid_iomux_pin = SPI2_IOMUX_PIN_NUM_MOSI,
|
||||
|
@ -503,6 +503,10 @@ config SOC_SPI_PERIPH_NUM
|
||||
int
|
||||
default 2
|
||||
|
||||
config SOC_SPI_MAX_CS_NUM
|
||||
int
|
||||
default 6
|
||||
|
||||
config SOC_SPI_MAXIMUM_BUFFER_SIZE
|
||||
int
|
||||
default 64
|
||||
|
@ -261,6 +261,7 @@
|
||||
/*-------------------------- SPI CAPS ----------------------------------------*/
|
||||
#define SOC_SPI_PERIPH_NUM 2
|
||||
#define SOC_SPI_PERIPH_CS_NUM(i) 6
|
||||
#define SOC_SPI_MAX_CS_NUM 6
|
||||
|
||||
#define SOC_SPI_MAXIMUM_BUFFER_SIZE 64
|
||||
|
||||
|
@ -1,16 +1,8 @@
|
||||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "soc/spi_periph.h"
|
||||
#include "stddef.h"
|
||||
@ -54,7 +46,7 @@ const spi_signal_conn_t spi_periph_signal[SOC_SPI_PERIPH_NUM] = {
|
||||
.spiq_in = FSPIQ_IN_IDX,
|
||||
.spiwp_in = FSPIWP_IN_IDX,
|
||||
.spihd_in = FSPIHD_IN_IDX,
|
||||
.spics_out = {FSPICS0_OUT_IDX, FSPICS1_OUT_IDX, FSPICS2_OUT_IDX},
|
||||
.spics_out = {FSPICS0_OUT_IDX, FSPICS1_OUT_IDX, FSPICS2_OUT_IDX, FSPICS3_OUT_IDX, FSPICS4_OUT_IDX, FSPICS5_OUT_IDX},
|
||||
.spics_in = FSPICS0_IN_IDX,
|
||||
.spiclk_iomux_pin = SPI2_IOMUX_PIN_NUM_CLK,
|
||||
.spid_iomux_pin = SPI2_IOMUX_PIN_NUM_MOSI,
|
||||
|
@ -559,6 +559,10 @@ config SOC_SPI_DMA_CHAN_NUM
|
||||
int
|
||||
default 3
|
||||
|
||||
config SOC_SPI_MAX_CS_NUM
|
||||
int
|
||||
default 6
|
||||
|
||||
config SOC_SPI_MAXIMUM_BUFFER_SIZE
|
||||
int
|
||||
default 72
|
||||
|
@ -251,6 +251,7 @@
|
||||
#define SOC_SPI_PERIPH_NUM 3
|
||||
#define SOC_SPI_DMA_CHAN_NUM 3
|
||||
#define SOC_SPI_PERIPH_CS_NUM(i) (((i)==0)? 2: (((i)==1)? 6: 3))
|
||||
#define SOC_SPI_MAX_CS_NUM 6
|
||||
|
||||
#define SOC_SPI_MAXIMUM_BUFFER_SIZE 72
|
||||
#define SOC_SPI_MAX_PRE_DIVIDER 8192
|
||||
|
@ -1,16 +1,8 @@
|
||||
// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "soc/spi_periph.h"
|
||||
#include "stddef.h"
|
||||
@ -62,7 +54,7 @@ const spi_signal_conn_t spi_periph_signal[SOC_SPI_PERIPH_NUM] = {
|
||||
.spid5_in = FSPIIO5_IN_IDX,
|
||||
.spid6_in = FSPIIO6_IN_IDX,
|
||||
.spid7_in = FSPIIO7_IN_IDX,
|
||||
.spics_out = {FSPICS0_OUT_IDX, FSPICS1_OUT_IDX, FSPICS2_OUT_IDX},
|
||||
.spics_out = {FSPICS0_OUT_IDX, FSPICS1_OUT_IDX, FSPICS2_OUT_IDX, FSPICS3_OUT_IDX, FSPICS4_OUT_IDX, FSPICS5_OUT_IDX},
|
||||
.spics_in = FSPICS0_IN_IDX,
|
||||
.spiclk_iomux_pin = FSPI_IOMUX_PIN_NUM_CLK,
|
||||
.spid_iomux_pin = FSPI_IOMUX_PIN_NUM_MOSI,
|
||||
|
@ -635,6 +635,10 @@ config SOC_SPI_PERIPH_NUM
|
||||
int
|
||||
default 3
|
||||
|
||||
config SOC_SPI_MAX_CS_NUM
|
||||
int
|
||||
default 6
|
||||
|
||||
config SOC_SPI_MAXIMUM_BUFFER_SIZE
|
||||
int
|
||||
default 64
|
||||
|
@ -263,7 +263,8 @@
|
||||
|
||||
/*-------------------------- SPI CAPS ----------------------------------------*/
|
||||
#define SOC_SPI_PERIPH_NUM 3
|
||||
#define SOC_SPI_PERIPH_CS_NUM(i) 3
|
||||
#define SOC_SPI_PERIPH_CS_NUM(i) (((i)==0)? 2: (((i)==1)? 6: 3))
|
||||
#define SOC_SPI_MAX_CS_NUM 6
|
||||
#define SOC_SPI_MAXIMUM_BUFFER_SIZE 64
|
||||
#define SOC_SPI_SUPPORT_DDRCLK 1
|
||||
#define SOC_SPI_SLAVE_SUPPORT_SEG_TRANS 1
|
||||
|
@ -1,16 +1,8 @@
|
||||
// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "soc/spi_periph.h"
|
||||
#include "stddef.h"
|
||||
@ -62,7 +54,7 @@ const spi_signal_conn_t spi_periph_signal[SOC_SPI_PERIPH_NUM] = {
|
||||
.spid5_in = FSPIIO5_IN_IDX,
|
||||
.spid6_in = FSPIIO6_IN_IDX,
|
||||
.spid7_in = FSPIIO7_IN_IDX,
|
||||
.spics_out = {FSPICS0_OUT_IDX, FSPICS1_OUT_IDX, FSPICS2_OUT_IDX},
|
||||
.spics_out = {FSPICS0_OUT_IDX, FSPICS1_OUT_IDX, FSPICS2_OUT_IDX, FSPICS3_OUT_IDX, FSPICS4_OUT_IDX, FSPICS5_OUT_IDX},
|
||||
.spics_in = FSPICS0_IN_IDX,
|
||||
.spiclk_iomux_pin = SPI2_IOMUX_PIN_NUM_CLK,
|
||||
.spid_iomux_pin = SPI2_IOMUX_PIN_NUM_MOSI,
|
||||
|
@ -60,7 +60,7 @@ typedef struct {
|
||||
const uint8_t spid6_in;
|
||||
const uint8_t spid7_in;
|
||||
#endif // SOC_SPI_SUPPORT_OCT
|
||||
const uint8_t spics_out[3]; // /CS GPIO output mux signals
|
||||
const uint8_t spics_out[SOC_SPI_MAX_CS_NUM]; // /CS GPIO output mux signals
|
||||
const uint8_t spics_in;
|
||||
const uint8_t spidqs_out;
|
||||
const uint8_t spicd_out;
|
||||
|
@ -1072,7 +1072,6 @@ components/soc/esp32c3/include/soc/usb_serial_jtag_struct.h
|
||||
components/soc/esp32c3/include/soc/wdev_reg.h
|
||||
components/soc/esp32c3/interrupts.c
|
||||
components/soc/esp32c3/ledc_periph.c
|
||||
components/soc/esp32c3/spi_periph.c
|
||||
components/soc/esp32c3/uart_periph.c
|
||||
components/soc/esp32h2/i2c_periph.c
|
||||
components/soc/esp32h2/include/soc/apb_ctrl_reg.h
|
||||
@ -1111,7 +1110,6 @@ components/soc/esp32h2/include/soc/usb_serial_jtag_reg.h
|
||||
components/soc/esp32h2/include/soc/usb_serial_jtag_struct.h
|
||||
components/soc/esp32h2/include/soc/wdev_reg.h
|
||||
components/soc/esp32h2/ledc_periph.c
|
||||
components/soc/esp32h2/spi_periph.c
|
||||
components/soc/esp32h2/uart_periph.c
|
||||
components/soc/esp32s2/adc_periph.c
|
||||
components/soc/esp32s2/dac_periph.c
|
||||
@ -1168,7 +1166,6 @@ components/soc/esp32s2/include/soc/usb_wrap_struct.h
|
||||
components/soc/esp32s2/include/soc/usbh_struct.h
|
||||
components/soc/esp32s2/include/soc/wdev_reg.h
|
||||
components/soc/esp32s2/ledc_periph.c
|
||||
components/soc/esp32s2/spi_periph.c
|
||||
components/soc/esp32s2/uart_periph.c
|
||||
components/soc/esp32s2/usb_periph.c
|
||||
components/soc/esp32s3/dedic_gpio_periph.c
|
||||
@ -1255,7 +1252,6 @@ components/soc/esp32s3/ledc_periph.c
|
||||
components/soc/esp32s3/rtc_io_periph.c
|
||||
components/soc/esp32s3/sdio_slave_periph.c
|
||||
components/soc/esp32s3/sdmmc_periph.c
|
||||
components/soc/esp32s3/spi_periph.c
|
||||
components/soc/esp32s3/uart_periph.c
|
||||
components/soc/esp32s3/usb_periph.c
|
||||
components/soc/include/soc/adc_periph.h
|
||||
|
Loading…
x
Reference in New Issue
Block a user