Unable to set SPI master clock rate to 16Mhz

Hi,

I am evaluating spi_trx_in_dma_mode on RTL8720DF.
How do I set the SPI clock rate to 16 MHz? I am to set it to 25Mhz and 12.5Mhz but i have a requirement for 16Mhz. Is it possible?

Regards

Hi @Jitendra_Singh

By default, the example uses SPI1 as the master. You can try changing the master to use SPI0.
SPI1 has a peripheral clock of 50Mhz, which makes it difficult to get an even clock divider that results in 16Mhz.
SPI0 has a peripheral clock of 100Mhz, which is possible to get an even clock divider that results in 16.67Mhz.

Hi,

SIP0 is not available I am using SDIO master.
I only have HS_USI_SPI_MOSI and SPI1.
Can I get 16Mhz with HS_USI_SPI_MOSI?

Regards

Unfortunately, it looks like USI_SPI also has the same issue.

SPI0 is available on PA_16 to PA_19 or PB_18 to PB_21. PB_18 to PB_21 conflicts with SDIO pins, but are PA_16 to PA_19 pins also not available?

These pins are also not available…since i am using RTL8720DF

It seems like this is a hard limit that cannot be solved without changing some components.

I can think of a few options, but none of them are ideal:

  1. Try to get the SPI peripheral to accept 12.5MHz. In my experience, most devices can accept a range of SPI speeds and only set an upper limit.
  2. Use some combination of external components to allow switching the pins between SPI and SDIO (Multiplexer?). However this means that both cannot be used at the same time.
  3. Assuming SDIO is used for a SD card, use the SD card in SPI mode. This results in a decrease in speed, and will require writing of drivers for communicating with the card through SPI.
  4. Change to a chip/module with more pins.

Do you have any recommended part number for the multiplexer?

I do not actually have any experience with using it this way, was just listing out a possibility, thus I do not have a recommended part number for that.