Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


STM32L0 + SPI not working after stop mode

Hi,

I am trying to use an e-paper and a STM32L053C8 microcontroller.

When i use the display in the first cicle, all works fine, but after wake up from stop mode, the display not works. Maybe the SPI interface not start well or i am doing somthing wrong.

This is my first days with this microcontroller and hal programming structure.

Thanks,
Regards,

This is my inicialization code:

/**

* @brief SPI1 Initialization Function

* @param None

* @retval None

*/

static void MX_SPI1_Init(void)

{
/* USER CODE BEGIN SPI1_Init 0 */

/* USER CODE END SPI1_Init 0 */

/* USER CODE BEGIN SPI1_Init 1 */

/* USER CODE END SPI1_Init 1 */

/* SPI1 parameter configuration*/

hspi1.Instance = SPI1;

hspi1.Init.Mode = SPI_MODE_MASTER;

hspi1.Init.Direction = SPI_DIRECTION_1LINE;

hspi1.Init.DataSize = SPI_DATASIZE_8BIT;

hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;

hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;

hspi1.Init.NSS = SPI_NSS_SOFT;

hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_2;

hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;

hspi1.Init.TIMode = SPI_TIMODE_DISABLE;

hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;

hspi1.Init.CRCPolynomial = 7;

if (HAL_SPI_Init(&hspi1) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN SPI1_Init 2 */

/* USER CODE END SPI1_Init 2 */
}

This is the code to entry in stop mode and the next code lines that they are executed:

/* Enter Stop Mode */

__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);

HAL_UART_Transmit(&hlpuart1, (uint8_t*)”Sleep mode activated...\r\n”, sizeof(“Sleep mode activated...\r\n”), 20);

HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);


/* Configures system clock after wake-up from STOP: enable HSE, PLL and select

PLL as system clock source (HSE and PLL are disabled in STOP mode) */

//HAL_Init();

SystemClock_Config();

MX_GPIO_Init();

MX_ADC_Init();

MX_LPUART1_UART_Init();

MX_USART2_UART_Init();

MX_RTC_Init();

MX_SPI1_Init();

MX_TIM2_Init();

HAL_UART_Transmit(&hlpuart1, (uint8_t*)”Wake-Up...\r\n”, sizeof(“Wake-Up...\r\n”), 20);

 

Newest Forum Posts

  1. reservation car service Seattle by Jamesprede, 10:06
  2. Last day: drone bonus by Danielrug, 2025-04-19 16:55
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Insightful Perspectives on This Subject by davidsycle, 2025-03-04 05:45
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  9. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  10. Build a project in "release" mode by tang, 2025-02-20 10:36

Last-Modified Blogs