2016-03-31 09:19 PM
Hello,
I'm trying to drive DS12B80(One-wire interface)using F030. Thus I initiated a PWM output channel 4 and a input capture channel 1 of TIM3. And the DMAs are started with: HAL_TIM_IC_Start_DMA(htim,TIM_CHANNEL_1,(uint32_t *)rxdata,90); HAL_TIM_PWM_Start_DMA(htim,TIM_CHANNEL_4,(uint32_t *)txdata,102); I want to generate a PWM wave to drive DS18B20 as a master and receive its response by the input capture channel. This context doesn't work because while a DMA of a timer is running, htim->state is set to BUSY. So I make some changes here: HAL_TIM_IC_Start_DMA(htim,TIM_CHANNEL_1,(uint32_t *)rxdata,90); htim->State=HAL_TIM_STATE_READY; HAL_TIM_PWM_Start_DMA(htim,TIM_CHANNEL_4,(uint32_t *)txdata,102); this code DID work, but this mixing style dose not look comfortable.So I wonder if the code is acceptable?Is there any better way to realise the function? #hal-library2016-04-02 09:53 PM
The best way to do this is to ignore ST's (abominable) HAL and go straight to the hardware, accessing the TIM and DMA registers directly.
2016-04-04 08:28 AM
Thank you for your answering, I have rewritten my code using standard peripheral libraries.