-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
invalidThis doesn't seem rightThis doesn't seem right
Description
Describe the bug
The problem is simple, I use STM32G071GBU6, using SPI to connect the sensor.
The IO configuration of SPI is as follows:
SPI.setMISO(PA3);
SPI.setMOSI(PA4);
SPI.setSCLK(PD1);
SPI.setSSEL(PD0);
This configuration is supported in STM32CUBEMX. And this IO configuration is also supported in the PeripheralPins.c file.
The problem I'm having is that as long as SCLK is configured as PD1, the program gets stuck when it executes to read the SPI. If I replace PD1 with other pins, it will not get stuck, and I can read and write SPI data normally.
To Reproduce
Using SPI example (DigitalPotControl.ino)
// inslude the SPI library:
#include <SPI.h>
// set pin 10 as the slave select for the digital pot:
const int slaveSelectPin = 10;
void setup() {
// set the slaveSelectPin as an output:
Serial.begin(9600);
pinMode(slaveSelectPin, OUTPUT);
// initialize SPI:
SPI.setMISO(PA3);
SPI.setMOSI(PA4);
// SPI.setSCLK(PB8);
SPI.setSCLK(PD1);
SPI.setSSEL(PD0);
SPI.begin();
}
void loop() {
Serial.println("running");
digitalPotWrite(0, 1);
}
void digitalPotWrite(int address, int value) {
// take the SS pin low to select the chip:
digitalWrite(slaveSelectPin, LOW);
// send in the address and value via SPI:
SPI.transfer(address);
SPI.transfer(value);
// take the SS pin high to de-select the chip:
digitalWrite(slaveSelectPin, HIGH);
}
Expected behavior
Serial will print 'running' without stopping with PD1.
Desktop (please complete the following information):
- OS: macOS 13.1
- Arduino IDE version: 1.8.19
- STM32 core version: 2.3.0
- Tools menu settings if not the default:
- Upload method: SWD
Board (please complete the following information):
- Name: Custom G071
Metadata
Metadata
Assignees
Labels
invalidThis doesn't seem rightThis doesn't seem right
