cancel
Showing results for 
Search instead for 
Did you mean: 

Troubleshooting SPI Slave and DMA Functionality on STM32U585 at Lower System Clock Frequencies

NKshi.1
Associate

Hello,

Custom Board Development with STM32U585 Microcontroller

We have developed a custom board featuring an STM32U585 microcontroller. This custom board is interfaced with another board via SPI. Our setup employs FreeRTOS, with SPI configured as a slave using DMA for both transmission (Tx) and reception (Rx). The SPI clock frequency is approximately 400 kHz.

Performance with System Clock at 80 MHz

Communication between the boards operates effectively when the system clock frequency is set to 80 MHz.

Power Consumption Reduction Efforts

To lower the overall power consumption of the board, we have attempted to reduce the system clock frequency to 4 MHz and 16 MHz. However, at these reduced frequencies, the SPI fails to receive any data.

Configuration Details

Below are the configuration details for the system clock and the attached SPI configuration files:

void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};

/** Configure the main internal regulator output voltage
*/
if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE4) != HAL_OK)
{
Error_Handler();
}

/** Configure LSE Drive Capability
*/
HAL_PWR_EnableBkUpAccess();
__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW);

/** Initializes the CPU, AHB and APB buses clocks
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_LSE
|RCC_OSCILLATORTYPE_MSI;
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
RCC_OscInitStruct.MSIState = RCC_MSI_ON;
RCC_OscInitStruct.MSICalibrationValue = RCC_MSICALIBRATION_DEFAULT;
RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_4;
RCC_OscInitStruct.LSIDiv = RCC_LSI_DIV1;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}

/** Initializes the CPU, AHB and APB buses clocks
*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2
|RCC_CLOCKTYPE_PCLK3;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_MSI;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB3CLKDivider = RCC_HCLK_DIV1;

if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK)
{
Error_Handler();
}

/** Enable MSI Auto calibration
*/
HAL_RCCEx_EnableMSIPLLModeSelection(RCC_MSISPLL_MODE_SEL);
HAL_RCCEx_EnableMSIPLLMode();
if (HAL_RCCEx_EnableMSIPLLFastStartup() != HAL_OK)
{
Error_Handler();
}
}

 

Let us know what can be the issue?

0 REPLIES 0