analogdevicesinc / msdk

Software Development Kit for Analog Device's MAX-series microcontrollers
Apache License 2.0
60 stars 75 forks source link

SPI Slave Select GPIO Configuration / spi_me10.c #1019

Open demiromerb opened 1 month ago

demiromerb commented 1 month ago

Function : int MXC_SPI_Init(mxc_spi_regs_t *spi, int masterMode, int quadModeUsed, int numSlaves, unsigned ssPolarity, unsigned int hz) File : PeriphDrivers/Source/SPI/spi_me10.c

This SPI init function for ME10 configures Slave Select(SSEL) 0 pin by default if selected SPI is SPI0 but does not configure any SSEL pins if any other SPI modules are used.

There is MXC_SPI_SetSlave function but it does not configure the GPIO settings for the SSEL pin either(Selecting alternate function for the GPIO).

For ME18 (spi_me18.c) the MXC_SPI_Init function takes one more argument with prototype "mxc_spi_pins_t pins" which stores the SSEL pins to be used and the function configures the GPIO and SPI accordingly.

So, I could not find any other way for using, for example, SPI2 with SSEL1 on ME10 by configuring the GPIO settings for SSEL1 manually, which does not seem very customer friendly and reduces the code readability.