Skip to content

SPI2 hang on BlackPill F411 #1331

@VitorBoss

Description

@VitorBoss

I'm having trouble using SPI2 on WeAct black pill F411, this is the SPI library example:

#include <SPI.h>
//            MOSI  MISO  SCLK
SPIClass SPI3(PC12, PC11, PC10);

void setup() {
  SPI3.begin(2); //Enables the SPI3 instance with default settings and attaches the CS pin  
  SPI3.beginTransaction(1, settings); //Attaches another CS pin and configure the SPI3 instance with other settings  
  SPI3.transfer(2, 0x52); //Transfers data to the first device
  SPI3.transfer(1, 0xA4); //Transfers data to the second device. The SPI3 instance is configured with the right settings  
  SPI3.end() //SPI3 instance is disabled
}

I can't send anything over SPI2 on the device, with a logic analyzer I can't see the traces

Describe the bug
When the SPI try to send a data it simply keep waiting for the flag SPI_SR_TXE got cleared and stuck at spi_com.c line 422

To Reproduce
Just run this

#include <SPI.h>
//            MOSI  MISO  SCLK
SPIClass spiToUse(PB15, PB14, PB13);

void setup() {
  spiToUse.begin(PB12);
  spiToUse.beginTransaction(PB12, SPISettings(1000000, MSBFIRST, SPI_MODE0));
  spiToUse.transfer(PB12, 0x06); //write enable
  spiToUse.transfer(PB12, 0x05); //read status register
  uint8_t answer = spiToUse.transfer(PB12, 0xFE); //dummy byte
  spiToUse.endTransaction(PB12);
  Serial.println(answer);
}

Steps to reproduce the behavior:

  1. Upload the code
  2. See error

Expected behavior
It should send the data or return an error after timeout

Screenshots
If applicable, add screenshots to help explain your problem.
image

Desktop (please complete the following information):

  • OS: latest win10
  • Arduino IDE version: latest platforIO on VScode
  • STM32 core version: 1.9
  • Tools menu settings if not the default: build_flags = -g -std=gnu++11 -DARDUINO_BLACKPILL_F411CE -DHAL_UART_MODULE_ENABLED
  • Upload method: STLink

Board (please complete the following information):

  • Name: WeAct BlackPill F411
  • Hardware Revision: 1.3
  • Extra hardware used if any: FM25L256 FRAM chip but isn't needed for the error

Metadata

Metadata

Assignees

Labels

invalidThis doesn't seem right

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions