SPI does not use hardware chip select; which parameter is this configured in?

Hardware chip select is not required.

/**

  • @brief Set pin function.

  • @param pad: physical pin, #pin_pad

  • @param func: Pin function.

  • @param flags: flag of the pin (pullup/pulldown), @ref PIN_flags

  • @param hcpu: 1: pin for hcpu; 0: pin for lcpu. It’s obsolete, not used anymore

  • @retval -1 if invalid, otherwise 0

*/

int HAL_PIN_Set(int pad, pin_function func, int flags, int hcpu);

Set the pinmux function of the chip select pin to GPIO function. For example:

HAL_PIN_Set(PAD_PA00 + x, GPIO_A0 + x, PIN_PULLUP, 1);

where x is the pin number; pay attention to pull-up/pull-down requirements.

Hello, if my configuration is PA23: PAD_PA00 + x, GPIO_A0 + x, should both x values be set to 23?

If I want to configure the IO as an output, what mode should each of the following parameters be when calling the HAL_PIN_SetMode() interface?

Yes. The difference between these modes lies in whether input and pull-up/pull-down resistors are enabled. If the IO is used for chip selection, just configure it as PIN_DIGITAL_O_PULLUP.