SPI and the fm.fpioa pin list

I recently started porting some SPI example code from Arduino over to MaixPy. While reading through google-translated versions of the SPI docs I found the following information for the machine.SPI class:

  • mosi : MOSI (master output) pin, which can directly transmit the pin value, the value range is [0,47]. Instead of setting it up, use fm to manage pin mappings.
  • miso : MISO (master input) pin, which can directly transmit the pin value, the value range is: [0,47]. Instead of setting it up, use fm to manage pin mappings.

I’ve looked through the fpioa code, including the code from the SDK, and cannot find any reference to SPI0_MOSI, SPI0_MISO, SPI1_MOSI, or SPI1_MISO. All of the examples I can find just use miso= and mosi= for the pin instead of using fm like the documentation mentions. I can’t find any examples of using fm for mapping the SPI data pins like this. Does anyone know what the correct fpioa pin mappings are for MISO/MOSI, or should I just ignore the documentation and follow the examples?

The SPI peripherals of the k210 are kinda special. I think they are not really standard (e.g. they have parallel IO specially designed for LCD output). Maybe the example in the standalone SDK demo can help you. They seem to use two pins of the parallel SPI, one for MISO and one for MOSI. But I haven’t studied this thoroughly.

Thanks for that link. It looks like this is the important bit to grab from it. D0 is MOSI, D1 is MISO. I’ll try that out on this end and see if it works.

fpioa_set_function(SPI_MASTER_MISO_PIN, FUNC_SPI0_D1);
fpioa_set_function(SPI_MASTER_MOSI_PIN, FUNC_SPI0_D0);