咨询ESP32S3的SPI时钟达不到80M,示波器看不到时钟

matrixwell
Posts: 1
Joined: Thu Dec 29, 2022 12:31 am

咨询ESP32S3的SPI时钟达不到80M,示波器看不到时钟

Postby matrixwell » Thu Dec 29, 2022 2:19 am

核心板是官方的 ESP32-S3-DevKitC-1
IDF版本5.0
SPI配置如下
  1. #define SPI_PORT    SPI2_HOST
  2. #define SPI_MISO    GPIO_NUM_13
  3. #define SPI_MOSI    GPIO_NUM_11
  4. #define SPI_CLK     GPIO_NUM_12
  5. #define SPI_CS      GPIO_NUM_10
  6. #define SPI_WP      GPIO_NUM_14
  7. #define SPI_HD      GPIO_NUM_9
  8.  
  9. #define QPI_BUFFER_LEN  1024
  10.  
  11. static esp_err_t ret;
  12. static spi_device_handle_t spi;
  13. static spi_transaction_t trans;
  14.  
  15. void QPI_Init(void)
  16. {
  17.     int32_t i=0;
  18.     spi_dma_chan_t dma = SPI_DMA_CH_AUTO;
  19.     spi_bus_config_t buscfg={
  20.         .miso_io_num = SPI_MISO,
  21.         .mosi_io_num = SPI_MOSI,
  22.         .sclk_io_num = SPI_CLK,
  23.         .quadwp_io_num = SPI_WP,
  24.         .quadhd_io_num = SPI_HD,
  25.         //.max_transfer_sz = 64,
  26.         .flags = SPICOMMON_BUSFLAG_MASTER|SPICOMMON_BUSFLAG_QUAD
  27.     };
  28.     ret = spi_bus_initialize(SPI_PORT, &buscfg, dma);
  29.  
  30.     spi_device_interface_config_t dev_config={
  31.         .command_bits = 0,
  32.         .address_bits = 0,
  33.         .clock_speed_hz = SPI_MASTER_FREQ_80M,
  34.         .mode = 0,
  35.         .flags=SPI_DEVICE_HALFDUPLEX,
  36.         .spics_io_num = SPI_CS,
  37.         .duty_cycle_pos = 0,
  38.         .queue_size = 6,
  39.         //.post_cb=post_setup_cb
  40.     };
  41.     ret = spi_bus_add_device(SPI_PORT,&dev_config,&spi);
  42.     memset(&trans, 0, sizeof(trans));
  43.     memset(&qpi_rec, 0, sizeof(qpi_rec));
  44.     trans.flags=SPI_TRANS_MODE_QIO;
  45.     trans.tx_buffer =NULL;
  46.     trans.rx_buffer = qpi_rec;
  47.     trans.length = 0;
  48.     trans.rxlength = QPI_BUFFER_LEN * 8;
  49. }
示波器看SCLK,基本看不到时钟波形
Image
修改时钟频率到40M时SCLK的波形
Image
修改时钟频率到20M时SCLK的波形
Image

请问这个地方应该如何调整,能使用80M时钟?
Attachments
12.jpg
20M时钟频率波形
12.jpg (204.81 KiB) Viewed 1089 times
13.jpg
40M时钟频率波形
13.jpg (150.19 KiB) Viewed 1089 times
14.jpg
80M时钟频率波形
14.jpg (144.01 KiB) Viewed 1089 times

Who is online

Users browsing this forum: Google [Bot] and 41 guests