Bug in SPI-library or in example sketch?
Posted: Sun May 19, 2024 6:35 am
My system:
Windows 10
ArduinoIDE 2.3.2
Arduino core for STM32 MCUs 2.7.1
There is a test-sketch named SPI_loop.ino inside examples
https://github.com/stm32duino/STM32Exam ... I_loop.ino
The code from line 50 to 53 is:
Compiler throws errors.
So I compare with library
https://github.com/stm32duino/Arduino_C ... es/SPI/src
In SPI.h line 125:
So begin() can't take a parameter. I don't see an additional version (function overloading?) with parameter.
Also from line 134 in SPI.h:
doesn't fit to the code in SPI_loop.ino.
And inside README.md for SPI library there is close to the end also an example, where begin() has a parameter:
Windows 10
ArduinoIDE 2.3.2
Arduino core for STM32 MCUs 2.7.1
There is a test-sketch named SPI_loop.ino inside examples
https://github.com/stm32duino/STM32Exam ... I_loop.ino
The code from line 50 to 53 is:
Code: Select all
SPI.begin(CS_PIN);
for (uint8_t received = 0; received < TEST_LOOP_NB; received++) {
SPI.transfer(CS_PIN, buffer_tx, buffer_rx, BUF_SIZE, SPI_LAST);
So I compare with library
https://github.com/stm32duino/Arduino_C ... es/SPI/src
In SPI.h line 125:
Code: Select all
void begin(void);
Also from line 134 in SPI.h:
Code: Select all
/* Transfer functions: must be called after initialization of the SPI
* instance with begin() or beginTransaction().
*/
uint8_t transfer(uint8_t data, bool skipReceive = SPI_TRANSMITRECEIVE);
uint16_t transfer16(uint16_t data, bool skipReceive = SPI_TRANSMITRECEIVE);
void transfer(void *buf, size_t count, bool skipReceive = SPI_TRANSMITRECEIVE);
/* Expand SPI API
* https://github.com/arduino/ArduinoCore-API/discussions/189
*/
void transfer(const void *tx_buf, void *rx_buf, size_t count);
And inside README.md for SPI library there is close to the end also an example, where begin() has a parameter:
Code: Select all
SPI.setMISO(PC_4); // using pin name PY_n
SPI.setMOSI(PC2); // using pin number PYn
SPI.begin(2);