Skip to main content
AMatu
Associate
Jan 7, 2023 12:14 AM UTC
Question

SW TRIGGER wrong logic check in HAL_DAC_START - STM32L4 HAL

 /* Check if software trigger enabled */
 if ((hdac->Instance->CR & (DAC_CR_TEN1 | DAC_CR_TSEL1)) == DAC_CR_TEN1)

I think the if check is wrong - we should check if TEN and TSEL are set, but now we check for TSEL=111 and TEN=0

This topic has been closed for replies.

2 replies

Piranha
Principal III
Jan 9, 2023 1:19 AM UTC

Currently it checks for exactly the opposite: TEN=1 and TSEL1=0. Supposedly it is the line 590 of the HAL driver code. The line 599 is also wrong. And the correct solution seems to be like the line 611. Also the block of code at the line 611 could be merged with the block at line 590 if...

Edited by moderating team to adhere to community guidelines

AMatu
AMatuAuthor
Associate
Jan 13, 2023 6:07 PM UTC

Yup. Apparently noone ever used HAL for SW trigger (it makes sense when you want to use TRIANGLE or NOISE generation without HW trigger).