all the pins are normally GPIO, the alternate functions column are the alternate functions available at those particular pins, so for the gpio pin mux, you actually need to configure the pin mux so that it select the correct alternate function at the pin.
If you do not know how to do that, this is done when you construct the SPI object, that specifies the pins for the pin mux, the configuration happens subsequently when you issue the SPI_1.begin() call.
Code: Select all
#include <SPI.h>
SPIClass SPI_1(PA7, PA6, PA5, PA4);
I'd suggest you stick with STM32F411 while getting familiar with the basics like SPI. On C011 you need to struggle first with all these basics such as the pin configurations, then that is not all, you may actually run out of memory doing even just SPI, I think for some devices there is like 6 k of sram for *everything*, and you won't even know if your stack simply overwrite your global variables such as SPI buffers etc.
For SPI1 I'd suggest you can try what I've suggested on STM32F411 i.e. PA4, PA5, PA6, PA7 for SPI1, and create your SPI_1 object as such.
the methods calls are then available under SPI_1.method() (e.g. SPI_1.transfer( .... )).
if you use the default SPI symbol, check in the variant for the default SPI 1 pin configuration.
normally for 'standard' Arduino, SPI is the default symbol. If you need to use more than one SPI device, that goes 'beyond arduino' and you need to create those SPI objects (e.g. name them like SPI_2, SPI_3 etc) with the relevant pin configurations. And that won't be using the symbol SPI.
if you insist on using C011, as well as the default SPI symbol, you can make some changes in the variant for your local copy. e.g. to redefine them using PA4, PA5, PA6, PA7 in the variant.h file. Then you can possibly simply #include <SPI.h> and simply use the SPI symbol.
PA4-PA7 is nearly there in most of the stm32 devices that I see. But note that C011 has an '8 pin' thingy
https://www.st.com/resource/en/datashee ... c011f6.pdf
PA0, PA1, PA2 are packed on a single pin, PA4-PA7 are simply *absent*, and PA0-PA2 has alt functions like SPI1_SCK, SPI1_MOSI on a single pin which means that it is impossible to do SPI on the '8 pin' thingy. But for f6p6 the 20 pin chip, you have PA4-PA7.
note that technically, if you go wire things around those pins, you can literally use
Code: Select all
#include <SPI.h>
// MOSI MISO SCLK SSEL
SPIClass SPI_1(PA2, PA11, PA1, PA8);
/*
#ifndef PIN_SPI_SS
#define PIN_SPI_SS PA8
#endif
#ifndef PIN_SPI_MOSI
#define PIN_SPI_MOSI PA2
#endif
#ifndef PIN_SPI_MISO
#define PIN_SPI_MISO PA11
#endif
#ifndef PIN_SPI_SCK
#define PIN_SPI_SCK PA1
#endif
*/
I think that would be the configs for the SPI symbol.
But that if you prefer a more 'regular looking' set of SPI pins, you can edit your local copy of the variant file.
@fpiSTM
just IMHO, I think we can use PA4-PA7 for the default SPI pins on c011 as the '8 pin' chip can't practically use SPI