2019-08-05 08:04 AM
I'm using CubeMX for code generation.
I configured my MCU (STM32F103VET6) for PWM generation on Timer 2 Channel 2 using DMA (DMA 1 channel 7), Memory to Peripherial; PWM data stored in array.
All works good, if I fill data array programmatically.
When I read data to array from SPI flash (I checked readed array in debugger, it contains right data), I cannot start PWM DMA.
For firmware versions before 1.8.0 (I've checked 1.6.1 and 1.7.0) call of HAL_SPI_Transmit() changes hdma->State to HAL_DMA_STATE_RESET (so HAL_TIM_PWM_Start_DMA() will not start at all). Firmware versions 1.8.0 keeps hdma->State value HAL_DMA_STATE_READY after HAL_SPI_Transmit(), but HAL_TIM_PWM_Start_DMA() falls into HardFault.
Unfortunately, cannot check SPI2 and SPI3, only SPI1 is available on board.
Is it normal behaviour for this MCU?
Solved! Go to Solution.
2019-08-05 09:17 AM
>call of HAL_SPI_Transmit() changes hdma->State
Something is seriously wrong in your program, a polled Tx from SPI should not overwrite any variable in memory.
JW
2019-08-05 09:17 AM
>call of HAL_SPI_Transmit() changes hdma->State
Something is seriously wrong in your program, a polled Tx from SPI should not overwrite any variable in memory.
JW
2019-08-06 12:25 PM
Thanks for your response. I've recreated project again, this error has gone.