New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
esp32s3box同时初始化i2c和spi,后初始化的会失败,单独初始化某一个则通过 (IDFGH-10716) #11938
Comments
测试没问题,是不是引脚配置有冲突,上述没看到你的引脚配置 。我用 demo 示例做了以下测试,两个都是 ok 的。
|
spi的引脚配置是: i2c的引脚配置是41为数据脚,40为时钟 串口的配置 |
脚肯定和现有代码冲突,app_pwm_led_init 初始化,就会和你的IIC GPIO 40/41 冲突 |
方便的话,可以把你工程放在 github 的哪个仓库,我来下载下试试; |
https://github.com/YyeHG/factory_demo.git |
首先,我确认了下,确实如此,最后一个分配的任务会失败。
|
一般来说就是中断资源被用完了,导致最后一个项目初始化失败(其实是后续项目都会失败)。 建议减少不必要的中断资源使用,比如不要使用 GPIO 中断,换成定时器。 |
我这没有问题了,@Alvin1Zhang |
我也遇到类似的问题,像是IDF限制了初始化硬件设备的数量。Only two SPI, usb, and sdmmc interfaces can be initialized, and the third one fails. (IDFGH-11567) 1、初始化了2个SPI后(或1个SDMMC和1个SPI),初始化2个UART,第二个UART失败,只是初始化1个SPI后(或一个SDMMC),2个UART可以成功: 2、先初始化SDMMC(1个),后初始化SPI(2个),再初始化UART(2个),前3个可以成功(SDMMC+2个SPI),两个UART都失败: 3、先初始化SDMMC(1个),后初始化UART(2个),最后初始化SPI(2个),前3个可以成功(SDMMC+2个UART),后面SPI失败: file: "../main/src/Sys/w5500.c" line 159 abort() was called at PC 0x40383b1f on core 0 4、先初始化SDMMC(1个),后初始化SPI(2个),再初始化USB,最后初始化UART(2个),最前3个可以成功(SDMMC+2个SPI),后面USB和UART失败: 以上测试在初始化第一个设备前还初始化了一个I2C的RTC,如果我把RTC初始化注释了,重新运行第4个程序,则第一个UART可以正常初始化,从以上情况基本可以看出前4个设备驱动可以正常初始化,之后的就会失败,我需要用到1个I2C、2个SPI、3个UART(其中一个作为刷程序和日志输出)、1个SDMMC、1个USB,共8个设备,如果刷程序和日志输出的也算成功的话,那也就是idf只可以初始化5个设备。我还使用到了蓝牙,但蓝牙不管是先初始化还是后初始化都没有影响 |
Answers checklist.
IDF version.
5.0.2
Operating System used.
Windows
How did you build your project?
VS Code IDE
If you are using Windows, please specify command line type.
None
Development Kit.
esp32s3box
Power Supply used.
USB
What is the expected behavior?
两者成功配置通过
What is the actual behavior?
先初始化spi然后初始化i2c,配置失败
E (21162) i2c: i2c_master_cmd_begin(1481): i2c driver not installed
Steps to reproduce.
这是spi的配置
esp_err_t ret;
spi_bus_config_t buscfg = {
.miso_io_num = SPI_PIN_MISO,
.mosi_io_num = SPI_PIN_MOSI,
.sclk_io_num = SPI_PIN_CLK,
.quadwp_io_num = -1,
.quadhd_io_num = -1,
.max_transfer_sz = 16 * 320 * 2 + 8};
spi_device_interface_config_t devcfg = {
#ifdef CONFIG_LCD_OVERCLOCK
.clock_speed_hz = 26 * 1000 * 1000, // Clock out at 26 MHz
#else
.clock_speed_hz = 10 * 1000 * 1000, // Clock out at 10 MHz
#endif
.mode = 0, // SPI mode 0
.spics_io_num = SPI_PIN_CS, // CS pin
.queue_size = 7, // We want to be able to queue 7 transactions at a time
.pre_cb = lcd_spi_pre_transfer_callback, // Specify pre-transfer callback to handle D/C line
};
// Initialize the SPI bus
ret = spi_bus_initialize(SPI2_HOST, &buscfg, SPI_DMA_CH_AUTO);
ESP_LOGI(TAG, "spi_bus_initialize%x", ret);
// Attach the LCD to the SPI bus
ret = spi_bus_add_device(SPI2_HOST, &devcfg, &handle);
ESP_LOGI(TAG, "spi_bus_add_device%x", ret);
这是i2c的配置
int ret;
static i2c_config_t conf;
conf.mode = I2C_MODE_MASTER;
conf.sda_io_num = GPIO_NUM_41; // SDA IO映射
conf.sda_pullup_en = GPIO_PULLUP_DISABLE;
conf.scl_io_num = GPIO_NUM_40; // SCL IO映射
conf.scl_pullup_en = GPIO_PULLUP_DISABLE;
conf.master.clk_speed = 400000; // I2C CLK 频率
conf.clk_flags = 0;
ESP_ERROR_CHECK(i2c_param_config(I2C_NUM_0, &conf)); // 配置I2C
ret = i2c_driver_install(I2C_NUM_0, I2C_MODE_MASTER, 0, 0, 0); // I2C功能安装使能函数
ESP_LOGI(TAG, "i2c_driver_install%d", ret);
Debug Logs.
More Information.
No response
The text was updated successfully, but these errors were encountered: