This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

LPComp events triggers by other inputs

Hi

I am currently doing a project based on the nRF52840 MCU and evaluation board

as part of my project, I have used the LPComp module, and set it up to trigger on rising voltage

#define LPCOMP_REF				NRF_LPCOMP_REF_EXT_REF0			//AIN0
#define AUD_DET					NRF_LPCOMP_INPUT_1				//AIN1

    nrf_drv_lpcomp_config_t config = NRF_DRV_LPCOMP_DEFAULT_CONFIG;
	nrf_lpcomp_config_t		hal_config;

	hal_config.reference	= LPCOMP_REF;
	hal_config.detection	= NRF_LPCOMP_DETECT_UP;
	hal_config.hyst			= NRF_LPCOMP_HYST_NOHYST;

	config.hal		= hal_config;
	config.input	= AUD_DET;

	// initialize LPCOMP driver, from this point LPCOMP will be active and provided
	// event handler will be executed when defined action is detected
	errorCode = nrf_drv_lpcomp_init(&config, lpcomp_event_handler);
	APP_ERROR_CHECK(errorCode);

	nrf_drv_lpcomp_enable();

I have done so by following the LPComp example of the 15.3 SDK, which my project uses

I have tested the module and it seems to work

however, I am also recording LPComp events triggering when other modules are used (for example, when using LEDs or other GPIOs)

I have tried connecting both references together, grounding both, yet I still get LPComp events

I have also tested on two evaluation boards, so I know that the one I normally use isn't just faulty (unless both are faulty somehow)

Is there any reason for this behavior? anything I could test to try and figure out the cause?

if there is any more information I can provide to help with solving this, please let me know and I'll do my best to provide it

thanks in advance

Parents
  • Hi,

    Which GPIOs are you using for the other modules that trigger the events?

    Can you provide a full project that can be used to reproduce this behavior?

    Best regards,
    Jørgen

  • Ok, these pins should not overlap with the analog inputs. You can upload a zipped version of the project as an attachment to your comment/answer here (Insert -> Insert image/video/file). If you do not want to post the code in public, I can convert the case into a private one.

  • Sosense_POC.7z

    what you are looking for is the sosense.emProject file (I recently ported to SES)

    you may need to comment out some code, as it is expecting some peripherals, though it may work without any changes (please verify that nrf_drv_lpcomp_disable() is commented out in sosense_lpcomp_drv.c)

    I noticed that in normal mode, pressing button 2 generates the event (I added the effect of LED 3 lighting for 0.5s when the event is sent)

    In validation mode (press botton 1 when starting up), most actions generate the events (you can clearly see the prints by connecting with Tera Term or a similar program). you should see many logs of "LPComp High Voltage event". using the LED CLI command is easiest to test this

    I hope this helps you test it, and please let me know if I can provide any more assistance, as it isn't a small project and is kind of messy (we're trying many things with it)

  • What do you have the LPCOMP pins connected to when you test this? I'm not able to generate the event when I have AIN0 connected to VDD and AIN1 connected to GND. When the pins are left unconnected/floating, I can see the event being generated many times, but I would expect the voltage level on floating pins bo to be affected by external circuitry.

    I also tested with AIN0/AIN1 both connected to GND and both connected to VDD, not able to generate the events by pressing buttons.

  • I found the issue

    thanks to your comment, I realized that I had used the wrong pins (I took the pin number from the pca file instead of looking at the datasheet)

    testing on the correct pins, it seems that everything is working properly

    I'll test again to verify that the LPComp itself works correctly on the correct pins

    not sure how changing the states of other pins generated the events, but I must have caused currents in the ICs and caused the issue

    thanks a lot for your assistance, your test made me realize my error

    after I've verified everything works, I'll let you know and close this

  • I tested this again, and the LPComp triggers correctly

    I don't know how testing it on the wrong pins seemed to work correctly, but I guess I must have caused spikes in the currents of the ICs when I changed the voltage of the other pins

    thank you for your help, feel free to close this case

Reply Children
No Data
Related