SPI master例程的疑问

aureoleday
Posts: 22
Joined: Wed Dec 19, 2018 2:10 am

SPI master例程的疑问

Postby aureoleday » Tue Dec 25, 2018 9:07 am

在"spi_master_example_main.c"中对SPI引脚的定义是这样的
#define PIN_NUM_MISO 25
#define PIN_NUM_MOSI 23
#define PIN_NUM_CLK 19
#define PIN_NUM_CS 22

但是这个与"esp32_datasheet_en.pdf"中的定义对不上号
在49页的IO_MUX中,GPIO_19和GPIO_22的定义分别是VSPIQ和VSPIWP
而GPIO25更是没有SPI的接口定义
请问这个引脚的分配到底根据哪个文档?

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: SPI master例程的疑问

Postby ESP_igrr » Tue Dec 25, 2018 9:36 am

The datasheet gives correct mapping of pins to the IOMUX.

SPI can be connected to the pins via IO MUX or GPIO matrix.

Since the example uses pins which are not IOMUX pins, the driver will use GPIO matrix to connect the peripheral to the pins.

Xiong Yu
Posts: 9
Joined: Wed Apr 11, 2018 12:08 am

Re: SPI master例程的疑问

Postby Xiong Yu » Tue Dec 25, 2018 11:14 am

你好,
ESP32有一个GPIO交换矩阵,一些外设可以通过该交换矩阵将信号分配到任意可用的io pad上,方便硬件设计。

可以参考如下资料:
* https://docs.espressif.com/projects/esp ... -and-iomux
* https://espressif.com/sites/default/fil ... ual_en.pdf

aureoleday
Posts: 22
Joined: Wed Dec 19, 2018 2:10 am

Re: SPI master例程的疑问

Postby aureoleday » Tue Dec 25, 2018 2:19 pm

ESP_igrr wrote:
Tue Dec 25, 2018 9:36 am
The datasheet gives correct mapping of pins to the IOMUX.

SPI can be connected to the pins via IO MUX or GPIO matrix.

Since the example uses pins which are not IOMUX pins, the driver will use GPIO matrix to connect the peripheral to the pins.
thanks for answering. And I've found detailed description for IO MUX and GPIO Matrix, they are really amazing things and totally different from stm32 series. It would be much better if there is a highlight in these different features in the general HW/SW datasheets.

I get from the ds that utilization of GPIO MATRTIX would compromise the high speed performance of the high speed buses as SPI, UART etc, and I wonder if there is a example of direct access to the spi using only IOMUX? Or is it compatible with the povided spi master example, and all I have to do is replace the PIN_MAP defs with IO MUX accessible pins?

aureoleday
Posts: 22
Joined: Wed Dec 19, 2018 2:10 am

Re: SPI master例程的疑问

Postby aureoleday » Tue Dec 25, 2018 2:23 pm

Xiong Yu wrote:
Tue Dec 25, 2018 11:14 am
你好,
ESP32有一个GPIO交换矩阵,一些外设可以通过该交换矩阵将信号分配到任意可用的io pad上,方便硬件设计。

可以参考如下资料:
* https://docs.espressif.com/projects/esp ... -and-iomux
* https://espressif.com/sites/default/fil ... ual_en.pdf
谢谢,这个功能挺有意思,有种在用FPGA的错觉 8-)

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: SPI master例程的疑问

Postby ESP_igrr » Tue Dec 25, 2018 3:25 pm

aureoleday wrote:
Tue Dec 25, 2018 2:19 pm
Or is it compatible with the povided spi master example, and all I have to do is replace the PIN_MAP defs with IO MUX accessible pins?
That's right, you can change the pin numbers in the example to IOMUX pins, and the driver will use the IOMUX.

Who is online

Users browsing this forum: No registered users and 58 guests