Skip to content

IDF V6 SPI API issue (IDFGH-17260) #18251

@vladkvit

Description

@vladkvit

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

After updating to ESP-IDF v6.0, I am facing an issue with my SPI driver. This issue is a regression - IDF v5.5.2 works fine. The core problem - my SPI driver interfaces with an ADC, I need to read precisely 18 bytes of data, and v6 does not allow reading of amounts not aligned to 4.

I configure my SPI like so:

  void* spi2adc         = heap_caps_malloc(20, MALLOC_CAP_DMA);
  void* adc2spi         = heap_caps_malloc(20, MALLOC_CAP_DMA);

  transDesc = {
      .flags            = SPI_TRANS_DMA_BUFFER_ALIGN_MANUAL,
      .cmd              = 0,
      .addr             = 0,
      .length           = 18 * 8, // in bits.
      .rxlength         = 0, // 0 makes it rxlength set to the value of .length
      .override_freq_hz = 0,
      .user             = nullptr,
      .tx_buffer        = spi2adc,
      .rx_buffer        = adc2spi,
  };

When I call spi_device_polling_start(), I get the following exception:

SPI_TRANS_DMA_BUFFER_ALIGN_MANUAL but RX addr&len not align to 4, or not dma_capable

Note that I allocate a 20-byte buffer, but I just need to read exactly 18 bytes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions