STM32WBB 核电路板无法让 SPI1 工作

问题描述

我一直在试验 STM32WBB 核电路板,试图让 SPI1 工作。我已经使用带有认外围设备的 CubeMX simpyl 配置了项目。我选择了 SPI1 模式:Transmit only Master 因为我只想在示波器上传输和检测一些数据,以确保 SPI1 正常工作。

STM32 cube mx configuration

它在以下认引脚上配置了 SPI1:

SPI1_SCK = PA1

SPI1_MOSI = PA7

从nucleo 数据表中,我发现SPI1_SCK PA1 引脚位于Nucleo 板的A2 接头引脚上: https://www.st.com/resource/en/user_manual/um2435-bluetooth-low-energy-and-802154-nucleo-pack-based-on-stm32wb-series-microcontrollers-stmicroelectronics.pdf

Pinout

在我的代码中,我只是尝试在 while 循环中每 1 秒传输一次:


const uint8_t EEPROM_RDSR = 0b00000101;

int main(void)
{
  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

  /* MCU Configuration--------------------------------------------------------*/

  /* Reset of all peripherals,Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* USER CODE BEGIN Init */

  /* USER CODE END Init */

  /* Configure the system clock */
  SystemClock_Config();

  /* USER CODE BEGIN SysInit */

  /* USER CODE END SysInit */

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_USART1_UART_Init();
  MX_SPI1_Init();

  /* USER CODE BEGIN 2 */

  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */
      HAL_SPI_Transmit(&hspi1,(uint8_t *)&EEPROM_RDSR,1,100);
      HAL_Delay(1000);
    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}

我正在探测引脚 A2(spi1 时钟引脚),但它根本没有切换。有人可以建议任何调试方法吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)