Skip to main content
Visitor II
January 7, 2023
Question

SW TRIGGER wrong logic check in HAL_DAC_START - STM32L4 HAL

  • January 7, 2023
  • 2 replies
  • 815 views
 /* 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

    Graduate II
    January 9, 2023

    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

    AMatuAuthor
    Visitor II
    January 13, 2023

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