I see there is a comparitor function in the S3A7 manual, but do not find a driver for it in e2 studio. There is a section in the pin configuration peripherals for configuring the AnalogCMP. Am I missing something? Is this function yet to be added?
In reply to adboc:
In reply to Eighth:
Analog comparator drivers are currently for S1JA only, hence you're not able to add them on the "Threads" tab.
I'm attaching a basic example for low power comparator using manual configuration: s3_a6_tb_hal_acmplp_reg_1_4_0.zip
In reply to Renesas Karol:
Thank you! I'll be grateful for a bit more help on my case.
I use custom board with S5D9 (R7FS5D97E3A01CFP) chip, IAR 8.21, SSC 6.2.1 and SSP 1.5.0-rc1.
I need to detect short impulse of analog signal on pin P006. I planning to do it using ACMPHS with reference voltage from DAC. After detection of this impulse I need to perform ADC measurements on some other pins.
My proof-of-concept code:
Code does not working as I expected. ISR invoked exactly two times at the start of the program and never after that, no matter what voltage on P006 is. What is wrong?
Edit: long piece of code removed, see correct code in Karol's response below.
Hi Eighth- You might find it helpful to use Visual Expressions to observe the analog voltages in your project. A good example of how to do this is available in this Knowledge Base article. It also uses the Analog Comparator (the low power version however) so that might also help you check on some initialization settings.
(Link fixed per below comment) https://en-support.renesas.com/knowledgeBase/18039086 Warren
In reply to WarrenM:
Hi Warren,I'm sorry but it seems like you linked wrong article. Did you mean en-support.renesas.com/.../18039086 ? I'll check it out, thank you. However, examples on ACMPHS (and even better, pairing with DAC and timers) would be a lot more helpful.Best regards,Eighth
I may have spotted some issues that cause the malfunction of this peripheral:* You're setting interrupt priority level after it's enabled.* IRQ is enabled in the NVIC after peripheral is enabled.* Your application is performing extensive ISR processing (while(1) blocking) - you can use comparator interrupt as a trigger to start ADC conversion and ADC scan end interrupt in turn could trigger a transfer of the results to your designated area in memory.
I'm attaching a working example for ACMPHS on S5D9-based PK-S5 board: s5_pk_hal_acmphs_reg_1_4_0.zip