Problems with CubeMX and TIM1+DMA for PWM on STM32MP157 - DK1
I'm trying to get PWM running on an STM32MP157-DK1.
When i run the example code "TIM_DMABurst" there is a PWM (had oscilloscope on Pin). Then I configured TIM1 on Channel 1 and the DMA on Stream2 with CubeMX. The generated code looks exactly the same like in the example, but there is no PWM output.
Is there a problem with the HAL driver, or maybe clock configuration? Spent hours in debugging this, but i need PWM to drive a WS2812 LED Strip.
I recognized that the example jumps over SystemClock_Config() (works without ENGENEERING_MODE).
The code shows the beginning of main.c.
I'm thankful for every advise!
#include "main.h"
#include "openamp.h"
/* Private variables ---------------------------------------------------------*/
IPCC_HandleTypeDef hipcc;
TIM_HandleTypeDef htim1;
DMA_HandleTypeDef hdma_tim1_up;
uint32_t Prescaler ;
/* Capture Compare buffer */
uint32_t aSRC_Buffer[3] = {0x0FFF, 0x0000, 0x0555};
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
void PeriphCommonClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_DMA_Init(void);
static void MX_IPCC_Init(void);
static void MX_TIM1_Init(void);
int MX_OPENAMP_Init(int RPMsgRole, rpmsg_ns_bind_cb ns_bind_cb);
int main(void)
{
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
if(IS_ENGINEERING_BOOT_MODE())
{
/* Configure the system clock */
SystemClock_Config();
}
__HAL_RCC_HSEM_CLK_ENABLE();
Prescaler = (HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_TIMG2)/ (16 * 1000000)) - 1 ;
/* IPCC initialisation */
MX_IPCC_Init();
/* OpenAmp initialisation ---------------------------------*/
MX_OPENAMP_Init(RPMSG_REMOTE, NULL);
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_TIM1_Init();
/*## Start PWM signal generation in DMA mode ############*/
if(HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1) != HAL_OK)
{
/* Starting PWM generation Error */
Error_Handler();
}
/*## Start DMA Burst transfer #######*/
HAL_TIM_DMABurst_WriteStart(&htim1, TIM_DMABASE_ARR, TIM_DMA_UPDATE, (uint32_t*)aSRC_Buffer, TIM_DMABURSTLENGTH_3TRANSFERS);
while (1)
{
}
}