2023-11-06 05:04 AM
Hello,
I am experiencing counting errors (specifically overflow counting errors) on LPTIM1.
A bit of context first: the goal is to use the LPTIM1 to count pulses which are first treated by the COMP1 (to convert the input signal into an all-or-nothing signal).
The first round of testing was realised with an external source of power as COMP1's voltage reference (minus input), and there was no issue with the overflow count (which is necessary to allow counting continuity). Thing is: the final board has to be completely autonomous and use as little resources as possible, including the sources of power.
So, the idea was to switch to the DAC as COMP1's voltage reference. Since I've done that, the overflow counting isn't incrementing any more, and the pulse count is wrong. Another round of testing - this time routing COMP1's minus input to an external pin - revealed that if the program is initialised on the external power source, and then switched to the DAC's output, the counting works just fine. But, if the program is initialised with COMP1's minus input on the DAC output, it doesn't work at all (even when replugging the external power source later on).
I have no clue on how to fix this weird behaviour, so here I am.
Thanks in advance for the help.
2023-11-06 06:05 AM - edited 2023-11-06 06:13 AM
Hello @afacerias,
I am sorry for your bad experience with our products. Just to be sure, have you checked the device erratasheet, specifically points 2.8.1 and 2.8.2? (link) What is the configuration of PA4 and PA5 pins?
BR,
Jaroslav
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-11-06 06:11 AM - edited 2023-11-06 06:12 AM
Hi, the link you shared returns a 404 Error... :\ But I have read it before.
Nonetheless, PA4 is in Reset_State and PA5 is DAC_OUT2.
2023-11-07 01:35 AM
Hello @afacerias,
you are right, sorry, I inserted the address two times. It should be OK now.
Anyway back to your issue: have you checked the outputs of the DAC and COMP on a scope?
BR,
Jaroslav
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-11-07 01:39 AM
Hello,
The DAC and COMP outputs all show the expected results. It really seems like if the board is initialised while the DAC's output is on COMP's [-] input, the LPTIM overflow interrupts cease working.
Best regards,
A. FACERIAS
2023-11-07 05:01 AM
OK, so the input to the LPTIM is in both cases the same, but the pulse count (CNT register) and interrupt generation on ARR match are corrupted?
Could you share with us some simplified code with this wrong behavior?
Thank you,
Jaroslav
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-11-07 05:11 AM
2023-11-26 11:51 PM
Hello,
I haven't had any news coming from you in two weeks. Is there a problem with the files I sent?
Best regards,
A. FACERIAS