Hi guys, thanks for this library! There’s so much here that’s useful.
I’m using the minimal library, and compiled together code from the
esp32_bldc_magnetic_spi example projects.
Oddly, I’ve never been successful programming the STM32 directly from the Arduino IDE, so my workflow has been to generate the binary from Arduino, and actually program the STM32 using STM32CubeProgrammer.
I compiled these tables from the datasheets:
|Connector||Pin||Arduino Label||Morpho Label||Function|
|4||D11||PA7||TIM17_CH1 or SPI1_MOSI|
|3||D10||PB6||TIM16_CH1N or SPI1_CS|
|Connector||Pin||Signal||Morpho Label||Arduino Label|
From that info, I changed these lines like so:
// SPI magnetic sensor instance //MagneticSensorSPI sensor = MagneticSensorSPI(10, 14, 0x3FFF); MagneticSensorSPI sensor = MagneticSensorSPI(PB6, 14, 0x3FFF); // BLDC motor & driver instance BLDCMotor motor = BLDCMotor(11); //BLDCDriver6PWM driver = BLDCDriver6PWM(7, 2, 6, 3, 5, 4, 8); BLDCDriver6PWM driver = BLDCDriver6PWM(PA8, PB13, PA9, PB14, PA10, PB1, PB5);
When I run the program though, this is the only output I get over serial:
MOT: Monitor enabled! MOT: Initialise variables. MOT: Enable driver. MOT: Align sensor.
The serial interface is unresponsive to commands, and the motor does not move at all. Any idea what I’m doing wrong here? I assume that the program might be waiting for something over SPI, but I don’t know how to debug that if so.
Also, in case it matters, I have no idea how to tell Simple FOC which pins to use for SPI communications. The STM32L452RE has three separate sets of pins ready for SPI, so I picked the set labeled 1 out of 3.